Skip to content

Commit 61c515a

Browse files
fanc999-1kjellahl
authored andcommitted
NMake Makefiles: Add rules to generate sources
This adds rules to use m4 to generate the headers and sources from their .m4 counterparts, which allows building directly from a GIT checkout, after running the 'prep-git-build' target. Update the README.txt file to reflect on this enhancement, and make sure the generated headers are also copied when running the 'install' target
1 parent ace4489 commit 61c515a

File tree

6 files changed

+70
-16
lines changed

6 files changed

+70
-16
lines changed

MSVC_NMake/README.txt

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,28 @@ targets:
1515
-all (or no target specified): The libsigc++ DLL and the example programs.
1616
-test: The libsigc++ DLL and the test programs.
1717
-benchmark: The libsigc++ DLL and the benchmark program.
18+
-prep-git-build: Prepare to build directly from a GIT checkout. You must
19+
run this target before any other targets at least once if you
20+
are building from a GIT checkout or from a Meson-generated
21+
tarball. If you are building from a GIT checkout, you must
22+
run this before any other targets whenever you change
23+
configuration, target architecture or toolset version. You
24+
will at least need PERL for this, and m4 if building from a
25+
GIT checkout or when building after running the 'forceclean'
26+
target.
1827

1928
The following are instructions for performing such a build. A 'clean' target is
2029
provided-it is recommended that one cleans the build and redo the build if any
21-
configuration option changed. An
22-
'install' target is also provided to copy the built items in their appropriate
23-
locations under $(PREFIX), which is described below.
30+
configuration option changed. An 'install' target is provided to copy the
31+
built items in their appropriate locations under $(PREFIX), which is described below.
32+
33+
A 'forceclean' target is also provided to cover the actions under the target 'clean',
34+
but also to remove any traces of the headers and sources that were generated. This
35+
may be useful if one wants to re-generate the sources and headers from the m4 templates.
36+
37+
If you do get errors during the build such as U1073 when building lambda.obj, or
38+
if you have header conflicts or missing headers, ensure that you run the 'prep-git-build'
39+
target first.
2440

2541
Invoke the build by issuing the command:
2642
nmake /f Makefile.vc CFG=[release|debug] [PREFIX=...] <option1=1 option2=1 ...>

MSVC_NMake/build-rules-msvc.mak

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,30 @@
1414
# $<
1515
# <<
1616
{..\sigc++\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj:
17+
@if not exist $(@D)\ md $(@D)
1718
$(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<<
1819
$<
1920
<<
2021

2122
{..\sigc++\adaptors\lambda\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj:
23+
@if not exist $(@D)\ md $(@D)
2224
$(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<<
2325
$<
2426
<<
2527

2628
{..\sigc++\functors\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj:
29+
@if not exist $(@D)\ md $(@D)
2730
$(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<<
2831
$<
2932
<<
3033

3134
{..\untracked\sigc++\adaptors\lambda\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj:
35+
@if not exist $(@D)\ md $(@D)
36+
$(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<<
37+
$<
38+
<<
39+
40+
{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\adaptors\lambda\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj:
3241
$(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<<
3342
$<
3443
<<
@@ -51,7 +60,7 @@ $(LIBSIGC_LIB): $(LIBSIGC_DLL)
5160
# $(dependent_objects)
5261
# <<
5362
# @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
54-
$(LIBSIGC_DLL): vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp $(libsigcpp_dll_OBJS)
63+
$(LIBSIGC_DLL): $(libsigcpp_dll_OBJS)
5564
link /DLL $(LDFLAGS) /implib:$(LIBSIGC_LIB) -out:$@ @<<
5665
$(libsigcpp_dll_OBJS)
5766
<<
@@ -99,4 +108,11 @@ clean:
99108
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\*.pdb
100109
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests
101110
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-ex
111+
@-for %d in ($(sigc_m4_srcdirs)) do @for %x in (cc h) do @if exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%d\ del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%d\*.%x
112+
@-for %x in (cc h) do @if exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\ del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\*.%x
113+
@-for %d in ($(sigc_m4_srcdirs)) do @rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%d
114+
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++
102115
@-rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp
116+
117+
forceclean: clean
118+
@-for %d in (. adaptors\lambda adaptors functors) do @for %t in (.. ..\untracked) do @for %x in (cc h) do @for %f in (..\sigc++\%d\macros\*.%x.m4) do @del %t\sigc++\%d\%~nf

MSVC_NMake/config-msvc.mak

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ LIBSIGC_DEBUG_SUFFIX = -d
1414
LIBSIGC_DEBUG_SUFFIX =
1515
!endif
1616

17+
!ifndef M4
18+
M4 = m4
19+
!endif
20+
1721
LIBSIGCPP_DEFINES = /DSIGC_BUILD /D_WINDLL
1822

19-
SIGCPP_BASE_CFLAGS = /I.. /I. /I..\untracked /I..\MSVC_NMake /wd4530 /EHsc $(CFLAGS)
23+
SIGCPP_BASE_CFLAGS = \
24+
/Ivs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp \
25+
/I..\untracked /I.. /I. \
26+
/wd4530 /EHsc $(CFLAGS)
2027

2128
LIBSIGC_INT_SOURCES = $(sigc_sources_cc:/=\)
2229
LIBSIGC_INT_HDRS = $(sigc_public_h:/=\)

MSVC_NMake/create-lists-msvc.mak

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,28 @@ NULL=
4747
!if [call create-lists.bat footer libsigcpp.mak]
4848
!endif
4949

50-
!if [call create-lists.bat header libsigcpp.mak libsigc_ex]
50+
!if [call create-lists.bat header libsigcpp.mak sigc_m4_srcdirs]
5151
!endif
5252

53-
!if [for %s in (..\examples\*.cc) do @call create-lists.bat file libsigcpp.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe]
53+
!if [for %d in (adaptors\lambda adaptors functors) do @call create-lists.bat file libsigcpp.mak %d]
5454
!endif
5555

5656
!if [call create-lists.bat footer libsigcpp.mak]
5757
!endif
5858

59-
!if [call create-lists.bat header libsigcpp.mak libsigc_tests]
59+
!if [call create-lists.bat header libsigcpp.mak libsigc_ex]
60+
!endif
61+
62+
!if [for %s in (..\examples\*.cc) do @call create-lists.bat file libsigcpp.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe]
63+
!endif
64+
65+
!if [call create-lists.bat footer libsigcpp.mak]
6066
!endif
6167

6268
# Skipping testutilities.cc: Not to be built as a .exe, but is a common dependency for the tests
6369
# benchmark: Not built on default; requires Boost
70+
!if [call create-lists.bat header libsigcpp.mak libsigc_tests]
71+
!endif
6472
!if [for %s in (..\tests\*.cc) do @if not "%~ns" == "testutilities" if not "%~ns" == "benchmark" @call create-lists.bat file libsigcpp.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe]
6573
!endif
6674

MSVC_NMake/generate-msvc.mak

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests:
1111

1212
# Create the versioned files
1313

14-
prep-git-build: pkg-ver.mak
14+
prep-git-build: pkg-ver.mak generate-sources
1515

1616
sigc.rc: pkg-ver.mak sigc.rc.in
1717
@echo Generating $@...
@@ -46,3 +46,10 @@ pkg-ver.mak: ..\configure.ac
4646
@pkg-ver.bat
4747
@del ver.txt pkg-ver.bat
4848
$(MAKE) /f Makefile.vc CFG=$(CFG) GENERATE_VERSIONED_FILES=1 sigc.rc sigc++config.h
49+
50+
generate-sources:
51+
@for %f in ($(base_built_cc) $(base_built_h)) do @if not exist ..\sigc++\%f if not exist ..\untracked\sigc++\%f if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\ md vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++
52+
@for %d in ($(sigc_m4_srcdirs)) do @for %x in (cc h) do @for %f in (..\sigc++\%d\macros\*.%x.m4) do @if not exist ..\sigc++\%d\%~nf if not exist ..\untracked\sigc++\%d\%~nf if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%d\ md vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%d
53+
@for %f in ($(base_built_cc) $(base_built_h)) do @if not exist ..\sigc++\%f if not exist ..\untracked\sigc++\%f if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%f @echo Generating vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%f... & $(M4) -I ../sigc++/macros ../sigc++/macros/%f.m4 >vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%f
54+
@for %d in ($(sigc_m4_srcdirs:adaptors\lambda=)) do @for %x in (cc h) do @for %f in (..\sigc++\%d\macros\*.%x.m4) do @if not exist ..\sigc++\%d\%~nf if not exist ..\untracked\sigc++\%d\%~nf if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%d\%~nf @echo Generating vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%d\%~nf... & $(M4) -I ../sigc++/%d/macros -I ../sigc++/macros ../sigc++/%d/macros/%~nxf >vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%d\%~nf
55+
@for %x in (cc h) do @for %f in (..\sigc++\adaptors\lambda\macros\*.%x.m4) do @if not exist ..\sigc++\adaptors\lambda\%~nf if not exist ..\untracked\sigc++\adaptors\lambda\%~nf if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\adaptors\lambda\%~nf @echo Generating vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\adaptors\lambda\%~nf... & $(M4) -I ../sigc++/adaptors/lambda/macros -I ../sigc++/macros ../sigc++/adaptors/lambda/macros/%~nxf >vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\adaptors\lambda\%~nf

MSVC_NMake/install.mak

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ install: all
77
@if not exist $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\lambda\ @md $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\lambda
88
@if not exist $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\functors\ @md $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\functors
99
@if not exist $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\tuple-utils\ @md $(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\tuple-utils
10-
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).dll $(PREFIX)\bin
11-
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).pdb $(PREFIX)\bin
12-
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib $(PREFIX)\lib
10+
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).dll "$(PREFIX)\bin"
11+
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).pdb "$(PREFIX)\bin"
12+
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib "$(PREFIX)\lib"
1313
@copy "..\sigc++\sigc++.h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\"
1414
@for %h in ($(LIBSIGC_INT_HDRS)) do @copy "..\sigc++\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\%h"
15-
@for %d in (sigc++ untracked\sigc++) do @(for %h in ($(base_built_h)) do @if exist ..\%d\%h copy "..\%d\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\%h")
16-
@for %d in (sigc++ untracked\sigc++) do @(for %h in ($(functors_built_h)) do @if exist ..\%d\functors\%h copy "..\%d\functors\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\functors\%h")
17-
@for %d in (sigc++ untracked\sigc++) do @(for %h in ($(adaptors_built_h)) do @if exist ..\%d\adaptors\%h copy "..\%d\adaptors\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\%h")
18-
@for %d in (sigc++ untracked\sigc++) do @(for %h in ($(lambda_built_h)) do @if exist ..\%d\adaptors\lambda\%h copy "..\%d\adaptors\lambda\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\lambda\%h")
15+
@for %d in (..\sigc++ ..\untracked\sigc++ vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++) do @(for %h in ($(base_built_h)) do @if exist %d\%h copy "%d\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\%h")
16+
@for %d in (..\sigc++ ..\untracked\sigc++ vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++) do @(for %h in ($(functors_built_h)) do @if exist %d\functors\%h copy "%d\functors\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\functors\%h")
17+
@for %d in (..\sigc++ ..\untracked\sigc++ vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++) do @(for %h in ($(adaptors_built_h)) do @if exist %d\adaptors\%h copy "%d\adaptors\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\%h")
18+
@for %d in (..\sigc++ ..\untracked\sigc++ vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++) do @(for %h in ($(lambda_built_h)) do @if exist %d\adaptors\lambda\%h copy "%d\adaptors\lambda\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\adaptors\lambda\%h")
1919
@if exist sigc++config.h copy "sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\"
2020
@if exist ..\untracked\MSVC_NMake\sigc++config.h copy "..\untracked\MSVC_NMake\sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy