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