]> git.proxmox.com Git - mirror_iproute2.git/blob - Makefile
testsuite: let make compile build the netlink helper
[mirror_iproute2.git] / Makefile
1 # SPDX-License-Identifier: GPL-2.0
2 # Top level Makefile for iproute2
3
4 ifeq ("$(origin V)", "command line")
5 VERBOSE = $(V)
6 endif
7 ifndef VERBOSE
8 VERBOSE = 0
9 endif
10
11 ifeq ($(VERBOSE),0)
12 MAKEFLAGS += --no-print-directory
13 endif
14
15 PREFIX?=/usr
16 LIBDIR?=$(PREFIX)/lib
17 SBINDIR?=/sbin
18 CONFDIR?=/etc/iproute2
19 NETNS_RUN_DIR?=/var/run/netns
20 NETNS_ETC_DIR?=/etc/netns
21 DATADIR?=$(PREFIX)/share
22 HDRDIR?=$(PREFIX)/include/iproute2
23 DOCDIR?=$(DATADIR)/doc/iproute2
24 MANDIR?=$(DATADIR)/man
25 ARPDDIR?=/var/lib/arpd
26 KERNEL_INCLUDE?=/usr/include
27 BASH_COMPDIR?=$(DATADIR)/bash-completion/completions
28
29 # Path to db_185.h include
30 DBM_INCLUDE:=$(DESTDIR)/usr/include
31
32 SHARED_LIBS = y
33
34 DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
35 ifneq ($(SHARED_LIBS),y)
36 DEFINES+= -DNO_SHARED_LIBS
37 endif
38
39 DEFINES+=-DCONFDIR=\"$(CONFDIR)\" \
40 -DNETNS_RUN_DIR=\"$(NETNS_RUN_DIR)\" \
41 -DNETNS_ETC_DIR=\"$(NETNS_ETC_DIR)\"
42
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
49 #options for mpls
50 ADDLIB+=mpls_ntop.o mpls_pton.o
51
52 CC := gcc
53 HOSTCC ?= $(CC)
54 DEFINES += -D_GNU_SOURCE
55 # Turn on transparent support for LFS
56 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
57 CCOPTS = -O2
58 WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes
59 WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
60
61 CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
62 YACCFLAGS = -d -t -v
63
64 SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man
65
66 LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
67 LDLIBS += $(LIBNETLINK)
68
69 all: config.mk
70 @set -e; \
71 for i in $(SUBDIRS); \
72 do echo; echo $$i; $(MAKE) $(MFLAGS) -C $$i; done
73
74 config.mk:
75 sh configure $(KERNEL_INCLUDE)
76
77 install: all
78 install -m 0755 -d $(DESTDIR)$(SBINDIR)
79 install -m 0755 -d $(DESTDIR)$(CONFDIR)
80 install -m 0755 -d $(DESTDIR)$(ARPDDIR)
81 install -m 0755 -d $(DESTDIR)$(HDRDIR)
82 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples
83 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv
84 install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \
85 $(DESTDIR)$(DOCDIR)/examples
86 install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \
87 $(DESTDIR)$(DOCDIR)/examples/diffserv
88 @for i in $(SUBDIRS); do $(MAKE) -C $$i install; done
89 install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
90 install -m 0755 -d $(DESTDIR)$(BASH_COMPDIR)
91 install -m 0644 bash-completion/tc $(DESTDIR)$(BASH_COMPDIR)
92 install -m 0644 include/bpf_elf.h $(DESTDIR)$(HDRDIR)
93
94 snapshot:
95 echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \
96 > include/SNAPSHOT.h
97
98 clean:
99 @for i in $(SUBDIRS) testsuite; \
100 do $(MAKE) $(MFLAGS) -C $$i clean; done
101
102 clobber:
103 touch config.mk
104 $(MAKE) $(MFLAGS) clean
105 rm -f config.mk cscope.*
106
107 distclean: clobber
108
109 cscope:
110 cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
111
112 .EXPORT_ALL_VARIABLES: