blob: 543d9e8e1c4cc964a96b24b69ae6d8ba8606cad2 [file] [log] [blame]
Wolfgang Grandeggered1af7e2009-05-12 11:42:49 +02001ROOTDIR=$(DESTDIR)
Christoph J. Thompson5c434a92012-03-01 17:46:26 +01002PREFIX=/usr
3LIBDIR=$(PREFIX)/lib
Rafael Almeidab514b352008-06-01 21:33:44 -03004SBINDIR=/sbin
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +00005CONFDIR=/etc/iproute2
Christoph J. Thompson5c434a92012-03-01 17:46:26 +01006DATADIR=$(PREFIX)/share
7DOCDIR=$(DATADIR)/doc/iproute2
8MANDIR=$(DATADIR)/man
Olaf Rempele48f73d2005-11-09 15:25:40 +01009ARPDDIR=/var/lib/arpd
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000010
osdl.net!shemmingerd1e48c72004-06-25 21:20:20 +000011# Path to db_185.h include
Wolfgang Grandeggered1af7e2009-05-12 11:42:49 +020012DBM_INCLUDE:=$(ROOTDIR)/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
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000029CC = gcc
site!shemmingerb209eda2005-02-07 18:01:21 +000030HOSTCC = gcc
Christoph J. Thompsonc8610022012-03-01 06:45:17 +000031DEFINES += -D_GNU_SOURCE
32CCOPTS = -O2
Stephen Hemminger3140e9a2013-07-31 17:42:39 -070033WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes
Stephen Hemminger6398d3a2013-02-12 11:39:32 -080034WFLAGS += -Wmissing-declarations -Wold-style-definition
35
Christoph J. Thompsonc8610022012-03-01 06:45:17 +000036CFLAGS = $(WFLAGS) $(CCOPTS) -I../include $(DEFINES)
shemminger9ddbb022005-06-23 17:21:46 +000037YACCFLAGS = -d -t -v
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000038
Stephen Hemmingerd04bc302012-08-01 15:23:49 -070039SUBDIRS=lib ip tc bridge misc netem genl man
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000040
41LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
Diego Elio Pettenò2230ac12011-03-09 10:18:03 -080042LDLIBS += $(LIBNETLINK)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000043
shemminger737f15f2005-07-08 22:08:47 +000044all: Config
Mike Frysinger95dd5952007-03-05 17:50:49 -080045 @set -e; \
46 for i in $(SUBDIRS); \
osdl.net!shemmingeradff36d2004-06-25 21:14:22 +000047 do $(MAKE) $(MFLAGS) -C $$i; done
48
49Config:
shemmingerf35e9282005-06-07 21:48:09 +000050 sh configure $(KERNEL_INCLUDE)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000051
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000052install: all
53 install -m 0755 -d $(DESTDIR)$(SBINDIR)
osdl.net!shemmingere9a05e92004-07-02 17:47:15 +000054 install -m 0755 -d $(DESTDIR)$(CONFDIR)
Olaf Rempele48f73d2005-11-09 15:25:40 +010055 install -m 0755 -d $(DESTDIR)$(ARPDDIR)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000056 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples
57 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv
osdl.net!shemmingerc72238e2004-12-07 23:57:50 +000058 install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \
osdl.net!shemmingere9a05e92004-07-02 17:47:15 +000059 $(DESTDIR)$(DOCDIR)/examples
osdl.net!shemmingerc72238e2004-12-07 23:57:50 +000060 install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \
osdl.net!shemmingere9a05e92004-07-02 17:47:15 +000061 $(DESTDIR)$(DOCDIR)/examples/diffserv
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000062 @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done
osdl.net!shemmingerc72238e2004-12-07 23:57:50 +000063 install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000064
Stephen Hemminger235ac6a2007-12-21 09:53:45 -080065snapshot:
66 echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \
67 > include/SNAPSHOT.h
68
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000069clean:
osdl.net!shemmingeradff36d2004-06-25 21:14:22 +000070 @for i in $(SUBDIRS) doc; \
71 do $(MAKE) $(MFLAGS) -C $$i clean; done
72
Stephen Hemminger82408fc2010-11-18 15:25:38 -080073clobber:
74 touch Config
75 $(MAKE) $(MFLAGS) clean
Stephen Hemmingera6ddc202012-03-14 10:22:25 -070076 rm -f Config cscope.*
osdl.net!shemmingeradff36d2004-06-25 21:14:22 +000077
shemminger87773db2005-06-23 17:23:53 +000078distclean: clobber
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000079
shemmingerf6aa8e02005-06-23 17:31:49 +000080cscope:
81 cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
82
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000083.EXPORT_ALL_VARIABLES: