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