blob: 0ffd047bb06256ce78d5c460d0fe57c1ba9027c5 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001ROOTDIR=$(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
38ifeq ($(CONFIG_MIN_8M_VERSION), n)
39CFLAGS = $(WFLAGS) $(CCOPTS) -I../include $(DEFINES)
40else
41CFLAGS += $(WFLAGS) -I../include $(DEFINES)
42endif
43YACCFLAGS = -d -t -v
44
45SUBDIRS=lib ip tc misc netem genl man
46
47LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
48LDLIBS += $(LIBNETLINK)
49
50all: Config
51 @set -e; \
52 for i in $(SUBDIRS); \
53 do $(MAKE) $(MFLAGS) -C $$i; done
54
55Config:
56 sh configure $(KERNEL_INCLUDE)
57ifeq ($(IP_CONFIG_SETNS),y)
58 sed -i '/IP_CONFIG_SETNS/d' Config
59 echo "IP_CONFIG_SETNS:=y" >>Config
60endif
61
62install: all
63 install -m 0755 -d $(DESTDIR)$(SBINDIR)
64 install -m 0755 -d $(DESTDIR)$(CONFDIR)
65 install -m 0755 -d $(DESTDIR)$(ARPDDIR)
66 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples
67 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv
68 install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \
69 $(DESTDIR)$(DOCDIR)/examples
70 install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \
71 $(DESTDIR)$(DOCDIR)/examples/diffserv
72 @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done
73 install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
74
75snapshot:
76 echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \
77 > include/SNAPSHOT.h
78
79clean:
80 @for i in $(SUBDIRS) doc; \
81 do $(MAKE) $(MFLAGS) -C $$i clean; done
82 rm -fv Config
83
84clobber:
85 touch Config
86 $(MAKE) $(MFLAGS) clean
87 rm -f Config cscope.*
88
89distclean: clobber
90
91cscope:
92 cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
93
94.EXPORT_ALL_VARIABLES: