diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-06-17 18:06:53 +0800 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2020-06-18 11:07:13 +0200 |
commit | 61c515a3a1c02b08a0c66374f2d04293f6cb5c4d (patch) | |
tree | 170c693431c1a7c695c91217478ce406ed4d1758 | |
parent | ace4489cbda424e6e831dc27f507bdb0a10266a4 (diff) | |
download | sigc++-61c515a3a1c02b08a0c66374f2d04293f6cb5c4d.tar.gz |
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
-rw-r--r-- | MSVC_NMake/README.txt | 22 | ||||
-rw-r--r-- | MSVC_NMake/build-rules-msvc.mak | 18 | ||||
-rw-r--r-- | MSVC_NMake/config-msvc.mak | 9 | ||||
-rw-r--r-- | MSVC_NMake/create-lists-msvc.mak | 14 | ||||
-rw-r--r-- | MSVC_NMake/generate-msvc.mak | 9 | ||||
-rw-r--r-- | MSVC_NMake/install.mak | 14 |
6 files changed, 70 insertions, 16 deletions
diff --git a/MSVC_NMake/README.txt b/MSVC_NMake/README.txt index bb0281c..588fe77 100644 --- a/MSVC_NMake/README.txt +++ b/MSVC_NMake/README.txt @@ -15,12 +15,28 @@ targets: -all (or no target specified): The libsigc++ DLL and the example programs.
-test: The libsigc++ DLL and the test programs.
-benchmark: The libsigc++ DLL and the benchmark program.
+-prep-git-build: Prepare to build directly from a GIT checkout. You must
+ run this target before any other targets at least once if you
+ are building from a GIT checkout or from a Meson-generated
+ tarball. If you are building from a GIT checkout, you must
+ run this before any other targets whenever you change
+ configuration, target architecture or toolset version. You
+ will at least need PERL for this, and m4 if building from a
+ GIT checkout or when building after running the 'forceclean'
+ target.
The following are instructions for performing such a build. A 'clean' target is
provided-it is recommended that one cleans the build and redo the build if any
-configuration option changed. An
-'install' target is also provided to copy the built items in their appropriate
-locations under $(PREFIX), which is described below.
+configuration option changed. An 'install' target is provided to copy the
+built items in their appropriate locations under $(PREFIX), which is described below.
+
+A 'forceclean' target is also provided to cover the actions under the target 'clean',
+but also to remove any traces of the headers and sources that were generated. This
+may be useful if one wants to re-generate the sources and headers from the m4 templates.
+
+If you do get errors during the build such as U1073 when building lambda.obj, or
+if you have header conflicts or missing headers, ensure that you run the 'prep-git-build'
+target first.
Invoke the build by issuing the command:
nmake /f Makefile.vc CFG=[release|debug] [PREFIX=...] <option1=1 option2=1 ...>
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak index b86c239..c2b13d7 100644 --- a/MSVC_NMake/build-rules-msvc.mak +++ b/MSVC_NMake/build-rules-msvc.mak @@ -14,21 +14,30 @@ # $< # << {..\sigc++\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj: + @if not exist $(@D)\ md $(@D) $(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<< $< << {..\sigc++\adaptors\lambda\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj: + @if not exist $(@D)\ md $(@D) $(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<< $< << {..\sigc++\functors\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj: + @if not exist $(@D)\ md $(@D) $(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<< $< << {..\untracked\sigc++\adaptors\lambda\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj: + @if not exist $(@D)\ md $(@D) + $(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<< +$< +<< + +{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\adaptors\lambda\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\}.obj: $(CXX) $(LIBSIGCPP_CFLAGS) /Fo$(@D)\ /Fd$(@D)\ /c @<< $< << @@ -51,7 +60,7 @@ $(LIBSIGC_LIB): $(LIBSIGC_DLL) # $(dependent_objects) # << # @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2 -$(LIBSIGC_DLL): vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp $(libsigcpp_dll_OBJS) +$(LIBSIGC_DLL): $(libsigcpp_dll_OBJS) link /DLL $(LDFLAGS) /implib:$(LIBSIGC_LIB) -out:$@ @<< $(libsigcpp_dll_OBJS) << @@ -99,4 +108,11 @@ clean: @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\*.pdb @-if exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests @-rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-ex + @-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 + @-for %x in (cc h) do @if exist vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\ del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\*.%x + @-for %d in ($(sigc_m4_srcdirs)) do @rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++\%d + @-rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp\sigc++ @-rd vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp + +forceclean: clean + @-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 diff --git a/MSVC_NMake/config-msvc.mak b/MSVC_NMake/config-msvc.mak index 9dc7e11..6e0065d 100644 --- a/MSVC_NMake/config-msvc.mak +++ b/MSVC_NMake/config-msvc.mak @@ -14,9 +14,16 @@ LIBSIGC_DEBUG_SUFFIX = -d LIBSIGC_DEBUG_SUFFIX = !endif +!ifndef M4 +M4 = m4 +!endif + LIBSIGCPP_DEFINES = /DSIGC_BUILD /D_WINDLL -SIGCPP_BASE_CFLAGS = /I.. /I. /I..\untracked /I..\MSVC_NMake /wd4530 /EHsc $(CFLAGS) +SIGCPP_BASE_CFLAGS = \ + /Ivs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp \ + /I..\untracked /I.. /I. \ + /wd4530 /EHsc $(CFLAGS) LIBSIGC_INT_SOURCES = $(sigc_sources_cc:/=\) LIBSIGC_INT_HDRS = $(sigc_public_h:/=\) diff --git a/MSVC_NMake/create-lists-msvc.mak b/MSVC_NMake/create-lists-msvc.mak index e1efb49..33e339f 100644 --- a/MSVC_NMake/create-lists-msvc.mak +++ b/MSVC_NMake/create-lists-msvc.mak @@ -47,20 +47,28 @@ NULL= !if [call create-lists.bat footer libsigcpp.mak] !endif -!if [call create-lists.bat header libsigcpp.mak libsigc_ex] +!if [call create-lists.bat header libsigcpp.mak sigc_m4_srcdirs] !endif -!if [for %s in (..\examples\*.cc) do @call create-lists.bat file libsigcpp.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe] +!if [for %d in (adaptors\lambda adaptors functors) do @call create-lists.bat file libsigcpp.mak %d] !endif !if [call create-lists.bat footer libsigcpp.mak] !endif -!if [call create-lists.bat header libsigcpp.mak libsigc_tests] +!if [call create-lists.bat header libsigcpp.mak libsigc_ex] +!endif + +!if [for %s in (..\examples\*.cc) do @call create-lists.bat file libsigcpp.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\%~ns.exe] +!endif + +!if [call create-lists.bat footer libsigcpp.mak] !endif # Skipping testutilities.cc: Not to be built as a .exe, but is a common dependency for the tests # benchmark: Not built on default; requires Boost +!if [call create-lists.bat header libsigcpp.mak libsigc_tests] +!endif !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] !endif diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak index 8084e0a..801bd3c 100644 --- a/MSVC_NMake/generate-msvc.mak +++ b/MSVC_NMake/generate-msvc.mak @@ -11,7 +11,7 @@ vs$(VSVER)\$(CFG)\$(PLAT)\libsigcpp-tests: # Create the versioned files -prep-git-build: pkg-ver.mak +prep-git-build: pkg-ver.mak generate-sources sigc.rc: pkg-ver.mak sigc.rc.in @echo Generating $@... @@ -46,3 +46,10 @@ pkg-ver.mak: ..\configure.ac @pkg-ver.bat @del ver.txt pkg-ver.bat $(MAKE) /f Makefile.vc CFG=$(CFG) GENERATE_VERSIONED_FILES=1 sigc.rc sigc++config.h + +generate-sources: + @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++ + @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 + @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 + @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 + @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 diff --git a/MSVC_NMake/install.mak b/MSVC_NMake/install.mak index 22de7b4..a5f2d84 100644 --- a/MSVC_NMake/install.mak +++ b/MSVC_NMake/install.mak @@ -7,14 +7,14 @@ install: all @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 @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 @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 - @copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).dll $(PREFIX)\bin - @copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).pdb $(PREFIX)\bin - @copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib $(PREFIX)\lib + @copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).dll "$(PREFIX)\bin" + @copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).pdb "$(PREFIX)\bin" + @copy /b vs$(VSVER)\$(CFG)\$(PLAT)\$(LIBSIGC_LIBNAME).lib "$(PREFIX)\lib" @copy "..\sigc++\sigc++.h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\" @for %h in ($(LIBSIGC_INT_HDRS)) do @copy "..\sigc++\%h" "$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\sigc++\%h" - @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") - @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") - @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") - @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") + @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") + @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") + @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") + @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") @if exist sigc++config.h copy "sigc++config.h" "$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include\" @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\" |