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