[atkmm] NMake Makefiles: Add rules to generate pre-configure items



commit 5a420b4c62158e7f71796cb4a73532f91f1ebb5a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Feb 27 18:23:52 2020 +0800

    NMake Makefiles: Add rules to generate pre-configure items
    
    This will allow building from GIT checkouts easier, where we need the
    full atkmmconfig.h and atkmm.rc to carry out our builds with NMake.

 .gitignore                   |  1 +
 MSVC_NMake/Makefile.vc       |  4 ++++
 MSVC_NMake/generate-msvc.mak | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index 803cc97..2ffd368 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,3 +31,4 @@ stamp-h?
 
 /MSVC_NMake/atkmm/atkmm.rc
 /MSVC_NMake/atkmm/atkmmconfig.h
+/MSVC_NMake/pkg-ver.mak
diff --git a/MSVC_NMake/Makefile.vc b/MSVC_NMake/Makefile.vc
index 3e06b27..fff5d31 100644
--- a/MSVC_NMake/Makefile.vc
+++ b/MSVC_NMake/Makefile.vc
@@ -31,6 +31,10 @@ VALID_MSC = TRUE
 
 !if "$(VALID_MSC)" == "TRUE"
 
+!ifdef GENERATE_VERSIONED_FILES
+!include pkg-ver.mak
+!endif
+
 # Include the Makefile portion to convert the source and header lists
 # into the lists we need for compilation and introspection
 !include create-lists-msvc.mak
diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak
index 0b87b00..9f459f2 100644
--- a/MSVC_NMake/generate-msvc.mak
+++ b/MSVC_NMake/generate-msvc.mak
@@ -11,3 +11,40 @@ vs$(VSVER)\$(CFG)\$(PLAT)\atkmm:
 # Generate .def files
 vs$(VSVER)\$(CFG)\$(PLAT)\atkmm\atkmm.def: $(GENDEF) vs$(VSVER)\$(CFG)\$(PLAT)\atkmm $(atkmm_OBJS)
        vs$(VSVER)\$(CFG)\$(PLAT)\gendef.exe $@ $(ATKMM_LIBNAME) vs$(VSVER)\$(CFG)\$(PLAT)\atkmm\*.obj
+
+# Generate pre-generated resources and configuration headers (builds from GIT)
+prep-git-build: pkg-ver.mak
+
+atkmm\atkmm.rc: pkg-ver.mak atkmm\atkmm.rc.in
+       @echo Generating $@...
+       @copy $@.in $@
+       @$(PERL) -pi.bak -e "s/\@ATKMM_MAJOR_VERSION\@/$(PKG_MAJOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@ATKMM_MINOR_VERSION\@/$(PKG_MINOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@ATKMM_MICRO_VERSION\@/$(PKG_MICRO_VERSION)/g" $@
+       @$(PERL) -pi.bak -e 
"s/\@PACKAGE_VERSION\@/$(PKG_MAJOR_VERSION).$(PKG_MINOR_VERSION).$(PKG_MICRO_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@ATKMM_MODULE_NAME\@/atkmm-$(ATKMM_MAJOR_VERSION).$(ATKMM_MINOR_VERSION)/g" $@
+       @del $@.bak
+
+# You may change ATKMM_STATIC_LIB if you know what you are doing
+atkmm\atkmmconfig.h: pkg-ver.mak ..\atk\atkmmconfig.h.in
+       @echo Generating $@...
+       @copy ..\atk\$(@F).in $@
+       @$(PERL) -pi.bak -e "s/\#undef ATKMM_STATIC_LIB/\/\* \#undef ATKMM_STATIC_LIB \*\//g" $@
+       @$(PERL) -pi.bak -e "s/\#undef ATKMM_MAJOR_VERSION/\#define ATKMM_MAJOR_VERSION 
$(PKG_MAJOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\#undef ATKMM_MINOR_VERSION/\#define ATKMM_MINOR_VERSION 
$(PKG_MINOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\#undef ATKMM_MICRO_VERSION/\#define ATKMM_MICRO_VERSION 
$(PKG_MICRO_VERSION)/g" $@
+       @del $@.bak
+
+pkg-ver.mak: ..\configure.ac
+       @echo Generating version info Makefile Snippet...
+       @$(PERL) -ne "print if /AC_INIT\(/" $** |       \
+       $(PERL) -pe "tr/, /\n/s" |      \
+       $(PERL) -ne "print if 2 .. 2" | \
+       $(PERL) -ne "print /\[(.*)\]/" > ver.txt
+       @echo @echo off>pkg-ver.bat
+       @echo.>>pkg-ver.bat
+       @echo set /p atkmm_ver=^<ver.txt>>pkg-ver.bat
+       @echo for /f "tokens=1,2,3 delims=." %%%%a IN ("%atkmm_ver%") do (echo PKG_MAJOR_VERSION=%%%%a^& echo 
PKG_MINOR_VERSION=%%%%b^& echo PKG_MICRO_VERSION=%%%%c)^>$@>>pkg-ver.bat
+       @pkg-ver.bat
+       @del ver.txt pkg-ver.bat
+       $(MAKE) /f Makefile.vc CFG=$(CFG) GENERATE_VERSIONED_FILES=1 atkmm\atkmm.rc atkmm\atkmmconfig.h


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]