1ROOTDIR=$(DESTDIR)
2PREFIX=/usr
3LIBDIR=$(PREFIX)/lib
4SBINDIR=/sbin
5CONFDIR=/etc/iproute2
6DATADIR=$(PREFIX)/share
7DOCDIR=$(DATADIR)/doc/iproute2
8MANDIR=$(DATADIR)/man
9ARPDDIR=/var/lib/arpd
10
11# Path to db_185.h include
12DBM_INCLUDE:=$(ROOTDIR)/usr/include
13
14SHARED_LIBS = y
15
16DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
17ifneq ($(SHARED_LIBS),y)
18DEFINES+= -DNO_SHARED_LIBS
19endif
20
21DEFINES+=-DCONFDIR=\"$(CONFDIR)\"
22
23#options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
24LDLIBS=-lresolv
25ADDLIB=
26
27#options for decnet
28ADDLIB+=dnet_ntop.o dnet_pton.o
29
30#options for ipx
31ADDLIB+=ipx_ntop.o ipx_pton.o
32
33CC = gcc
34HOSTCC = gcc
35DEFINES += -D_GNU_SOURCE
36CCOPTS = -O2
37WFLAGS = -Wall -Wstrict-prototypes
38CFLAGS = $(WFLAGS) $(CCOPTS) -I../include $(DEFINES)
39YACCFLAGS = -d -t -v
40
41SUBDIRS=lib ip tc misc netem genl man
42
43LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
44LDLIBS += $(LIBNETLINK)
45
46all: Config
47	@set -e; \
48	for i in $(SUBDIRS); \
49	do $(MAKE) $(MFLAGS) -C $$i; done
50
51Config:
52	sh configure $(KERNEL_INCLUDE)
53
54install: all
55	install -m 0755 -d $(DESTDIR)$(SBINDIR)
56	install -m 0755 -d $(DESTDIR)$(CONFDIR)
57	install -m 0755 -d $(DESTDIR)$(ARPDDIR)
58	install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples
59	install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv
60	install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \
61		$(DESTDIR)$(DOCDIR)/examples
62	install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \
63		$(DESTDIR)$(DOCDIR)/examples/diffserv
64	@for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done
65	install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
66
67snapshot:
68	echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \
69		> include/SNAPSHOT.h
70
71clean:
72	@for i in $(SUBDIRS) doc; \
73	do $(MAKE) $(MFLAGS) -C $$i clean; done
74
75clobber:
76	touch Config
77	$(MAKE) $(MFLAGS) clean
78	rm -f Config cscope.*
79
80distclean: clobber
81
82cscope:
83	cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
84
85.EXPORT_ALL_VARIABLES:
86