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