]>
Commit | Line | Data |
---|---|---|
6054c1eb | 1 | # SPDX-License-Identifier: GPL-2.0 |
69fed534 | 2 | # Top level Makefile for iproute2 |
e4225669 | 3 | |
ac656141 DA |
4 | ifeq ("$(origin V)", "command line") |
5 | VERBOSE = $(V) | |
6 | endif | |
7 | ifndef VERBOSE | |
8 | VERBOSE = 0 | |
9 | endif | |
10 | ||
eebc7cc1 | 11 | ifeq ($(VERBOSE),0) |
57bdf8b7 DA |
12 | MAKEFLAGS += --no-print-directory |
13 | endif | |
14 | ||
06ec9039 PŠ |
15 | PREFIX?=/usr |
16 | LIBDIR?=$(PREFIX)/lib | |
17 | SBINDIR?=/sbin | |
18 | CONFDIR?=/etc/iproute2 | |
e2f5cecc PM |
19 | NETNS_RUN_DIR?=/var/run/netns |
20 | NETNS_ETC_DIR?=/etc/netns | |
06ec9039 | 21 | DATADIR?=$(PREFIX)/share |
e4225669 | 22 | HDRDIR?=$(PREFIX)/include/iproute2 |
06ec9039 PŠ |
23 | DOCDIR?=$(DATADIR)/doc/iproute2 |
24 | MANDIR?=$(DATADIR)/man | |
25 | ARPDDIR?=/var/lib/arpd | |
26 | KERNEL_INCLUDE?=/usr/include | |
27d44f3a | 27 | BASH_COMPDIR?=$(DATADIR)/bash-completion/completions |
aba5acdf | 28 | |
d1e48c7e | 29 | # Path to db_185.h include |
06ec9039 | 30 | DBM_INCLUDE:=$(DESTDIR)/usr/include |
d1e48c7e | 31 | |
f2e27cfb MF |
32 | SHARED_LIBS = y |
33 | ||
5e3bb534 | 34 | DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\" |
f2e27cfb MF |
35 | ifneq ($(SHARED_LIBS),y) |
36 | DEFINES+= -DNO_SHARED_LIBS | |
37 | endif | |
aba5acdf | 38 | |
e2f5cecc PM |
39 | DEFINES+=-DCONFDIR=\"$(CONFDIR)\" \ |
40 | -DNETNS_RUN_DIR=\"$(NETNS_RUN_DIR)\" \ | |
41 | -DNETNS_ETC_DIR=\"$(NETNS_ETC_DIR)\" | |
5c434a9e | 42 | |
aba5acdf SH |
43 | #options for decnet |
44 | ADDLIB+=dnet_ntop.o dnet_pton.o | |
45 | ||
46 | #options for ipx | |
47 | ADDLIB+=ipx_ntop.o ipx_pton.o | |
48 | ||
dacc5d41 EB |
49 | #options for mpls |
50 | ADDLIB+=mpls_ntop.o mpls_pton.o | |
51 | ||
7ffa2b55 PS |
52 | CC := gcc |
53 | HOSTCC ?= $(CC) | |
c8610020 | 54 | DEFINES += -D_GNU_SOURCE |
232aaf4f MF |
55 | # Turn on transparent support for LFS |
56 | DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE | |
c8610020 | 57 | CCOPTS = -O2 |
3140e9a3 | 58 | WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes |
4ec0ffde | 59 | WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2 |
6398d3a6 | 60 | |
596b1c94 | 61 | CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS) |
9ddbb02e | 62 | YACCFLAGS = -d -t -v |
aba5acdf | 63 | |
74bd75c2 | 64 | SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man |
aba5acdf | 65 | |
0cec58da | 66 | LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a |
2230ac1d | 67 | LDLIBS += $(LIBNETLINK) |
aba5acdf | 68 | |
5f1df307 | 69 | all: config.mk |
95dd5950 MF |
70 | @set -e; \ |
71 | for i in $(SUBDIRS); \ | |
57bdf8b7 | 72 | do echo; echo $$i; $(MAKE) $(MFLAGS) -C $$i; done |
adff36d7 | 73 | |
11152f0a SH |
74 | help: |
75 | @echo "Make Targets:" | |
76 | @echo " all - build binaries" | |
77 | @echo " clean - remove products of build" | |
78 | @echo " distclean - remove configuration and build" | |
79 | @echo " install - install binaries on local machine" | |
8804a8c0 | 80 | @echo " check - run tests" |
11152f0a SH |
81 | @echo " cscope - build cscope database" |
82 | @echo " snapshot - generate version number header" | |
83 | @echo "" | |
84 | @echo "Make Arguments:" | |
85 | @echo " V=[0|1] - set build verbosity level" | |
86 | ||
5f1df307 | 87 | config.mk: |
f35e9289 | 88 | sh configure $(KERNEL_INCLUDE) |
aba5acdf | 89 | |
aba5acdf SH |
90 | install: all |
91 | install -m 0755 -d $(DESTDIR)$(SBINDIR) | |
e9a05e96 | 92 | install -m 0755 -d $(DESTDIR)$(CONFDIR) |
e48f73d6 | 93 | install -m 0755 -d $(DESTDIR)$(ARPDDIR) |
e4225669 | 94 | install -m 0755 -d $(DESTDIR)$(HDRDIR) |
aba5acdf SH |
95 | install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples |
96 | install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv | |
c72238e4 | 97 | install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \ |
e9a05e96 | 98 | $(DESTDIR)$(DOCDIR)/examples |
c72238e4 | 99 | install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \ |
e9a05e96 | 100 | $(DESTDIR)$(DOCDIR)/examples/diffserv |
b2fd7a0e | 101 | @for i in $(SUBDIRS); do $(MAKE) -C $$i install; done |
c72238e4 | 102 | install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR) |
27d44f3a QM |
103 | install -m 0755 -d $(DESTDIR)$(BASH_COMPDIR) |
104 | install -m 0644 bash-completion/tc $(DESTDIR)$(BASH_COMPDIR) | |
e4225669 | 105 | install -m 0644 include/bpf_elf.h $(DESTDIR)$(HDRDIR) |
aba5acdf | 106 | |
235ac6a4 SH |
107 | snapshot: |
108 | echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \ | |
109 | > include/SNAPSHOT.h | |
110 | ||
aba5acdf | 111 | clean: |
ad23e152 | 112 | @for i in $(SUBDIRS) testsuite; \ |
adff36d7 SH |
113 | do $(MAKE) $(MFLAGS) -C $$i clean; done |
114 | ||
82408fc1 | 115 | clobber: |
5f1df307 | 116 | touch config.mk |
82408fc1 | 117 | $(MAKE) $(MFLAGS) clean |
5f1df307 | 118 | rm -f config.mk cscope.* |
adff36d7 | 119 | |
87773db5 | 120 | distclean: clobber |
aba5acdf | 121 | |
0115d55e | 122 | check: all |
8804a8c0 PV |
123 | cd testsuite && $(MAKE) && $(MAKE) alltests |
124 | ||
f6aa8e00 SH |
125 | cscope: |
126 | cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc | |
127 | ||
aba5acdf | 128 | .EXPORT_ALL_VARIABLES: |