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