2017-11-25 04:21:35 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2017-08-09 23:45:04 +08:00
|
|
|
# Top level Makefile for iproute2
|
2016-11-10 08:20:59 +08:00
|
|
|
|
2021-10-14 16:50:55 +08:00
|
|
|
-include config.mk
|
|
|
|
|
2018-01-06 11:42:05 +08:00
|
|
|
ifeq ("$(origin V)", "command line")
|
|
|
|
VERBOSE = $(V)
|
|
|
|
endif
|
|
|
|
ifndef VERBOSE
|
|
|
|
VERBOSE = 0
|
|
|
|
endif
|
|
|
|
|
2016-12-08 04:55:09 +08:00
|
|
|
ifeq ($(VERBOSE),0)
|
2016-05-25 06:04:49 +08:00
|
|
|
MAKEFLAGS += --no-print-directory
|
|
|
|
endif
|
|
|
|
|
2015-04-13 22:00:56 +08:00
|
|
|
PREFIX?=/usr
|
|
|
|
SBINDIR?=/sbin
|
2018-05-19 06:44:00 +08:00
|
|
|
NETNS_RUN_DIR?=/var/run/netns
|
|
|
|
NETNS_ETC_DIR?=/etc/netns
|
2015-04-13 22:00:56 +08:00
|
|
|
DATADIR?=$(PREFIX)/share
|
2016-11-10 08:20:59 +08:00
|
|
|
HDRDIR?=$(PREFIX)/include/iproute2
|
2023-11-16 01:25:35 +08:00
|
|
|
CONF_ETC_DIR?=/etc/iproute2
|
|
|
|
CONF_USR_DIR?=$(DATADIR)/iproute2
|
2015-04-13 22:00:56 +08:00
|
|
|
DOCDIR?=$(DATADIR)/doc/iproute2
|
|
|
|
MANDIR?=$(DATADIR)/man
|
|
|
|
ARPDDIR?=/var/lib/arpd
|
|
|
|
KERNEL_INCLUDE?=/usr/include
|
2016-05-03 15:39:08 +08:00
|
|
|
BASH_COMPDIR?=$(DATADIR)/bash-completion/completions
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2004-06-26 05:20:20 +08:00
|
|
|
# Path to db_185.h include
|
2015-04-13 22:00:56 +08:00
|
|
|
DBM_INCLUDE:=$(DESTDIR)/usr/include
|
2004-06-26 05:20:20 +08:00
|
|
|
|
2009-11-06 19:09:22 +08:00
|
|
|
SHARED_LIBS = y
|
|
|
|
|
2008-08-22 22:54:12 +08:00
|
|
|
DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
|
2009-11-06 19:09:22 +08:00
|
|
|
ifneq ($(SHARED_LIBS),y)
|
|
|
|
DEFINES+= -DNO_SHARED_LIBS
|
|
|
|
endif
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2023-07-26 14:14:09 +08:00
|
|
|
DEFINES+=-DCONF_USR_DIR=\"$(CONF_USR_DIR)\" \
|
|
|
|
-DCONF_ETC_DIR=\"$(CONF_ETC_DIR)\" \
|
2018-05-19 06:44:00 +08:00
|
|
|
-DNETNS_RUN_DIR=\"$(NETNS_RUN_DIR)\" \
|
2023-09-14 01:58:25 +08:00
|
|
|
-DNETNS_ETC_DIR=\"$(NETNS_ETC_DIR)\" \
|
2024-03-18 23:49:13 +08:00
|
|
|
-DARPDDIR=\"$(ARPDDIR)\" \
|
2023-09-14 01:58:25 +08:00
|
|
|
-DCONF_COLOR=$(CONF_COLOR)
|
2012-03-02 00:46:26 +08:00
|
|
|
|
2021-09-19 21:30:26 +08:00
|
|
|
#options for AX.25
|
|
|
|
ADDLIB+=ax25_ntop.o
|
|
|
|
|
2021-09-19 21:30:26 +08:00
|
|
|
#options for AX.25
|
|
|
|
ADDLIB+=rose_ntop.o
|
|
|
|
|
2015-03-16 03:53:45 +08:00
|
|
|
#options for mpls
|
|
|
|
ADDLIB+=mpls_ntop.o mpls_pton.o
|
|
|
|
|
2021-09-19 21:30:26 +08:00
|
|
|
#options for NETROM
|
|
|
|
ADDLIB+=netrom_ntop.o
|
|
|
|
|
2016-07-18 22:48:45 +08:00
|
|
|
CC := gcc
|
|
|
|
HOSTCC ?= $(CC)
|
2012-03-01 14:45:17 +08:00
|
|
|
DEFINES += -D_GNU_SOURCE
|
2015-05-26 14:51:30 +08:00
|
|
|
# Turn on transparent support for LFS
|
|
|
|
DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
|
2019-06-12 23:48:33 +08:00
|
|
|
CCOPTS = -O2 -pipe
|
2013-08-01 08:42:39 +08:00
|
|
|
WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes
|
2014-05-30 01:31:30 +08:00
|
|
|
WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
|
2013-02-13 03:39:32 +08:00
|
|
|
|
2017-10-03 01:03:37 +08:00
|
|
|
CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
|
2005-06-24 01:21:46 +08:00
|
|
|
YACCFLAGS = -d -t -v
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2022-03-10 01:03:26 +08:00
|
|
|
SUBDIRS=lib ip tc bridge misc netem genl man
|
|
|
|
ifeq ($(HAVE_MNL),y)
|
|
|
|
SUBDIRS += tipc devlink rdma dcb vdpa
|
|
|
|
endif
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2018-02-16 05:23:21 +08:00
|
|
|
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
|
2011-03-10 02:18:03 +08:00
|
|
|
LDLIBS += $(LIBNETLINK)
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2021-10-14 16:50:55 +08:00
|
|
|
all: config.mk
|
2007-03-06 09:50:49 +08:00
|
|
|
@set -e; \
|
|
|
|
for i in $(SUBDIRS); \
|
2020-09-29 03:08:01 +08:00
|
|
|
do echo; echo $$i; $(MAKE) -C $$i; done
|
2004-06-26 05:14:22 +08:00
|
|
|
|
2020-08-02 01:26:41 +08:00
|
|
|
.PHONY: clean clobber distclean check cscope version
|
|
|
|
|
2018-09-22 00:15:26 +08:00
|
|
|
help:
|
|
|
|
@echo "Make Targets:"
|
|
|
|
@echo " all - build binaries"
|
|
|
|
@echo " clean - remove products of build"
|
|
|
|
@echo " distclean - remove configuration and build"
|
|
|
|
@echo " install - install binaries on local machine"
|
2018-09-22 04:29:16 +08:00
|
|
|
@echo " check - run tests"
|
2018-09-22 00:15:26 +08:00
|
|
|
@echo " cscope - build cscope database"
|
2020-08-02 01:26:41 +08:00
|
|
|
@echo " version - update version"
|
2018-09-22 00:15:26 +08:00
|
|
|
@echo ""
|
|
|
|
@echo "Make Arguments:"
|
|
|
|
@echo " V=[0|1] - set build verbosity level"
|
|
|
|
|
2021-10-14 16:50:55 +08:00
|
|
|
config.mk:
|
2021-05-10 06:50:18 +08:00
|
|
|
@if [ ! -f config.mk -o configure -nt config.mk ]; then \
|
|
|
|
sh configure $(KERNEL_INCLUDE); \
|
|
|
|
fi
|
2004-04-16 04:56:59 +08:00
|
|
|
|
|
|
|
install: all
|
|
|
|
install -m 0755 -d $(DESTDIR)$(SBINDIR)
|
2023-07-26 14:14:09 +08:00
|
|
|
install -m 0755 -d $(DESTDIR)$(CONF_USR_DIR)
|
2016-11-10 08:20:59 +08:00
|
|
|
install -m 0755 -d $(DESTDIR)$(HDRDIR)
|
2017-09-30 01:50:13 +08:00
|
|
|
@for i in $(SUBDIRS); do $(MAKE) -C $$i install; done
|
2023-07-26 14:14:09 +08:00
|
|
|
install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONF_USR_DIR)
|
2016-05-03 15:39:08 +08:00
|
|
|
install -m 0755 -d $(DESTDIR)$(BASH_COMPDIR)
|
|
|
|
install -m 0644 bash-completion/tc $(DESTDIR)$(BASH_COMPDIR)
|
2020-03-25 17:25:34 +08:00
|
|
|
install -m 0644 bash-completion/devlink $(DESTDIR)$(BASH_COMPDIR)
|
2016-11-10 08:20:59 +08:00
|
|
|
install -m 0644 include/bpf_elf.h $(DESTDIR)$(HDRDIR)
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2020-08-02 01:26:41 +08:00
|
|
|
version:
|
|
|
|
echo "static const char version[] = \""`git describe --tags --long`"\";" \
|
|
|
|
> include/version.h
|
2007-12-22 01:53:45 +08:00
|
|
|
|
2004-04-16 04:56:59 +08:00
|
|
|
clean:
|
2018-08-23 02:09:01 +08:00
|
|
|
@for i in $(SUBDIRS) testsuite; \
|
2020-09-29 03:08:01 +08:00
|
|
|
do $(MAKE) -C $$i clean; done
|
2004-06-26 05:14:22 +08:00
|
|
|
|
2010-11-19 07:25:38 +08:00
|
|
|
clobber:
|
2017-08-11 08:05:03 +08:00
|
|
|
touch config.mk
|
2020-09-29 03:08:01 +08:00
|
|
|
$(MAKE) clean
|
2017-08-11 08:05:03 +08:00
|
|
|
rm -f config.mk cscope.*
|
2004-06-26 05:14:22 +08:00
|
|
|
|
2005-06-24 01:23:53 +08:00
|
|
|
distclean: clobber
|
2004-04-16 04:56:59 +08:00
|
|
|
|
2018-12-17 04:55:37 +08:00
|
|
|
check: all
|
2019-06-14 01:47:02 +08:00
|
|
|
$(MAKE) -C testsuite
|
|
|
|
$(MAKE) -C testsuite alltests
|
2019-01-12 20:28:56 +08:00
|
|
|
@if command -v man >/dev/null 2>&1; then \
|
|
|
|
echo "Checking manpages for syntax errors..."; \
|
|
|
|
$(MAKE) -C man check; \
|
|
|
|
else \
|
|
|
|
echo "man not installed, skipping checks for syntax errors."; \
|
|
|
|
fi
|
2018-09-22 04:29:16 +08:00
|
|
|
|
2005-06-24 01:31:49 +08:00
|
|
|
cscope:
|
|
|
|
cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
|
|
|
|
|
2004-04-16 04:56:59 +08:00
|
|
|
.EXPORT_ALL_VARIABLES:
|