Skip to content

Commit ace4489

Browse files
fanc999-1kjellahl
authored andcommitted
NMake Makefiles: Add rules to generate sigc.rc and sigc++config.h
This adds a 'prep-git-build' target which is run before building any of the other targets so that this paves the first steps in making the libsigc++-2-10 branch buildable directly from a GIT checkout with the NMake Makefiles. Note that unlike the master (3.x) branch, we still need to use m4 to generate some sources and headers, which will be covered in the following commit.
1 parent 9941045 commit ace4489

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

MSVC_NMake/Makefile.vc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ VALID_MSC = TRUE
3030
# into the lists we need for compilation and introspection
3131
!include create-lists-msvc.mak
3232

33+
!ifdef GENERATE_VERSIONED_FILES
34+
!include pkg-ver.mak
35+
!endif
36+
3337
all: $(LIBSIGC_LIB) $(libsigc_ex) all-build-info
3438

3539
tests: $(libsigc_tests) all-build-info

MSVC_NMake/generate-msvc.mak

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,41 @@ vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp \
88
vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-ex \
99
vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests:
1010
@-md $@
11+
12+
# Create the versioned files
13+
14+
prep-git-build: pkg-ver.mak
15+
16+
sigc.rc: pkg-ver.mak sigc.rc.in
17+
@echo Generating $@...
18+
@copy $@.in $@
19+
@$(PERL) -pi.bak -e "s/\@SIGCXX_MAJOR_VERSION\@/$(PKG_MAJOR_VERSION)/g" $@
20+
@$(PERL) -pi.bak -e "s/\@SIGCXX_MINOR_VERSION\@/$(PKG_MINOR_VERSION)/g" $@
21+
@$(PERL) -pi.bak -e "s/\@SIGCXX_MICRO_VERSION\@/$(PKG_MICRO_VERSION)/g" $@
22+
@$(PERL) -pi.bak -e "s/\@PACKAGE_VERSION\@/$(PKG_MAJOR_VERSION).$(PKG_MINOR_VERSION).$(PKG_MICRO_VERSION)/g" $@
23+
@$(PERL) -pi.bak -e "s/\@SIGCXX_API_VERSION\@/$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)/g" $@
24+
@del $@.bak
25+
26+
# You may change SIGCXX_DISABLE_DEPRECATED if you know what you are doing
27+
sigc++config.h: pkg-ver.mak ..\sigc++config.h.in
28+
@echo Generating $@...
29+
@copy "..\$(@F).in" "$@"
30+
@$(PERL) -pi.bak -e "s/\#undef SIGCXX_DISABLE_DEPRECATED/\/\* \#undef SIGCXX_DISABLE_DEPRECATED \*\//g" $@
31+
@$(PERL) -pi.bak -e "s/\#undef SIGCXX_MAJOR_VERSION/\#define SIGCXX_MAJOR_VERSION $(PKG_MAJOR_VERSION)/g" $@
32+
@$(PERL) -pi.bak -e "s/\#undef SIGCXX_MINOR_VERSION/\#define SIGCXX_MINOR_VERSION $(PKG_MINOR_VERSION)/g" $@
33+
@$(PERL) -pi.bak -e "s/\#undef SIGCXX_MICRO_VERSION/\#define SIGCXX_MICRO_VERSION $(PKG_MICRO_VERSION)/g" $@
34+
@del $@.bak
35+
36+
pkg-ver.mak: ..\configure.ac
37+
@echo Generating version info Makefile Snippet...
38+
@$(PERL) -00 -ne "print if /AC_INIT\(/" $** | \
39+
$(PERL) -pe "tr/, /\n/s" | \
40+
$(PERL) -ne "print if 2 .. 2" | \
41+
$(PERL) -ne "print /\[(.*)\]/" > ver.txt
42+
@echo @echo off>pkg-ver.bat
43+
@echo.>>pkg-ver.bat
44+
@echo set /p sigc_ver=^<ver.txt>>pkg-ver.bat
45+
@echo for /f "tokens=1,2,3 delims=." %%%%a IN ("%%sigc_ver%%") do (echo PKG_MAJOR_VERSION=%%%%a^& echo PKG_MINOR_VERSION=%%%%b^& echo PKG_MICRO_VERSION=%%%%c)^>$@>>pkg-ver.bat
46+
@pkg-ver.bat
47+
@del ver.txt pkg-ver.bat
48+
$(MAKE) /f Makefile.vc CFG=$(CFG) GENERATE_VERSIONED_FILES=1 sigc.rc sigc++config.h

0 commit comments

Comments
 (0)