lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 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 | ifeq ($(CONFIG_MIN_8M_VERSION), n) |
| 39 | CFLAGS = $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) |
| 40 | else |
| 41 | CFLAGS += $(WFLAGS) -I../include $(DEFINES) |
| 42 | endif |
| 43 | YACCFLAGS = -d -t -v |
| 44 | |
| 45 | SUBDIRS=lib ip tc misc netem genl man |
| 46 | |
| 47 | LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a |
| 48 | LDLIBS += $(LIBNETLINK) |
| 49 | |
| 50 | all: Config |
| 51 | @set -e; \ |
| 52 | for i in $(SUBDIRS); \ |
| 53 | do $(MAKE) $(MFLAGS) -C $$i; done |
| 54 | |
| 55 | Config: |
| 56 | sh configure $(KERNEL_INCLUDE) |
| 57 | ifeq ($(IP_CONFIG_SETNS),y) |
| 58 | sed -i '/IP_CONFIG_SETNS/d' Config |
| 59 | echo "IP_CONFIG_SETNS:=y" >>Config |
| 60 | endif |
| 61 | |
| 62 | install: all |
| 63 | install -m 0755 -d $(DESTDIR)$(SBINDIR) |
| 64 | install -m 0755 -d $(DESTDIR)$(CONFDIR) |
| 65 | install -m 0755 -d $(DESTDIR)$(ARPDDIR) |
| 66 | install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples |
| 67 | install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv |
| 68 | install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \ |
| 69 | $(DESTDIR)$(DOCDIR)/examples |
| 70 | install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \ |
| 71 | $(DESTDIR)$(DOCDIR)/examples/diffserv |
| 72 | @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done |
| 73 | install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR) |
| 74 | |
| 75 | snapshot: |
| 76 | echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \ |
| 77 | > include/SNAPSHOT.h |
| 78 | |
| 79 | clean: |
| 80 | @for i in $(SUBDIRS) doc; \ |
| 81 | do $(MAKE) $(MFLAGS) -C $$i clean; done |
| 82 | rm -fv Config |
| 83 | |
| 84 | clobber: |
| 85 | touch Config |
| 86 | $(MAKE) $(MFLAGS) clean |
| 87 | rm -f Config cscope.* |
| 88 | |
| 89 | distclean: clobber |
| 90 | |
| 91 | cscope: |
| 92 | cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc |
| 93 | |
| 94 | .EXPORT_ALL_VARIABLES: |