Blame Makefile

Packit Service 3880ab
# SPDX-License-Identifier: GPL-2.0
Packit Service 3880ab
# Top level Makefile for iproute2
Packit Service 3880ab
Packit Service 3880ab
ifeq ("$(origin V)", "command line")
Packit Service 3880ab
VERBOSE = $(V)
Packit Service 3880ab
endif
Packit Service 3880ab
ifndef VERBOSE
Packit Service 3880ab
VERBOSE = 0
Packit Service 3880ab
endif
Packit Service 3880ab
Packit Service 3880ab
ifeq ($(VERBOSE),0)
Packit Service 3880ab
MAKEFLAGS += --no-print-directory
Packit Service 3880ab
endif
Packit Service 3880ab
Packit Service 3880ab
PREFIX?=/usr
Packit Service 3880ab
LIBDIR?=$(PREFIX)/lib
Packit Service 3880ab
SBINDIR?=/sbin
Packit Service 3880ab
CONFDIR?=/etc/iproute2
Packit Service 3880ab
NETNS_RUN_DIR?=/var/run/netns
Packit Service 3880ab
NETNS_ETC_DIR?=/etc/netns
Packit Service 3880ab
DATADIR?=$(PREFIX)/share
Packit Service 3880ab
HDRDIR?=$(PREFIX)/include/iproute2
Packit Service 3880ab
DOCDIR?=$(DATADIR)/doc/iproute2
Packit Service 3880ab
MANDIR?=$(DATADIR)/man
Packit Service 3880ab
ARPDDIR?=/var/lib/arpd
Packit Service 3880ab
KERNEL_INCLUDE?=/usr/include
Packit Service 3880ab
BASH_COMPDIR?=$(DATADIR)/bash-completion/completions
Packit Service 3880ab
Packit Service 3880ab
# Path to db_185.h include
Packit Service 3880ab
DBM_INCLUDE:=$(DESTDIR)/usr/include
Packit Service 3880ab
Packit Service 3880ab
SHARED_LIBS = y
Packit Service 3880ab
Packit Service 3880ab
DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
Packit Service 3880ab
ifneq ($(SHARED_LIBS),y)
Packit Service 3880ab
DEFINES+= -DNO_SHARED_LIBS
Packit Service 3880ab
endif
Packit Service 3880ab
Packit Service 3880ab
DEFINES+=-DCONFDIR=\"$(CONFDIR)\" \
Packit Service 3880ab
         -DNETNS_RUN_DIR=\"$(NETNS_RUN_DIR)\" \
Packit Service 3880ab
         -DNETNS_ETC_DIR=\"$(NETNS_ETC_DIR)\"
Packit Service 3880ab
Packit Service 3880ab
#options for mpls
Packit Service 3880ab
ADDLIB+=mpls_ntop.o mpls_pton.o
Packit Service 3880ab
Packit Service 3880ab
CC := gcc
Packit Service 3880ab
HOSTCC ?= $(CC)
Packit Service 3880ab
DEFINES += -D_GNU_SOURCE
Packit Service 3880ab
# Turn on transparent support for LFS
Packit Service 3880ab
DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
Packit Service 3880ab
CCOPTS = -O2 -pipe
Packit Service 3880ab
WFLAGS := -Wall -Wstrict-prototypes  -Wmissing-prototypes
Packit Service 3880ab
WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
Packit Service 3880ab
Packit Service 3880ab
CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
Packit Service 3880ab
YACCFLAGS = -d -t -v
Packit Service 3880ab
Packit Service 3880ab
SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man
Packit Service 3880ab
Packit Service 3880ab
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
Packit Service 3880ab
LDLIBS += $(LIBNETLINK)
Packit Service 3880ab
Packit Service 3880ab
all: config.mk
Packit Service 3880ab
	@set -e; \
Packit Service 3880ab
	for i in $(SUBDIRS); \
Packit Service 3880ab
	do echo; echo $$i; $(MAKE) -C $$i; done
Packit Service 3880ab
Packit Service 3880ab
.PHONY: clean clobber distclean check cscope version
Packit Service 3880ab
Packit Service 3880ab
help:
Packit Service 3880ab
	@echo "Make Targets:"
Packit Service 3880ab
	@echo " all                 - build binaries"
Packit Service 3880ab
	@echo " clean               - remove products of build"
Packit Service 3880ab
	@echo " distclean           - remove configuration and build"
Packit Service 3880ab
	@echo " install             - install binaries on local machine"
Packit Service 3880ab
	@echo " check               - run tests"
Packit Service 3880ab
	@echo " cscope              - build cscope database"
Packit Service 3880ab
	@echo " version             - update version"
Packit Service 3880ab
	@echo ""
Packit Service 3880ab
	@echo "Make Arguments:"
Packit Service 3880ab
	@echo " V=[0|1]             - set build verbosity level"
Packit Service 3880ab
Packit Service 3880ab
config.mk:
Packit Service 3880ab
	sh configure $(KERNEL_INCLUDE)
Packit Service 3880ab
Packit Service 3880ab
install: all
Packit Service 3880ab
	install -m 0755 -d $(DESTDIR)$(SBINDIR)
Packit Service 3880ab
	install -m 0755 -d $(DESTDIR)$(CONFDIR)
Packit Service 3880ab
	install -m 0755 -d $(DESTDIR)$(ARPDDIR)
Packit Service 3880ab
	install -m 0755 -d $(DESTDIR)$(HDRDIR)
Packit Service 3880ab
	@for i in $(SUBDIRS);  do $(MAKE) -C $$i install; done
Packit Service 3880ab
	install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
Packit Service 3880ab
	install -m 0755 -d $(DESTDIR)$(BASH_COMPDIR)
Packit Service 3880ab
	install -m 0644 bash-completion/tc $(DESTDIR)$(BASH_COMPDIR)
Packit Service 3880ab
	install -m 0644 bash-completion/devlink $(DESTDIR)$(BASH_COMPDIR)
Packit Service 3880ab
	install -m 0644 include/bpf_elf.h $(DESTDIR)$(HDRDIR)
Packit Service 3880ab
Packit Service 3880ab
version:
Packit Service 3880ab
	echo "static const char version[] = \""`git describe --tags --long`"\";" \
Packit Service 3880ab
		> include/version.h
Packit Service 3880ab
Packit Service 3880ab
clean:
Packit Service 3880ab
	@for i in $(SUBDIRS) testsuite; \
Packit Service 3880ab
	do $(MAKE) -C $$i clean; done
Packit Service 3880ab
Packit Service 3880ab
clobber:
Packit Service 3880ab
	touch config.mk
Packit Service 3880ab
	$(MAKE) clean
Packit Service 3880ab
	rm -f config.mk cscope.*
Packit Service 3880ab
Packit Service 3880ab
distclean: clobber
Packit Service 3880ab
Packit Service 3880ab
check: all
Packit Service 3880ab
	$(MAKE) -C testsuite
Packit Service 3880ab
	$(MAKE) -C testsuite alltests
Packit Service 3880ab
	@if command -v man >/dev/null 2>&1; then \
Packit Service 3880ab
		echo "Checking manpages for syntax errors..."; \
Packit Service 3880ab
		$(MAKE) -C man check; \
Packit Service 3880ab
	else \
Packit Service 3880ab
		echo "man not installed, skipping checks for syntax errors."; \
Packit Service 3880ab
	fi
Packit Service 3880ab
Packit Service 3880ab
cscope:
Packit Service 3880ab
	cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
Packit Service 3880ab
Packit Service 3880ab
.EXPORT_ALL_VARIABLES: