simplify make preprocess using clang-format's -i

thanks for letting me know krizej I wouldn't have found this myself
This commit is contained in:
jacekpoz 2024-04-24 20:09:04 +02:00
parent 2e259e946d
commit d4d0822eff
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -36,23 +36,17 @@ clean:
rm -rf $(BIN) rm -rf $(BIN)
rm -rf $(PREPROCESSED) rm -rf $(PREPROCESSED)
TMP = temp
tmp:
mkdir -p $(TMP)
_PP_HXX = osuparser.hpp config.hpp _PP_HXX = osuparser.hpp config.hpp
_PP_CXX = osuparser.cpp _PP_CXX = osuparser.cpp
_PP = $(_PP_HXX) $(_PP_CXX) _PP = $(_PP_HXX) $(_PP_CXX)
PP = $(addprefix $(PREPROCESSED)/, $(_PP)) PP = $(addprefix $(PREPROCESSED)/, $(_PP))
preprocess: dirs tmp $(PP) preprocess: dirs $(PP)
rm -rf $(TMP)
$(PREPROCESSED)/%.hpp: $(INCLUDE)/%.hpp $(PREPROCESSED)/%.hpp: $(INCLUDE)/%.hpp
$(CXX) $(CXXFLAGS) -E $< > $(TMP)/$(@:$(PREPROCESSED)/%=%) $(CXX) $(CXXFLAGS) -E $< > $@
clang-format $(TMP)/$(@:$(PREPROCESSED)/%=%) > $@ clang-format -i $@
$(PREPROCESSED)/%.cpp: $(SRC)/%.cpp $(PREPROCESSED)/%.cpp: $(SRC)/%.cpp
$(CXX) $(CXXFLAGS) -E $< > $(TMP)/$(@:$(PREPROCESSED)/%=%) $(CXX) $(CXXFLAGS) -E $< > $@
clang-format $(TMP)/$(@:$(PREPROCESSED)/%=%) > $@ clang-format -i $@