blob: 67176beff3f7cdd55bebc6c390dad886b8169326 [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
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000010
osdl.net!shemmingerd1e48c72004-06-25 21:20:20 +000011# Path to db_185.h include
Pavel Šimerda06ec9032015-04-13 16:00:56 +020012DBM_INCLUDE:=$(DESTDIR)/usr/include
osdl.net!shemmingerd1e48c72004-06-25 21:20:20 +000013
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050014SHARED_LIBS = y
15
Andreas Henriksson5e3bb532008-08-22 16:54:12 +020016DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050017ifneq ($(SHARED_LIBS),y)
18DEFINES+= -DNO_SHARED_LIBS
19endif
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000020
Christoph J. Thompson5c434a92012-03-01 17:46:26 +010021DEFINES+=-DCONFDIR=\"$(CONFDIR)\"
22
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000023#options for decnet
24ADDLIB+=dnet_ntop.o dnet_pton.o
25
26#options for ipx
27ADDLIB+=ipx_ntop.o ipx_pton.o
28
Eric W. Biedermandacc5d42015-03-15 14:53:45 -050029#options for mpls
30ADDLIB+=mpls_ntop.o mpls_pton.o
31
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000032CC = gcc
site!shemmingerb209eda2005-02-07 18:01:21 +000033HOSTCC = gcc
Christoph J. Thompsonc8610022012-03-01 06:45:17 +000034DEFINES += -D_GNU_SOURCE
Mike Frysinger232aaf42015-05-26 02:51:30 -040035# Turn on transparent support for LFS
36DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
Christoph J. Thompsonc8610022012-03-01 06:45:17 +000037CCOPTS = -O2
Stephen Hemminger3140e9a2013-07-31 17:42:39 -070038WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes
Stephen Hemminger4ec0ffd2014-05-29 10:31:30 -070039WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
Stephen Hemminger6398d3a2013-02-12 11:39:32 -080040
Pavel Šimerda06ec9032015-04-13 16:00:56 +020041CFLAGS := $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) $(CFLAGS)
shemminger9ddbb022005-06-23 17:21:46 +000042YACCFLAGS = -d -t -v
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000043
Richard Alpef0437592015-05-07 15:07:36 +020044SUBDIRS=lib ip tc bridge misc netem genl tipc man
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000045
46LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
Diego Elio Pettenò2230ac12011-03-09 10:18:03 -080047LDLIBS += $(LIBNETLINK)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000048
shemminger737f15f2005-07-08 22:08:47 +000049all: Config
Mike Frysinger95dd5952007-03-05 17:50:49 -080050 @set -e; \
51 for i in $(SUBDIRS); \
osdl.net!shemmingeradff36d2004-06-25 21:14:22 +000052 do $(MAKE) $(MFLAGS) -C $$i; done
53
54Config:
shemmingerf35e9282005-06-07 21:48:09 +000055 sh configure $(KERNEL_INCLUDE)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000056
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000057install: all
58 install -m 0755 -d $(DESTDIR)$(SBINDIR)
osdl.net!shemmingere9a05e92004-07-02 17:47:15 +000059 install -m 0755 -d $(DESTDIR)$(CONFDIR)
Olaf Rempele48f73d2005-11-09 15:25:40 +010060 install -m 0755 -d $(DESTDIR)$(ARPDDIR)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000061 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples
62 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv
osdl.net!shemmingerc72238e2004-12-07 23:57:50 +000063 install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \
osdl.net!shemmingere9a05e92004-07-02 17:47:15 +000064 $(DESTDIR)$(DOCDIR)/examples
osdl.net!shemmingerc72238e2004-12-07 23:57:50 +000065 install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \
osdl.net!shemmingere9a05e92004-07-02 17:47:15 +000066 $(DESTDIR)$(DOCDIR)/examples/diffserv
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000067 @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done
osdl.net!shemmingerc72238e2004-12-07 23:57:50 +000068 install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000069
Stephen Hemminger235ac6a2007-12-21 09:53:45 -080070snapshot:
71 echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \
72 > include/SNAPSHOT.h
73
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000074clean:
osdl.net!shemmingeradff36d2004-06-25 21:14:22 +000075 @for i in $(SUBDIRS) doc; \
76 do $(MAKE) $(MFLAGS) -C $$i clean; done
77
Stephen Hemminger82408fc2010-11-18 15:25:38 -080078clobber:
79 touch Config
80 $(MAKE) $(MFLAGS) clean
Stephen Hemmingera6ddc202012-03-14 10:22:25 -070081 rm -f Config cscope.*
osdl.net!shemmingeradff36d2004-06-25 21:14:22 +000082
shemminger87773db2005-06-23 17:23:53 +000083distclean: clobber
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000084
shemmingerf6aa8e02005-06-23 17:31:49 +000085cscope:
86 cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
87
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000088.EXPORT_ALL_VARIABLES: