program_C_SRCS := $(wildcard *.c) $(wildcard *.cc)
DEPS = make.deps
-all: $(LIB_SO) $(DEPS) tests
+all: $(LIB_SO) tests
+$(DEPS): build_deps := 1
$(DEPS): $(program_C_SRCS) $(program_H_SRCS)
$(CXX) -MM $(program_C_SRCS) $(CPPFLAGS) > $(DEPS)
+ifeq ($(build_deps),1)
include $(DEPS)
+endif
debug: CPPFLAGS += -DCONFIG_DEBUG
debug: all
malloc.o: malloc.c
$(CC) -fPIC -c malloc.c -DMSPACES -DONLY_MSPACES -DHAVE_MMAP=0 $(CPPFLAGS) -Wno-unused-variable
-%.o: %.cc
+%.o: %.cc $(DEPS)
$(CXX) -fPIC -c $< $(CPPFLAGS)
PHONY += clean
tests: $(LIB_SO)
$(MAKE) -C $(TESTS_DIR)
-BENCHMARKS := benchmarks
+BENCH_DIR := benchmarks
PHONY += benchmarks
benchmarks: $(LIB_SO)
- @if ! test -d $(BENCHMARKS); then \
- echo "Directory $(BENCHMARKS) does not exist" && \
+ @if ! test -d $(BENCH_DIR); then \
+ echo "Directory $(BENCH_DIR) does not exist" && \
echo "Please clone the benchmarks repository" && \
echo && \
exit 1; \
fi
- $(MAKE) -C $(BENCHMARKS)
+ $(MAKE) -C $(BENCH_DIR)
.PHONY: $(PHONY)