From 34e9c7151d42028d9de768cb4d0ea37830ec94fe Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 23 Jul 2020 17:29:33 +0800 Subject: NMake Makefiles: Fix builds from release tarballs This avoids needlessly enerating cairommconfig.h and cairomm.rc, and when we do need to generate these files, we ensure that they always have the right version info in them. Also streamline the build process that this file generating is done in the 'all' target, so that one does not need to use the -prep-git-build' target beforehand. --- MSVC_NMake/Makefile.vc | 1 + MSVC_NMake/generate-msvc.mak | 36 ++++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/MSVC_NMake/Makefile.vc b/MSVC_NMake/Makefile.vc index 45e6ef3..93157d4 100644 --- a/MSVC_NMake/Makefile.vc +++ b/MSVC_NMake/Makefile.vc @@ -32,6 +32,7 @@ VALID_MSC = TRUE !ifdef GENERATE_VERSIONED_FILES !include pkg-ver.mak +DO_REAL_GEN = 1 !endif # Include the Makefile portion to convert the source and header lists diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak index f2fac82..5bb6624 100644 --- a/MSVC_NMake/generate-msvc.mak +++ b/MSVC_NMake/generate-msvc.mak @@ -7,24 +7,28 @@ prep-git-build: pkg-ver.mak $(MAKE) /f Makefile.vc CFG=$(CFG) GENERATE_VERSIONED_FILES=1 cairomm\cairomm.rc cairomm\cairommconfig.h -cairomm\cairomm.rc: pkg-ver.mak cairomm\cairomm.rc.in - @echo Generating $@... - @copy $@.in $@ - @$(PERL) -pi.bak -e "s/\@CAIROMM_MAJOR_VERSION\@/$(PKG_MAJOR_VERSION)/g" $@ - @$(PERL) -pi.bak -e "s/\@CAIROMM_MINOR_VERSION\@/$(PKG_MINOR_VERSION)/g" $@ - @$(PERL) -pi.bak -e "s/\@CAIROMM_MICRO_VERSION\@/$(PKG_MICRO_VERSION)/g" $@ - @$(PERL) -pi.bak -e "s/\@VERSION\@/$(PKG_MAJOR_VERSION).$(PKG_MINOR_VERSION).$(PKG_MICRO_VERSION)/g" $@ - @del $@.bak +cairomm\cairomm.rc: ..\configure.ac cairomm\cairomm.rc.in + @if not "$(DO_REAL_GEN)" == "1" if exist pkg-ver.mak del pkg-ver.mak + @if not exist pkg-ver.mak $(MAKE) /f Makefile.vc CFG=$(CFG) prep-git-build + @if "$(DO_REAL_GEN)" == "1" echo Generating $@... + @if "$(DO_REAL_GEN)" == "1" copy $@.in $@ + @if "$(DO_REAL_GEN)" == "1" $(PERL) -pi.bak -e "s/\@CAIROMM_MAJOR_VERSION\@/$(PKG_MAJOR_VERSION)/g" $@ + @if "$(DO_REAL_GEN)" == "1" $(PERL) -pi.bak -e "s/\@CAIROMM_MINOR_VERSION\@/$(PKG_MINOR_VERSION)/g" $@ + @if "$(DO_REAL_GEN)" == "1" $(PERL) -pi.bak -e "s/\@CAIROMM_MICRO_VERSION\@/$(PKG_MICRO_VERSION)/g" $@ + @if "$(DO_REAL_GEN)" == "1" $(PERL) -pi.bak -e "s/\@VERSION\@/$(PKG_MAJOR_VERSION).$(PKG_MINOR_VERSION).$(PKG_MICRO_VERSION)/g" $@ + @if "$(DO_REAL_GEN)" == "1" del $@.bak # You may change CAIROMM_EXCEPTIONS_ENABLED if you know what you are doing -cairomm\cairommconfig.h: pkg-ver.mak ..\cairommconfig.h.in - @echo Generating $@... - @copy ..\$(@F).in $@ - @$(PERL) -pi.bak -e "s/\#undef CAIROMM_EXCEPTIONS_ENABLED/\#define CAIROMM_EXCEPTIONS_ENABLED 1/g" $@ - @$(PERL) -pi.bak -e "s/\#undef CAIROMM_MAJOR_VERSION/\#define CAIROMM_MAJOR_VERSION $(PKG_MAJOR_VERSION)/g" $@ - @$(PERL) -pi.bak -e "s/\#undef CAIROMM_MINOR_VERSION/\#define CAIROMM_MINOR_VERSION $(PKG_MINOR_VERSION)/g" $@ - @$(PERL) -pi.bak -e "s/\#undef CAIROMM_MICRO_VERSION/\#define CAIROMM_MICRO_VERSION $(PKG_MICRO_VERSION)/g" $@ - @del $@.bak +cairomm\cairommconfig.h: ..\configure.ac ..\cairommconfig.h.in + @if not "$(DO_REAL_GEN)" == "1" if exist pkg-ver.mak del pkg-ver.mak + @if not exist pkg-ver.mak $(MAKE) /f Makefile.vc CFG=$(CFG) prep-git-build + @if "$(DO_REAL_GEN)" == "1" echo Generating $@... + @if "$(DO_REAL_GEN)" == "1" copy ..\$(@F).in $@ + @if "$(DO_REAL_GEN)" == "1" $(PERL) -pi.bak -e "s/\#undef CAIROMM_EXCEPTIONS_ENABLED/\#define CAIROMM_EXCEPTIONS_ENABLED 1/g" $@ + @if "$(DO_REAL_GEN)" == "1" $(PERL) -pi.bak -e "s/\#undef CAIROMM_MAJOR_VERSION/\#define CAIROMM_MAJOR_VERSION $(PKG_MAJOR_VERSION)/g" $@ + @if "$(DO_REAL_GEN)" == "1" $(PERL) -pi.bak -e "s/\#undef CAIROMM_MINOR_VERSION/\#define CAIROMM_MINOR_VERSION $(PKG_MINOR_VERSION)/g" $@ + @if "$(DO_REAL_GEN)" == "1" $(PERL) -pi.bak -e "s/\#undef CAIROMM_MICRO_VERSION/\#define CAIROMM_MICRO_VERSION $(PKG_MICRO_VERSION)/g" $@ + @if "$(DO_REAL_GEN)" == "1" del $@.bak pkg-ver.mak: ..\configure.ac @echo Generating version info Makefile Snippet... -- cgit v1.2.3