From ab5316a3da9416b8ace15a560efd77f54fb4ddc3 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Sat, 24 Oct 2020 02:42:58 -0400 Subject: [PATCH] src: use correct flags for compiling .c files, fix missing dependencies fiewalk and fiemap depend on a lot of crucible, and incremental builds fail hard without proper dependency tracking. All binaries must be rebuilt when makeflags changes. This dependency exists already in lib and test, but src was missing. Signed-off-by: Zygo Blaxell --- src/Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index aef8cbc..f8e1487 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,6 +3,8 @@ PROGRAMS = \ ../bin/fiemap \ ../bin/fiewalk \ +PROGRAM_OBJS = $(foreach b,$(PROGRAMS),$(patsubst ../bin/%,%.o,$(b))) + all: $(BEES) $(PROGRAMS) include ../makeflags @@ -19,6 +21,8 @@ BEES_OBJS = \ bees-thread.o \ bees-types.o \ +ALL_OBJS = $(BEES_OBJS) $(PROGRAM_OBJS) + bees-version.c: bees.h $(BEES_OBJS:.o=.cc) Makefile echo "const char *BEES_VERSION = \"$(BEES_VERSION)\";" > bees-version.new.c mv -f bees-version.new.c bees-version.c @@ -33,13 +37,16 @@ bees-usage.c: bees-usage.txt Makefile .depends/%.dep: %.cc Makefile | .depends $(CXX) $(BEES_CXXFLAGS) -M -MF $@ -MT $(<:.cc=.o) $< -depends.mk: $(BEES_OBJS:%.o=.depends/%.dep) +depends.mk: $(ALL_OBJS:%.o=.depends/%.dep) cat $^ > $@.new mv -f $@.new $@ include depends.mk -$(BEES_OBJS) fiemap.o fiewalk.o: %.o: %.cc +%.o: %.c ../makeflags + $(CC) $(BEES_CFLAGS) -o $@ -c $< + +%.o: %.cc ../makeflags $(CXX) $(BEES_CXXFLAGS) -o $@ -c $< $(PROGRAMS): ../bin/%: %.o