From f5b1ccaad25b26a8bb383a268532f269411e512c Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Sat, 7 May 2022 02:46:17 -0300 Subject: makefiles: move extra deps into new MOD vars To make the makefiles more similar. That is, add the following new variables: * MOD_HDRS * MOD_SRCS * MOD_OBJS And move existing module-specific header and object dependencies into `MOD_HDRS` and `MOD_OBJS`, respectively. `MOD_SRCS` is added mostly for symmetry/consistency. Note: Use `MOD_` as a prefix instead of `EXTRA_` to avoid confusion, as the latter is currently used for global variables (such as `EXTRA_CFLAGS`), as opposed to module-specific variables. Note2: Add them directly into the HDRS/SRCS/OBJS variables to avoid cluttering the existing recipes with an extra variables unnecessarily. This also allows, for example, referencing all of the object dependencies with `$<` if `$(OBJS)` is the first dependency (at least in GNU make). Note3: Since HDRS/SRCS/OBJS use simple assignment (through `:=`), the MOD variables should appear before including src/common.mk (or src/so.mk). --- src/fnet/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/fnet') diff --git a/src/fnet/Makefile b/src/fnet/Makefile index 9ce457a5c..3cdaf11cf 100644 --- a/src/fnet/Makefile +++ b/src/fnet/Makefile @@ -1,16 +1,19 @@ ROOT = ../.. -include $(ROOT)/config.mk +MOD_HDRS = ../include/common.h ../include/libnetlink.h +MOD_OBJS = ../lib/common.o ../lib/libnetlink.o + .PHONY: all all: fnet include $(ROOT)/src/common.mk -%.o : %.c $(HDRS) ../include/common.h ../include/libnetlink.h $(ROOT)/config.mk +%.o : %.c $(HDRS) $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fnet: $(OBJS) ../lib/common.o ../lib/libnetlink.o $(ROOT)/config.mk - $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/libnetlink.o $(LIBS) $(EXTRA_LDFLAGS) +fnet: $(OBJS) $(ROOT)/config.mk + $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean clean:; rm -fr *.o fnet *.gcov *.gcda *.gcno *.plist -- cgit v1.2.3-54-g00ecf