diff --git a/Makefile b/Makefile index 6ff16c5..b94f3a1 100644 --- a/Makefile +++ b/Makefile @@ -41,12 +41,19 @@ _PP_CXX = osuparser.cpp _PP = $(_PP_HXX) $(_PP_CXX) PP = $(addprefix $(PREPROCESSED)/, $(_PP)) +# TODO work out how to keep my own headers in the awk somehow pp: dirs $(PP) $(PREPROCESSED)/%.hpp: $(INCLUDE)/%.hpp - $(CXX) $(CXXFLAGS) -E $< > $@ + $(eval TMP := $(shell mktemp).hpp) + awk '/^#include/ || /^#pragma/ || /^namespace/ || /^[[:space:]]*$$/ {if(!f)next} // {f=1;print}' $< > $(TMP) + $(CXX) $(CXXFLAGS) -E $(TMP) > $@ clang-format -i $@ + rm -rf $(TMP) $(PREPROCESSED)/%.cpp: $(SRC)/%.cpp - $(CXX) $(CXXFLAGS) -E $< > $@ + $(eval TMP := $(shell mktemp).cpp) + awk '/^#include/ || /^#pragma/ || /^namespace/ || /^[[:space:]]*$$/ {if(!f)next} // {f=1;print}' $< > $(TMP) + $(CXX) $(CXXFLAGS) -E $(TMP) > $@ clang-format -i $@ + rm -rf $(TMP)