config: put CFLAGS/LDLIBS in config.mk
Subsystems (4)
PATCH 1/1 config: put CFLAGS/LDLIBS in config.mk
This renames Config to config.mk and includes more Make input. Now configure generates all the required CFLAGS and LDLIBS for the optional libraries.
Also, use pkg-config to test for libelf, rather than using a test program. This makes it consistent with other libraries.
Signed-off-by Stephen Hemminger <[email protected]>
--- .gitignore | 1 - Makefile | 8 +++--- README | 5 ++-- bridge/Makefile | 11 +------- configure | 81 ++++++++++++++++++++++++++++---------------------------- devlink/Makefile | 3 ++- genl/Makefile | 7 +---- ip/Makefile | 15 +---------- lib/Makefile | 14 +--------- misc/Makefile | 16 +---------- netem/Makefile | 7 +---- tc/Makefile | 15 +---------- tipc/Makefile | 5 ++-- 13 files changed, 59 insertions(+), 129 deletions(-)
.gitignore +0 -1
@@ -1,6 +1,5 @@ static-syms.h config.* -Config *.o *.a *.so
Makefile +4 -4
@@ -54,12 +54,12 @@ SUBDIRS=lib ip tc bridge misc netem genl tipc devlink man LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a LDLIBS += $(LIBNETLINK) -all: Config +all: config.mk @set -e; \ for i in $(SUBDIRS); \ do echo; echo $$i; $(MAKE) $(MFLAGS) -C $$i; done -Config: +config.mk: sh configure $(KERNEL_INCLUDE) install: all
@@ -88,9 +88,9 @@ clean: 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
README +3 -2
@@ -21,8 +21,9 @@ database routines. Often this is in the db-devel package. 2. make -The makefile will automatically build a Config file which -contains whether or not ATM is available, etc. +The makefile will automatically build a config.mk file which +contains definitions of libraries that may or may not be available +on the system such as: ATM, ELF, MNL, and SELINUX. 3. To make documentation, cd to doc/ directory , then look at start of Makefile and set correct values for
bridge/Makefile +1 -10
@@ -1,15 +1,6 @@ BROBJ = bridge.o fdb.o monitor.o link.o mdb.o vlan.o -include ../Config - -ifeq ($(IP_CONFIG_SETNS),y) - CFLAGS += -DHAVE_SETNS -endif - -ifeq ($(HAVE_MNL),y) - CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags) - LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs) -endif +include ../config.mk all: bridge
configure +41 -40
224 lines not on this page · raw message
devlink/Makefile +2 -1
@@ -1,4 +1,5 @@ -include ../Config +include ../config.mk + ifeq ($(HAVE_MNL),y) DEVLINKOBJ = devlink.o mnlg.o
genl/Makefile +1 -6
@@ -1,6 +1,6 @@ GENLOBJ=genl.o -include ../Config +include ../config.mk SHARED_LIBS ?= y CFLAGS += -fno-strict-aliasing
@@ -17,11 +17,6 @@ LDFLAGS += -Wl,-export-dynamic LDLIBS += -lm -ldl endif -ifeq ($(HAVE_MNL),y) - CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags) - LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs) -endif - all: genl genl: $(GENLOBJ) $(LIBNETLINK) $(LIBUTIL) $(GENLLIB)
ip/Makefile +1 -14
@@ -13,20 +13,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \ RTMONOBJ=rtmon.o -include ../Config - -ifeq ($(IP_CONFIG_SETNS),y) - CFLAGS += -DHAVE_SETNS -endif - -ifeq ($(HAVE_ELF),y) - CFLAGS += -DHAVE_ELF - LDLIBS += -lelf -endif -ifeq ($(HAVE_MNL),y) - CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags) - LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs) -endif +include ../config.mk ALLOBJ=$(IPOBJ) $(RTMONOBJ) SCRIPTS=ifcfg rtpr routel routef
lib/Makefile +1 -13
@@ -1,16 +1,4 @@ -include ../Config - -ifeq ($(IP_CONFIG_SETNS),y) - CFLAGS += -DHAVE_SETNS -endif - -ifeq ($(HAVE_ELF),y) - CFLAGS += -DHAVE_ELF -endif - -ifeq ($(HAVE_MNL),y) - CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags) -endif +include ../config.mk CFLAGS += -fPIC
misc/Makefile +1 -15
@@ -3,26 +3,12 @@ LNSTATOBJ=lnstat.o lnstat_util.o TARGETS=ss nstat ifstat rtacct lnstat -include ../Config +include ../config.mk ifeq ($(HAVE_BERKELEY_DB),y) TARGETS += arpd endif -ifeq ($(HAVE_SELINUX),y) - LDLIBS += $(shell $(PKG_CONFIG) --libs libselinux) - CFLAGS += $(shell $(PKG_CONFIG) --cflags libselinux) -DHAVE_SELINUX -endif - -ifeq ($(IP_CONFIG_SETNS),y) - CFLAGS += -DHAVE_SETNS -endif - -ifeq ($(HAVE_MNL),y) - CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags) - LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs) -endif - all: $(TARGETS) ss: $(SSOBJ)
netem/Makefile +1 -6
@@ -1,4 +1,4 @@ -include ../Config +include ../config.mk DISTGEN = maketable normal pareto paretonormal DISTDATA = normal.dist pareto.dist paretonormal.dist experimental.dist
@@ -7,11 +7,6 @@ HOSTCC ?= $(CC) CCOPTS = $(CBUILD_CFLAGS) LDLIBS += -lm -ifeq ($(HAVE_MNL),y) - CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags) - LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs) -endif - all: $(DISTGEN) $(DISTDATA) $(DISTGEN):
tc/Makefile +1 -14
@@ -2,11 +2,7 @@ TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o tc_monitor.o \ tc_exec.o m_police.o m_estimator.o m_action.o m_ematch.o \ emp_ematch.yacc.o emp_ematch.lex.o -include ../Config - -ifeq ($(IP_CONFIG_SETNS),y) - CFLAGS += -DHAVE_SETNS -endif +include ../config.mk SHARED_LIBS ?= y
@@ -102,15 +98,6 @@ endif TCOBJ += $(TCMODULES) LDLIBS += -L. -lm -ifeq ($(HAVE_ELF),y) - CFLAGS += -DHAVE_ELF - LDLIBS += -lelf -endif -ifeq ($(HAVE_MNL),y) - CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags) - LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs) -endif - ifeq ($(SHARED_LIBS),y) LDLIBS += -ldl LDFLAGS += -Wl,-export-dynamic
tipc/Makefile +2 -3
@@ -1,4 +1,5 @@ -include ../Config +include ../config.mk + ifeq ($(HAVE_MNL),y) TIPCOBJ=bearer.o \
@@ -8,8 +9,6 @@ TIPCOBJ=bearer.o \ node.o socket.o \ peer.o tipc.o -include ../Config - TARGETS=tipc CFLAGS += $(shell $(PKG_CONFIG) libmnl --cflags) LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs)
Signature · 1 line
2.11.0