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