X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Makefile;h=48f469b0d0a85626b9ac2f36d61fece865c57737;hb=ef1e02e6ac6b024d7b9d4657a0aaa1e6f1ba3ed7;hp=37b68ad87f0689861c7705353ee07ac8267f6716;hpb=f2df31170f9169d2f8119906b966c7f232990cc1;p=mirror_iproute2.git diff --git a/Makefile b/Makefile index 37b68ad8..48f469b0 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,14 @@ -# Include "Config" if already generated -ifneq ($(wildcard Config),) -include Config -endif +# SPDX-License-Identifier: GPL-2.0 +# Top level Makefile for iproute2 +ifeq ("$(origin V)", "command line") +VERBOSE = $(V) +endif ifndef VERBOSE +VERBOSE = 0 +endif + +ifeq ($(VERBOSE),0) MAKEFLAGS += --no-print-directory endif @@ -11,6 +16,8 @@ PREFIX?=/usr LIBDIR?=$(PREFIX)/lib SBINDIR?=/sbin CONFDIR?=/etc/iproute2 +NETNS_RUN_DIR?=/var/run/netns +NETNS_ETC_DIR?=/etc/netns DATADIR?=$(PREFIX)/share HDRDIR?=$(PREFIX)/include/iproute2 DOCDIR?=$(DATADIR)/doc/iproute2 @@ -29,13 +36,9 @@ ifneq ($(SHARED_LIBS),y) DEFINES+= -DNO_SHARED_LIBS endif -DEFINES+=-DCONFDIR=\"$(CONFDIR)\" - -#options for decnet -ADDLIB+=dnet_ntop.o dnet_pton.o - -#options for ipx -ADDLIB+=ipx_ntop.o ipx_pton.o +DEFINES+=-DCONFDIR=\"$(CONFDIR)\" \ + -DNETNS_RUN_DIR=\"$(NETNS_RUN_DIR)\" \ + -DNETNS_ETC_DIR=\"$(NETNS_ETC_DIR)\" #options for mpls ADDLIB+=mpls_ntop.o mpls_pton.o @@ -49,25 +52,33 @@ CCOPTS = -O2 WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2 -CFLAGS := $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) $(CFLAGS) +CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS) YACCFLAGS = -d -t -v -SUBDIRS=lib ip tc bridge misc netem genl tipc devlink man +SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man -LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a +LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a LDLIBS += $(LIBNETLINK) -ifeq ($(HAVE_ELF),y) -CFLAGS += -DHAVE_ELF -LDLIBS += -lelf -endif - -all: Config +all: config.mk @set -e; \ for i in $(SUBDIRS); \ do echo; echo $$i; $(MAKE) $(MFLAGS) -C $$i; done -Config: +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" + @echo " check - run tests" + @echo " cscope - build cscope database" + @echo " snapshot - generate version number header" + @echo "" + @echo "Make Arguments:" + @echo " V=[0|1] - set build verbosity level" + +config.mk: sh configure $(KERNEL_INCLUDE) install: all @@ -81,7 +92,7 @@ install: all $(DESTDIR)$(DOCDIR)/examples install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \ $(DESTDIR)$(DOCDIR)/examples/diffserv - @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done + @for i in $(SUBDIRS); do $(MAKE) -C $$i install; done install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR) install -m 0755 -d $(DESTDIR)$(BASH_COMPDIR) install -m 0644 bash-completion/tc $(DESTDIR)$(BASH_COMPDIR) @@ -92,16 +103,25 @@ snapshot: > include/SNAPSHOT.h clean: - @for i in $(SUBDIRS) doc; \ + @for i in $(SUBDIRS) testsuite; \ do $(MAKE) $(MFLAGS) -C $$i clean; done clobber: - touch Config + touch config.mk $(MAKE) $(MFLAGS) clean - rm -f Config cscope.* + rm -f config.mk cscope.* distclean: clobber +check: all + cd testsuite && $(MAKE) && $(MAKE) alltests + @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 + cscope: cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc