[pangomm/pangomm-2-42] NMake Makefiles: Add rules to generate pre-configured items
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm/pangomm-2-42] NMake Makefiles: Add rules to generate pre-configured items
- Date: Thu, 27 Feb 2020 08:49:37 +0000 (UTC)
commit 7c3c4836cd94d0485eaad51da6358d87582c1399
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Feb 27 15:34:05 2020 +0800
NMake Makefiles: Add rules to generate pre-configured items
This will generate the pangomm.rc and pangommconfig.h files, which are needed
for a Visual Studio build. This will make builds from a GIT checkout
easier with NMake.
MSVC_NMake/Makefile.vc | 4 ++++
MSVC_NMake/build-rules-msvc.mak | 1 +
MSVC_NMake/generate-msvc.mak | 37 +++++++++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+)
---
diff --git a/MSVC_NMake/Makefile.vc b/MSVC_NMake/Makefile.vc
index 614075b..a27c80f 100644
--- a/MSVC_NMake/Makefile.vc
+++ b/MSVC_NMake/Makefile.vc
@@ -27,6 +27,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/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak
index dbb5ee0..644745a 100644
--- a/MSVC_NMake/build-rules-msvc.mak
+++ b/MSVC_NMake/build-rules-msvc.mak
@@ -63,4 +63,5 @@ clean:
@-del /f /q $(CFG)\$(PLAT)\gendef\*.obj
@-rd $(CFG)\$(PLAT)\pangomm
@-rd $(CFG)\$(PLAT)\gendef
+ @-del pkg-ver.mak
@-del /f /q vc$(PDBVER)0.pdb
diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak
index 5c857ae..f135ad5 100644
--- a/MSVC_NMake/generate-msvc.mak
+++ b/MSVC_NMake/generate-msvc.mak
@@ -11,3 +11,40 @@ $(CFG)\$(PLAT)\pangomm:
# Generate .def files
$(CFG)\$(PLAT)\pangomm\pangomm.def: $(GENDEF) $(CFG)\$(PLAT)\pangomm $(pangomm_OBJS)
$(CFG)\$(PLAT)\gendef.exe $@ $(PANGOMM_LIBNAME) $(CFG)\$(PLAT)\pangomm\*.obj
+
+# Generate pre-generated resources and configuration headers (builds from GIT)
+prep-git-build: pkg-ver.mak
+ $(MAKE) /f Makefile.vc CFG=$(CFG) GENERATE_VERSIONED_FILES=1 pangomm\pangomm.rc
pangomm\pangommconfig.h
+
+pangomm\pangomm.rc: pkg-ver.mak pangomm\pangomm.rc.in
+ @echo Generating $@...
+ @copy $@.in $@
+ @$(PERL) -pi.bak -e "s/\@PANGOMM_MAJOR_VERSION\@/$(PKG_MAJOR_VERSION)/g" $@
+ @$(PERL) -pi.bak -e "s/\@PANGOMM_MINOR_VERSION\@/$(PKG_MINOR_VERSION)/g" $@
+ @$(PERL) -pi.bak -e "s/\@PANGOMM_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/\@PANGOMM_MODULE_NAME\@/pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)/g" $@
+ @del $@.bak
+
+# You may change PANGOMM_DISABLE_DEPRECATED if you know what you are doing
+pangomm\pangommconfig.h: pkg-ver.mak ..\pango\pangommconfig.h.in
+ @echo Generating $@...
+ @copy ..\pango\$(@F).in $@
+ @$(PERL) -pi.bak -e "s/\#undef PANGOMM_DISABLE_DEPRECATED/\/\* \#undef PANGOMM_DISABLE_DEPRECATED
\*\//g" $@
+ @$(PERL) -pi.bak -e "s/\#undef PANGOMM_MAJOR_VERSION/\#define PANGOMM_MAJOR_VERSION
$(PKG_MAJOR_VERSION)/g" $@
+ @$(PERL) -pi.bak -e "s/\#undef PANGOMM_MINOR_VERSION/\#define PANGOMM_MINOR_VERSION
$(PKG_MINOR_VERSION)/g" $@
+ @$(PERL) -pi.bak -e "s/\#undef PANGOMM_MICRO_VERSION/\#define PANGOMM_MICRO_VERSION
$(PKG_MICRO_VERSION)/g" $@
+ @del $@.bak
+
+pkg-ver.mak: ..\configure.ac
+ @echo Generating version info Makefile Snippet...
+ @$(PERL) -00 -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 pangomm_ver=^<ver.txt>>pkg-ver.bat
+ @echo for /f "tokens=1,2,3 delims=." %%%%a IN ("%pangomm_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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]