blob: eb571a5accf8b4c39944a3682046235c3ed2524e [file] [log] [blame]
Pavel Šimerda06ec9032015-04-13 16:00:56 +02001PREFIX?=/usr
2LIBDIR?=$(PREFIX)/lib
3SBINDIR?=/sbin
4CONFDIR?=/etc/iproute2
5DATADIR?=$(PREFIX)/share
6DOCDIR?=$(DATADIR)/doc/iproute2
7MANDIR?=$(DATADIR)/man
8ARPDDIR?=/var/lib/arpd
9KERNEL_INCLUDE?=/usr/include
Quentin Monnet27d44f32016-05-03 09:39:08 +020010BASH_COMPDIR?=$(DATADIR)/bash-completion/completions
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000011
osdl.net!shemmingerd1e48c72004-06-25 21:20:20 +000012# Path to db_185.h include
Pavel Šimerda06ec9032015-04-13 16:00:56 +020013DBM_INCLUDE:=$(DESTDIR)/usr/include
osdl.net!shemmingerd1e48c72004-06-25 21:20:20 +000014
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050015SHARED_LIBS = y
16
Andreas Henriksson5e3bb532008-08-22 16:54:12 +020017DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050018ifneq ($(SHARED_LIBS),y)
19DEFINES+= -DNO_SHARED_LIBS
20endif
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000021
Christoph J. Thompson5c434a92012-03-01 17:46:26 +010022DEFINES+=-DCONFDIR=\"$(CONFDIR)\"
23
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000024#options for decnet
25ADDLIB+=dnet_ntop.o dnet_pton.o
26
27#options for ipx
28ADDLIB+=ipx_ntop.o ipx_pton.o
29
Eric W. Biedermandacc5d42015-03-15 14:53:45 -050030#options for mpls
31ADDLIB+=mpls_ntop.o mpls_pton.o
32
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000033CC = gcc
site!shemmingerb209eda2005-02-07 18:01:21 +000034HOSTCC = gcc
Christoph J. Thompsonc8610022012-03-01 06:45:17 +000035DEFINES += -D_GNU_SOURCE
Mike Frysinger232aaf42015-05-26 02:51:30 -040036# Turn on transparent support for LFS
37DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
Christoph J. Thompsonc8610022012-03-01 06:45:17 +000038CCOPTS = -O2
Stephen Hemminger3140e9a2013-07-31 17:42:39 -070039WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes
Stephen Hemminger4ec0ffd2014-05-29 10:31:30 -070040WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
Stephen Hemminger6398d3a2013-02-12 11:39:32 -080041
Pavel Šimerda06ec9032015-04-13 16:00:56 +020042CFLAGS := $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) $(CFLAGS)
shemminger9ddbb022005-06-23 17:21:46 +000043YACCFLAGS = -d -t -v
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000044
Jiri Pirkoa3c4b482016-03-22 10:02:21 +010045SUBDIRS=lib ip tc bridge misc netem genl tipc devlink man
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000046
47LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
Diego Elio Pettenò2230ac12011-03-09 10:18:03 -080048LDLIBS += $(LIBNETLINK)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000049
shemminger737f15f2005-07-08 22:08:47 +000050all: Config
Mike Frysinger95dd5952007-03-05 17:50:49 -080051 @set -e; \
52 for i in $(SUBDIRS); \
osdl.net!shemmingeradff36d2004-06-25 21:14:22 +000053 do $(MAKE) $(MFLAGS) -C $$i; done
54
55Config:
shemmingerf35e9282005-06-07 21:48:09 +000056 sh configure $(KERNEL_INCLUDE)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000057
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000058install: all
59 install -m 0755 -d $(DESTDIR)$(SBINDIR)
osdl.net!shemmingere9a05e92004-07-02 17:47:15 +000060 install -m 0755 -d $(DESTDIR)$(CONFDIR)
Olaf Rempele48f73d2005-11-09 15:25:40 +010061 install -m 0755 -d $(DESTDIR)$(ARPDDIR)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000062 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples
63 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv
osdl.net!shemmingerc72238e2004-12-07 23:57:50 +000064 install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \
osdl.net!shemmingere9a05e92004-07-02 17:47:15 +000065 $(DESTDIR)$(DOCDIR)/examples
osdl.net!shemmingerc72238e2004-12-07 23:57:50 +000066 install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \
osdl.net!shemmingere9a05e92004-07-02 17:47:15 +000067 $(DESTDIR)$(DOCDIR)/examples/diffserv
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000068 @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done
osdl.net!shemmingerc72238e2004-12-07 23:57:50 +000069 install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
Quentin Monnet27d44f32016-05-03 09:39:08 +020070 install -m 0755 -d $(DESTDIR)$(BASH_COMPDIR)
71 install -m 0644 bash-completion/tc $(DESTDIR)$(BASH_COMPDIR)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000072
Stephen Hemminger235ac6a2007-12-21 09:53:45 -080073snapshot:
74 echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \
75 > include/SNAPSHOT.h
76
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000077clean:
osdl.net!shemmingeradff36d2004-06-25 21:14:22 +000078 @for i in $(SUBDIRS) doc; \
79 do $(MAKE) $(MFLAGS) -C $$i clean; done
80
Stephen Hemminger82408fc2010-11-18 15:25:38 -080081clobber:
82 touch Config
83 $(MAKE) $(MFLAGS) clean
Stephen Hemmingera6ddc202012-03-14 10:22:25 -070084 rm -f Config cscope.*
osdl.net!shemmingeradff36d2004-06-25 21:14:22 +000085
shemminger87773db2005-06-23 17:23:53 +000086distclean: clobber
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000087
shemmingerf6aa8e02005-06-23 17:31:49 +000088cscope:
89 cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
90
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000091.EXPORT_ALL_VARIABLES: