diff --git a/include/builder/live_dyn_var.h b/include/builder/live_dyn_var.h deleted file mode 100644 index c665143..0000000 --- a/include/builder/live_dyn_var.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef BUILDER_LIVE_DYN_VAR_H -#define BUILDER_LIVE_DYN_VAR_H - -#include "util/tracer.h" -#include - -namespace builder { - -class live_tag_set { - std::unordered_set live_set; - size_t computed_hash = 0; -public: - // Default empty set - live_tag_set() {} - - live_tag_set(std::unordered_set &live_set): live_set(live_set) { - // Now update the hash - for (auto s: live_set) { - computed_hash = tracer::hash_combine(computed_hash, s.hash()); - } - } - - bool operator==(const live_tag_set& other) { - if (this == &other) return true; - if (computed_hash != other.computed_hash) return false; - return live_set == other.live_set; - } -}; - - -} - -#endif diff --git a/make/buildit_rules.mk b/make/buildit_rules.mk index c5eee04..9e71bf6 100644 --- a/make/buildit_rules.mk +++ b/make/buildit_rules.mk @@ -1,6 +1,6 @@ # Actual rules for building the library and the executables -.PRECIOUS: $(BUILD_DIR)/%.o -.PRECIOUS: $(BUILD_DIR)/samples/%.o +.SECONDARY: $(BUILD_DIR)/%.o +.SECONDARY: $(BUILD_DIR)/samples/%.o $(BUILD_DIR)/gen_headers/gen/compiler_headers.h: @mkdir -p $(@D) @@ -8,18 +8,28 @@ $(BUILD_DIR)/gen_headers/gen/compiler_headers.h: @echo "#define GEN_TEMPLATE_NAME \"$(BASE_DIR)/scratch/code_XXXXXX\"" >> $@ @echo "#define COMPILER_PATH \"$(CC)\"" >> $@ @echo "#define CXX_COMPILER_PATH \"$(CXX)\"" >> $@ -$(LIBRARY_OBJS): $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp $(INCLUDES) $(DEPS_LIST) + +$(LIBRARY_OBJS): $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp $(GEN_INCLUDES) @mkdir -p $(@D) - $(CXXV) $(CFLAGS_INTERNAL) $(CFLAGS) $< -o $@ $(INCLUDE_FLAGS) -c -$(BUILD_DIR)/samples/%.o: $(SAMPLES_DIR)/%.cpp $(INCLUDES) $(DEPS_LIST) + $(CXXV) $(CFLAGS_INTERNAL) $(CFLAGS) $< -o $@ $(INCLUDE_FLAGS) -c -MMD -MP -MT $@ -MF $(@:.o=.td) + @mv -f $(@:.o=.td) $(@:.o=.d) + +$(BUILD_DIR)/samples/%.o: $(SAMPLES_DIR)/%.cpp $(GEN_INCLUDES) @mkdir -p $(@D) - $(CXXV) $(CFLAGS_INTERNAL) $(CFLAGS) $< -o $@ $(INCLUDE_FLAGS) -c + $(CXXV) $(CFLAGS_INTERNAL) $(CFLAGS) $< -o $@ $(INCLUDE_FLAGS) -c -MMD -MP -MT $@ -MF $(@:.o=.td) + @mv -f $(@:.o=.td) $(@:.o=.d) + $(LIBRARY): $(LIBRARY_OBJS) $(DEPS_LIST) @mkdir -p $(@D) $(ARV) cr $(LIBRARY) $(LIBRARY_OBJS) + $(BUILD_DIR)/sample%: $(BUILD_DIR)/samples/sample%.o $(LIBRARY) $(DEPS_LIST) @mkdir -p $(@D) $(CXXLDV) -o $@ $< $(LINKER_FLAGS) .PHONY: executables executables: $(SAMPLES) + + +-include $(LIBRARY_OBJS:.o=.d) +-include $(SAMPLE_OBJS:.o=.d) diff --git a/make/dirs.mk b/make/dirs.mk index 910bf1b..d90641b 100644 --- a/make/dirs.mk +++ b/make/dirs.mk @@ -8,7 +8,9 @@ SAMPLES_DIR=$(BASE_DIR)/samples DEPS_DIR=$(BASE_DIR)/deps SAMPLES_SRCS=$(wildcard $(SAMPLES_DIR)/*.cpp) SAMPLES=$(subst $(SAMPLES_DIR),$(BUILD_DIR),$(SAMPLES_SRCS:.cpp=)) -INCLUDES=$(wildcard $(INCLUDE_DIR)/*.h) $(wildcard $(INCLUDE_DIR)/*/*.h) $(BUILD_DIR)/gen_headers/gen/compiler_headers.h + +GEN_INCLUDES=$(BUILD_DIR)/gen_headers/gen/compiler_headers.h +INCLUDES=$(wildcard $(INCLUDE_DIR)/*.h) $(wildcard $(INCLUDE_DIR)/*/*.h) $(GEN_INCLUDES) INCLUDES+=$(wildcard $(INCLUDE_DIR)/*/*/*.h) BUILDER_SRC=$(wildcard $(SRC_DIR)/builder/*.cpp) @@ -18,6 +20,7 @@ UTIL_SRC=$(wildcard $(SRC_DIR)/util/*.cpp) BUILDER_OBJS=$(subst $(SRC_DIR),$(BUILD_DIR),$(BUILDER_SRC:.cpp=.o)) BLOCKS_OBJS=$(subst $(SRC_DIR),$(BUILD_DIR),$(BLOCKS_SRC:.cpp=.o)) UTIL_OBJS=$(subst $(SRC_DIR),$(BUILD_DIR),$(UTIL_SRC:.cpp=.o)) +SAMPLE_OBJS=$(subst $(SAMPLES_DIR),$(BUILD_DIR)/samples,$(SAMPLES_SRCS:.cpp=.o)) LIBRARY_OBJS=$(BUILDER_OBJS) $(BLOCKS_OBJS) $(UTIL_OBJS) LIBRARY=$(BUILD_DIR)/lib$(LIBRARY_NAME).a