1 PREFIX?=/usr 2 LIBDIR?=$(PREFIX)/lib 3 SBINDIR?=/sbin 4 CONFDIR?=/etc/iproute2 5 DATADIR?=$(PREFIX)/share 6 DOCDIR?=$(DATADIR)/doc/iproute2 7 MANDIR?=$(DATADIR)/man 8 ARPDDIR?=/var/lib/arpd 9 KERNEL_INCLUDE?=/usr/include 10 11 # Path to db_185.h include 12 DBM_INCLUDE:=$(DESTDIR)/usr/include 13 14 SHARED_LIBS = y 15 16 DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\" 17 ifneq ($(SHARED_LIBS),y) 18 DEFINES+= -DNO_SHARED_LIBS 19 endif 20 21 DEFINES+=-DCONFDIR=\"$(CONFDIR)\" 22 23 #options for decnet 24 ADDLIB+=dnet_ntop.o dnet_pton.o 25 26 #options for ipx 27 ADDLIB+=ipx_ntop.o ipx_pton.o 28 29 #options for mpls 30 ADDLIB+=mpls_ntop.o mpls_pton.o 31 32 CC = gcc 33 HOSTCC = gcc 34 DEFINES += -D_GNU_SOURCE 35 # Turn on transparent support for LFS 36 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 37 CCOPTS = -O2 38 WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes 39 WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2 40 41 CFLAGS := $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) $(CFLAGS) 42 YACCFLAGS = -d -t -v 43 44 SUBDIRS=lib ip tc bridge misc netem genl tipc man 45 46 LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a 47 LDLIBS += $(LIBNETLINK) 48 49 all: Config 50 @set -e; \ 51 for i in $(SUBDIRS); \ 52 do $(MAKE) $(MFLAGS) -C $$i; done 53 54 Config: 55 sh configure $(KERNEL_INCLUDE) 56 57 install: all 58 install -m 0755 -d $(DESTDIR)$(SBINDIR) 59 install -m 0755 -d $(DESTDIR)$(CONFDIR) 60 install -m 0755 -d $(DESTDIR)$(ARPDDIR) 61 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples 62 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv 63 install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \ 64 $(DESTDIR)$(DOCDIR)/examples 65 install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \ 66 $(DESTDIR)$(DOCDIR)/examples/diffserv 67 @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done 68 install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR) 69 70 snapshot: 71 echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \ 72 > include/SNAPSHOT.h 73 74 clean: 75 @for i in $(SUBDIRS) doc; \ 76 do $(MAKE) $(MFLAGS) -C $$i clean; done 77 78 clobber: 79 touch Config 80 $(MAKE) $(MFLAGS) clean 81 rm -f Config cscope.* 82 83 distclean: clobber 84 85 cscope: 86 cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc 87 88 .EXPORT_ALL_VARIABLES: 89