Home | History | Annotate | Download | only in iproute2
      1 DESTDIR=/usr/
      2 ROOTDIR=$(DESTDIR)
      3 LIBDIR=/usr/lib/
      4 SBINDIR=/sbin
      5 CONFDIR=/etc/iproute2
      6 DOCDIR=/share/doc/iproute2
      7 MANDIR=/share/man
      8 ARPDDIR=/var/lib/arpd
      9 
     10 # Path to db_185.h include
     11 DBM_INCLUDE:=$(ROOTDIR)/usr/include
     12 
     13 SHARED_LIBS = y
     14 
     15 DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
     16 ifneq ($(SHARED_LIBS),y)
     17 DEFINES+= -DNO_SHARED_LIBS
     18 endif
     19 
     20 #options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
     21 LDLIBS=-lresolv
     22 ADDLIB=
     23 
     24 #options for decnet
     25 ADDLIB+=dnet_ntop.o dnet_pton.o
     26 
     27 #options for ipx
     28 ADDLIB+=ipx_ntop.o ipx_pton.o
     29 
     30 CC = gcc
     31 HOSTCC = gcc
     32 CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall
     33 CFLAGS = $(CCOPTS) -I../include $(DEFINES)
     34 YACCFLAGS = -d -t -v
     35 
     36 LDLIBS += -L../lib -lnetlink -lutil
     37 
     38 SUBDIRS=lib ip tc misc netem genl
     39 
     40 LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
     41 
     42 all: Config
     43 	@set -e; \
     44 	for i in $(SUBDIRS); \
     45 	do $(MAKE) $(MFLAGS) -C $$i; done
     46 
     47 Config:
     48 	sh configure $(KERNEL_INCLUDE)
     49 
     50 install: all
     51 	install -m 0755 -d $(DESTDIR)$(SBINDIR)
     52 	install -m 0755 -d $(DESTDIR)$(CONFDIR)
     53 	install -m 0755 -d $(DESTDIR)$(ARPDDIR)
     54 	install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples
     55 	install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv
     56 	install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \
     57 		$(DESTDIR)$(DOCDIR)/examples
     58 	install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \
     59 		$(DESTDIR)$(DOCDIR)/examples/diffserv
     60 	@for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done
     61 	install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
     62 	install -m 0755 -d $(DESTDIR)$(MANDIR)/man8
     63 	install -m 0644 $(shell find man/man8 -maxdepth 1 -type f) $(DESTDIR)$(MANDIR)/man8
     64 	ln -sf tc-bfifo.8  $(DESTDIR)$(MANDIR)/man8/tc-pfifo.8
     65 	ln -sf lnstat.8  $(DESTDIR)$(MANDIR)/man8/rtstat.8
     66 	ln -sf lnstat.8  $(DESTDIR)$(MANDIR)/man8/ctstat.8
     67 	ln -sf rtacct.8  $(DESTDIR)$(MANDIR)/man8/nstat.8
     68 	ln -sf routel.8  $(DESTDIR)$(MANDIR)/man8/routef.8
     69 	install -m 0755 -d $(DESTDIR)$(MANDIR)/man3
     70 	install -m 0644 $(shell find man/man3 -maxdepth 1 -type f) $(DESTDIR)$(MANDIR)/man3
     71 
     72 snapshot:
     73 	echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \
     74 		> include/SNAPSHOT.h
     75 
     76 clean:
     77 	rm -f cscope.*
     78 	@for i in $(SUBDIRS) doc; \
     79 	do $(MAKE) $(MFLAGS) -C $$i clean; done
     80 
     81 clobber: clean
     82 	rm -f Config
     83 
     84 distclean: clobber
     85 
     86 cscope:
     87 	cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
     88 
     89 .EXPORT_ALL_VARIABLES:
     90