From 9f438b1bccca459e484560232e5b6e7dfdbacd61 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sun, 29 Sep 2013 19:54:02 -0700 Subject: Automatically generate version information --- real.make | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'real.make') diff --git a/real.make b/real.make index a456a17..f880889 100644 --- a/real.make +++ b/real.make @@ -223,7 +223,7 @@ s: ${ASSEMBLED} o: ${OBJECTS} mostlyclean: - rm -rf obj + rm -rf obj conf-raw clean: mostlyclean rm -rf bin distclean: clean @@ -235,12 +235,10 @@ distclean: clean %.cpp %.hpp: %.ypp $(MKDIR_FIRST) ${BISON} -d -o $*.cpp $< -%.hpp: ; -# hpp rule is needed for disappearing headers obj/%.d: src/%.cpp $(MKDIR_FIRST) set -o pipefail; \ - ${CXX} ${CPPFLAGS} ${CXXFLAGS} -MM $< \ + ${CXX} ${CPPFLAGS} ${CXXFLAGS} -MG -MP -MM $< \ -MT '$@ $(patsubst %.d,%.o,$@)' \ | sed -e ':again; s:/[^/ ]*/../:/:; t again' \ -e 's: ${SRC_DIR}/: :g' \ @@ -310,3 +308,25 @@ tags: ${SOURCES} ${HEADERS} Makefile: ${SRC_DIR}/Makefile.in @echo Makefile.in updated, you must rerun configure @false + +include ${SRC_DIR}/version.make + +# TODO - fix pattern priority bug so I can make these .hpp +# +# This is complicated and still isn't optimal. +conf-raw/int-%.h: FORCE + $(MKDIR_FIRST) + @grep -s -q '^$(value $*)$$' $@ \ + || { \ + echo "#define $* \\"; \ + echo '$(value $*)'; \ + } > $@ +conf-raw/str-%.h: FORCE + $(MKDIR_FIRST) + @grep -s -q '^"$(value $*)"$$' $@ \ + || { \ + echo "#define $* \\"; \ + echo '"$(value $*)"'; \ + } > $@ +FORCE: ; +override CPPFLAGS += -I . -- cgit v1.2.3-70-g09d2