From 96b4d0cea5045770e2343908c40cbfc6ebb4ac1e Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Thu, 11 Jul 2013 15:11:56 +0200 Subject: build: refactor tool specific flags into /Makefile To get the normal Makefile a bit cleaner, push the tool specific build options into /Makefile. Signed-off-by: Daniel Borkmann --- Makefile | 13 ++++--------- astraceroute/Makefile | 2 ++ bpfc/Makefile | 2 ++ curvetun/Makefile | 2 ++ flowtop/Makefile | 2 ++ ifpps/Makefile | 2 ++ mausezahn/Makefile | 5 +++++ netsniff-ng/Makefile | 4 ++++ trafgen/Makefile | 5 +++++ 9 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 18978a0..b19b555 100644 --- a/Makefile +++ b/Makefile @@ -190,8 +190,8 @@ clean_showinfo: -o $(BUILD_DIR)/$(shell basename $< .y).tab.c $(YAAC_FLAGS) -d $< .PHONY: all toolkit $(TOOLS) clean %_prehook %_clean %_install %_uninstall tag tags cscope -.FORCE: .DEFAULT_GOAL := all +.FORCE: .DEFAULT: .IGNORE: %_clean_custom %_install_custom .NOTPARALLEL: $(TOOLS) @@ -225,6 +225,7 @@ uninstall: $(foreach tool,$(TOOLS),$(tool)_uninstall) define TOOL_templ include $(1)/Makefile $(1) $(1)%: BUILD_DIR := $(1) + $(1) $(1)%: ALL_CFLAGS += $$($(1)-eflags) $(1)_prehook: $(Q)echo "$(bold)$(WHAT) $(1):$(normal)" $(1): $(1)_prehook $$($(1)-lex) $$($(1)-yaac) $$(patsubst %.o,$(1)/%.o,$$($(1)-objs)) @@ -249,15 +250,9 @@ $(foreach tool,$(TOOLS),$(eval $(call TOOL_templ,$(tool)))) %:: ; -netsniff-ng: ALL_CFLAGS += $(shell pkg-config --cflags libnl-3.0) $(shell pkg-config --cflags libnl-genl-3.0) -D__WITH_PROTOS -trafgen: ALL_CFLAGS += -I.. $(shell pkg-config --cflags libnl-3.0) $(shell pkg-config --cflags libnl-genl-3.0) -D__WITH_PROTOS -ifpps: ALL_CFLAGS += $(shell pkg-config --cflags ncurses) -flowtop: ALL_CFLAGS += $(shell pkg-config --cflags ncurses) -bpfc: ALL_CFLAGS += -I.. -curvetun: ALL_CFLAGS += -I ${NACL_INC_DIR} +# Here are two special treatments for now curvetun: ALL_LDFLAGS += -L ${NACL_LIB_DIR} -# This gets some extra treatment here until the code looks properly -mausezahn: ALL_CFLAGS = -O2 -I. -I.. -DVERSION_STRING=\"$(VERSION_STRING)\" -DPREFIX_STRING=\"$(PREFIX)\" -DVERSION_LONG=\"$(VERSION_LONG)\" +mausezahn: ALL_CFLAGS = $(mausezahn-eflags) bpfc_clean_custom: $(Q)$(call RM,$(BUILD_DIR)/*.h $(BUILD_DIR)/*.c) diff --git a/astraceroute/Makefile b/astraceroute/Makefile index 8f9f518..8c5e7fe 100644 --- a/astraceroute/Makefile +++ b/astraceroute/Makefile @@ -16,3 +16,5 @@ astraceroute-objs = xmalloc.o \ ring_rx.o \ ring.o \ astraceroute.o + +astraceroute-eflags = diff --git a/bpfc/Makefile b/bpfc/Makefile index fa19d55..483980d 100644 --- a/bpfc/Makefile +++ b/bpfc/Makefile @@ -10,3 +10,5 @@ bpfc-objs = xmalloc.o \ bpfc-lex = bpf_lexer.yy.o bpfc-yaac = bpf_parser.tab.o + +bpfc-eflags = -I.. diff --git a/curvetun/Makefile b/curvetun/Makefile index 4f28adf..b13a0a0 100644 --- a/curvetun/Makefile +++ b/curvetun/Makefile @@ -27,3 +27,5 @@ curvetun-objs = xmalloc.o \ curvetun_server.o \ curvetun_client.o \ curvetun.o + +curvetun-eflags = -I ${NACL_INC_DIR} diff --git a/flowtop/Makefile b/flowtop/Makefile index c8998a6..fa41dff 100644 --- a/flowtop/Makefile +++ b/flowtop/Makefile @@ -22,3 +22,5 @@ flowtop-objs = xmalloc.o \ geoip.o \ screen.o \ flowtop.o + +flowtop-eflags = $(shell pkg-config --cflags ncurses) diff --git a/ifpps/Makefile b/ifpps/Makefile index 6c8ac43..5d394bc 100644 --- a/ifpps/Makefile +++ b/ifpps/Makefile @@ -10,3 +10,5 @@ ifpps-objs = xmalloc.o \ sig.o \ screen.o \ ifpps.o + +ifpps-eflags = $(shell pkg-config --cflags ncurses) diff --git a/mausezahn/Makefile b/mausezahn/Makefile index ab892c6..0f97c34 100644 --- a/mausezahn/Makefile +++ b/mausezahn/Makefile @@ -64,3 +64,8 @@ mausezahn-objs = str.o \ staging/llist.o \ staging/directmops.o \ staging/mausezahn.o + +mausezahn-eflags = -O2 -I. -I.. \ + -DVERSION_STRING=\"$(VERSION_STRING)\" \ + -DPREFIX_STRING=\"$(PREFIX)\" \ + -DVERSION_LONG=\"$(VERSION_LONG)\" diff --git a/netsniff-ng/Makefile b/netsniff-ng/Makefile index 55335e5..fa4976d 100644 --- a/netsniff-ng/Makefile +++ b/netsniff-ng/Makefile @@ -72,3 +72,7 @@ endif ifeq ($(CONFIG_HWTSTAMP), 1) netsniff-ng-objs += tstamping.o endif + +netsniff-ng-eflags = $(shell pkg-config --cflags libnl-3.0) \ + $(shell pkg-config --cflags libnl-genl-3.0) \ + -D__WITH_PROTOS diff --git a/trafgen/Makefile b/trafgen/Makefile index 3747661..f822fb9 100644 --- a/trafgen/Makefile +++ b/trafgen/Makefile @@ -23,3 +23,8 @@ trafgen-objs = xmalloc.o \ trafgen-lex = trafgen_lexer.yy.o trafgen-yaac = trafgen_parser.tab.o + +trafgen-eflags = $(shell pkg-config --cflags libnl-3.0) \ + $(shell pkg-config --cflags libnl-genl-3.0) \ + -I.. \ + -D__WITH_PROTOS -- cgit v1.2.3-54-g00ecf