TARGET_EXEC ?= testLib BUILD_DIR ?= build SRC_DIRS ?= src SRCS := $(shell find $(SRC_DIRS) -name *.cpp) OBJS := $(SRCS:%=$(BUILD_DIR)/%.o) DEPS := $(OBJS:.o=.d) CPPFLAGS ?= -MMD -MP LIBS := ../build/libd4.a ../3rdParty/kahypar/build/lib/libkahypar.a ../3rdParty/patoh/libpatoh.a ../3rdParty/glucose-3.0/core/lib_standard.a -lboost_program_options -lz -O3 -lgmpxx -lgmp -Wl,-R../build/ $(BUILD_DIR)/$(TARGET_EXEC): $(OBJS) @echo Linking: "$@ ( $(foreach f,$^,$(subst $(BUILD_DIR)/$(SRC_DIRS),,$f)) )" $(CXX) $(OBJS) -o $@ $(LDFLAGS) $(LIBS) $(INCLUDES) $(BUILD_DIR)/%.cpp.o: %.cpp @echo Compiling: $< @$(MKDIR_P) $(dir $@) $(CXX) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ $(INCLUDES) -I../ .PHONY: clean clean: $(RM) -r $(BUILD_DIR) -include $(DEPS) MKDIR_P ?= mkdir -p