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