Pavel Šimerda | 06ec903 | 2015-04-13 16:00:56 +0200 | [diff] [blame] | 1 | PREFIX?=/usr |
| 2 | LIBDIR?=$(PREFIX)/lib |
| 3 | SBINDIR?=/sbin |
| 4 | CONFDIR?=/etc/iproute2 |
| 5 | DATADIR?=$(PREFIX)/share |
| 6 | DOCDIR?=$(DATADIR)/doc/iproute2 |
| 7 | MANDIR?=$(DATADIR)/man |
| 8 | ARPDDIR?=/var/lib/arpd |
| 9 | KERNEL_INCLUDE?=/usr/include |
Quentin Monnet | 27d44f3 | 2016-05-03 09:39:08 +0200 | [diff] [blame] | 10 | BASH_COMPDIR?=$(DATADIR)/bash-completion/completions |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 11 | |
osdl.net!shemminger | d1e48c7 | 2004-06-25 21:20:20 +0000 | [diff] [blame] | 12 | # Path to db_185.h include |
Pavel Šimerda | 06ec903 | 2015-04-13 16:00:56 +0200 | [diff] [blame] | 13 | DBM_INCLUDE:=$(DESTDIR)/usr/include |
osdl.net!shemminger | d1e48c7 | 2004-06-25 21:20:20 +0000 | [diff] [blame] | 14 | |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 15 | SHARED_LIBS = y |
| 16 | |
Andreas Henriksson | 5e3bb53 | 2008-08-22 16:54:12 +0200 | [diff] [blame] | 17 | DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\" |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 18 | ifneq ($(SHARED_LIBS),y) |
| 19 | DEFINES+= -DNO_SHARED_LIBS |
| 20 | endif |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 21 | |
Christoph J. Thompson | 5c434a9 | 2012-03-01 17:46:26 +0100 | [diff] [blame] | 22 | DEFINES+=-DCONFDIR=\"$(CONFDIR)\" |
| 23 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 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 | |
Eric W. Biederman | dacc5d4 | 2015-03-15 14:53:45 -0500 | [diff] [blame] | 30 | #options for mpls |
| 31 | ADDLIB+=mpls_ntop.o mpls_pton.o |
| 32 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 33 | CC = gcc |
site!shemminger | b209eda | 2005-02-07 18:01:21 +0000 | [diff] [blame] | 34 | HOSTCC = gcc |
Christoph J. Thompson | c861002 | 2012-03-01 06:45:17 +0000 | [diff] [blame] | 35 | DEFINES += -D_GNU_SOURCE |
Mike Frysinger | 232aaf4 | 2015-05-26 02:51:30 -0400 | [diff] [blame] | 36 | # Turn on transparent support for LFS |
| 37 | DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE |
Christoph J. Thompson | c861002 | 2012-03-01 06:45:17 +0000 | [diff] [blame] | 38 | CCOPTS = -O2 |
Stephen Hemminger | 3140e9a | 2013-07-31 17:42:39 -0700 | [diff] [blame] | 39 | WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes |
Stephen Hemminger | 4ec0ffd | 2014-05-29 10:31:30 -0700 | [diff] [blame] | 40 | WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2 |
Stephen Hemminger | 6398d3a | 2013-02-12 11:39:32 -0800 | [diff] [blame] | 41 | |
Pavel Šimerda | 06ec903 | 2015-04-13 16:00:56 +0200 | [diff] [blame] | 42 | CFLAGS := $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) $(CFLAGS) |
shemminger | 9ddbb02 | 2005-06-23 17:21:46 +0000 | [diff] [blame] | 43 | YACCFLAGS = -d -t -v |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 44 | |
Jiri Pirko | a3c4b48 | 2016-03-22 10:02:21 +0100 | [diff] [blame] | 45 | SUBDIRS=lib ip tc bridge misc netem genl tipc devlink man |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 46 | |
| 47 | LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a |
Diego Elio Pettenò | 2230ac1 | 2011-03-09 10:18:03 -0800 | [diff] [blame] | 48 | LDLIBS += $(LIBNETLINK) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 49 | |
shemminger | 737f15f | 2005-07-08 22:08:47 +0000 | [diff] [blame] | 50 | all: Config |
Mike Frysinger | 95dd595 | 2007-03-05 17:50:49 -0800 | [diff] [blame] | 51 | @set -e; \ |
| 52 | for i in $(SUBDIRS); \ |
osdl.net!shemminger | adff36d | 2004-06-25 21:14:22 +0000 | [diff] [blame] | 53 | do $(MAKE) $(MFLAGS) -C $$i; done |
| 54 | |
| 55 | Config: |
shemminger | f35e928 | 2005-06-07 21:48:09 +0000 | [diff] [blame] | 56 | sh configure $(KERNEL_INCLUDE) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 57 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 58 | install: all |
| 59 | install -m 0755 -d $(DESTDIR)$(SBINDIR) |
osdl.net!shemminger | e9a05e9 | 2004-07-02 17:47:15 +0000 | [diff] [blame] | 60 | install -m 0755 -d $(DESTDIR)$(CONFDIR) |
Olaf Rempel | e48f73d | 2005-11-09 15:25:40 +0100 | [diff] [blame] | 61 | install -m 0755 -d $(DESTDIR)$(ARPDDIR) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 62 | install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples |
| 63 | install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv |
osdl.net!shemminger | c72238e | 2004-12-07 23:57:50 +0000 | [diff] [blame] | 64 | install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \ |
osdl.net!shemminger | e9a05e9 | 2004-07-02 17:47:15 +0000 | [diff] [blame] | 65 | $(DESTDIR)$(DOCDIR)/examples |
osdl.net!shemminger | c72238e | 2004-12-07 23:57:50 +0000 | [diff] [blame] | 66 | install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \ |
osdl.net!shemminger | e9a05e9 | 2004-07-02 17:47:15 +0000 | [diff] [blame] | 67 | $(DESTDIR)$(DOCDIR)/examples/diffserv |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 68 | @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done |
osdl.net!shemminger | c72238e | 2004-12-07 23:57:50 +0000 | [diff] [blame] | 69 | install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR) |
Quentin Monnet | 27d44f3 | 2016-05-03 09:39:08 +0200 | [diff] [blame] | 70 | install -m 0755 -d $(DESTDIR)$(BASH_COMPDIR) |
| 71 | install -m 0644 bash-completion/tc $(DESTDIR)$(BASH_COMPDIR) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 72 | |
Stephen Hemminger | 235ac6a | 2007-12-21 09:53:45 -0800 | [diff] [blame] | 73 | snapshot: |
| 74 | echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \ |
| 75 | > include/SNAPSHOT.h |
| 76 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 77 | clean: |
osdl.net!shemminger | adff36d | 2004-06-25 21:14:22 +0000 | [diff] [blame] | 78 | @for i in $(SUBDIRS) doc; \ |
| 79 | do $(MAKE) $(MFLAGS) -C $$i clean; done |
| 80 | |
Stephen Hemminger | 82408fc | 2010-11-18 15:25:38 -0800 | [diff] [blame] | 81 | clobber: |
| 82 | touch Config |
| 83 | $(MAKE) $(MFLAGS) clean |
Stephen Hemminger | a6ddc20 | 2012-03-14 10:22:25 -0700 | [diff] [blame] | 84 | rm -f Config cscope.* |
osdl.net!shemminger | adff36d | 2004-06-25 21:14:22 +0000 | [diff] [blame] | 85 | |
shemminger | 87773db | 2005-06-23 17:23:53 +0000 | [diff] [blame] | 86 | distclean: clobber |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 87 | |
shemminger | f6aa8e0 | 2005-06-23 17:31:49 +0000 | [diff] [blame] | 88 | cscope: |
| 89 | cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc |
| 90 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 91 | .EXPORT_ALL_VARIABLES: |