win32/generate-msvc.mak: Split up rule to regenerate demos.h.win32

This way, we can re-use items when we want to support generating project
files from the templates, such as building with project files directly
from a GIT checkout, or when we add sources and want to quickly add them
into the project files.
This commit is contained in:
Chun-wei Fan 2022-05-26 17:45:15 +08:00
parent 3292e9d67b
commit b58ba13a9e

View File

@ -58,6 +58,28 @@ GTK_GENERATED_SOURCES = \
.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-3\gtk\gtkresources.c \
$(GTK_VERSION_H)
GTK3_DEMO_VC1X_PROJS = \
vs10\$(DEMO_VS1X_PROJ) \
vs11\$(DEMO_VS1X_PROJ) \
vs12\$(DEMO_VS1X_PROJ) \
vs14\$(DEMO_VS1X_PROJ) \
vs15\$(DEMO_VS1X_PROJ) \
vs16\$(DEMO_VS1X_PROJ) \
vs17\$(DEMO_VS1X_PROJ)
GTK3_DEMO_VC1X_PROJ_FILTERS = \
vs11\$(DEMO_VS1X_PROJ_FILTERS) \
vs12\$(DEMO_VS1X_PROJ_FILTERS) \
vs14\$(DEMO_VS1X_PROJ_FILTERS) \
vs15\$(DEMO_VS1X_PROJ_FILTERS) \
vs16\$(DEMO_VS1X_PROJ_FILTERS) \
vs17\$(DEMO_VS1X_PROJ_FILTERS)
GTK3_DEMO_VCPROJS = \
vs9\$(DEMO_VS9_PROJ) \
$(GTK3_DEMO_VC1X_PROJS) \
$(GTK3_DEMO_VC1X_PROJ_FILTERS)
generate-base-sources: \
.\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gdk-3\config.h \
$(GDK_GENERATED_SOURCES) \
@ -264,41 +286,126 @@ generate-base-sources: \
@echo Generating $@...
@$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(@D) --generate-source $(@D)\iconbrowser.gresource.xml
regenerate-demos-h-win32: ..\demos\gtk-demo\geninclude.py $(demo_actual_sources)
@echo Regenerating demos.h.win32...
gtk3-demo.sourcefiles: $(demo_actual_sources)
@-del vs9\$(DEMO_VS9_PROJ)
@for %%s in ($**) do @echo. ^<File RelativePath^="..\%%s" /^>>>$@
@for %%s in (gtkfishbowl.c main.c) do @echo. ^<File RelativePath^="..\..\demos\gtk-demo\%%s" /^>>>$@
gtk3-demo.vs10.sourcefiles: $(demo_actual_sources)
@-del vs10\$(DEMO_VS1X_PROJ)
@for %%s in ($**) do @echo. ^<ClCompile Include^="..\%%s" /^>>>$@
@for %%s in (gtkfishbowl.c main.c) do @echo. ^<ClCompile Include^="..\..\demos\gtk-demo\%%s" /^>>>$@
gtk3-demo.vs10.sourcefiles.filters: $(demo_actual_sources)
@-del vs10\$(DEMO_VS1X_PROJ_FILTERS)
@for %%s in ($**) do @echo. ^<ClCompile Include^="..\%%s"^>^<Filter^>Source Files^</Filter^>^</ClCompile^>>>$@
@for %%s in (gtkfishbowl.c main.c) do @echo. ^<ClCompile Include^="..\..\demos\gtk-demo\%%s"^>^<Filter^>Source Files^</Filter^>^</ClCompile^>>>$@
vs9\$(DEMO_VS9_PROJ).pre: gtk3-demo.sourcefiles vs9\$(DEMO_VS9_PROJ)in
vs10\$(DEMO_VS1X_PROJ).pre: gtk3-demo.vs10.sourcefiles vs10\$(DEMO_VS1X_PROJ)in
vs10\$(DEMO_VS1X_PROJ_FILTERS): gtk3-demo.vs10.sourcefiles.filters vs10\$(DEMO_VS1X_PROJ_FILTERS)in
vs9\$(DEMO_VS9_PROJ).pre vs10\$(DEMO_VS1X_PROJ).pre vs10\$(DEMO_VS1X_PROJ_FILTERS):
@$(CPP) /nologo /EP /I. $(@:.pre=)in>$(@F:.pre=).tmp
@for /f "usebackq tokens=* delims=" %%l in ($(@F:.pre=).tmp) do @echo %%l>>$@
@-del $(@F:.pre=).tmp
@-if "$@" == "vs9\$(DEMO_VS9_PROJ).pre" del gtk3-demo.sourcefiles
@-if "$@" == "vs10\$(DEMO_VS1X_PROJ).pre" del gtk3-demo.vs10.sourcefiles
@-if "$@" == "vs10\$(DEMO_VS1X_PROJ_FILTERS)" del gtk3-demo.vs10.sourcefiles.filters
!ifdef FONT_FEATURES_DEMO
!ifdef FONT_FEATURES_USE_PANGOFT2
vs9\$(DEMO_VS9_PROJ): vs9\$(DEMO_VS9_PROJ).pre
@echo Generating $@...
@$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ \
--instring="AdditionalDependencies=\"\"" \
--outstring="AdditionalDependencies=\"$(DEMO_DEP_LIBS_PANGOFT2_VS9)\""
@-del $**
vs10\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ).pre
@echo Generating $@...
@$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ \
--instring=">%(AdditionalDependencies)<" \
--outstring=">$(DEMO_DEP_LIBS_PANGOFT2_VS1X);%(AdditionalDependencies)<"
@-del $**
!else
vs9\$(DEMO_VS9_PROJ): vs9\$(DEMO_VS9_PROJ).pre
@echo Generating $@...
@$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ \
--instring="AdditionalDependencies=\"\"" \
--outstring="AdditionalDependencies=\"$(DEMO_DEP_LIBS_NEW_PANGO)\""
@-del $**
vs10\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ).pre
@echo Generating $@...
@$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ \
--instring=">%(AdditionalDependencies)<" \
--outstring=">$(DEMO_DEP_LIBS_NEW_PANGO);%(AdditionalDependencies)<"
@-del $**
!endif
!else
vs9\$(DEMO_VS9_PROJ): vs9\$(DEMO_VS9_PROJ).pre
vs10\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ).pre
vs9\$(DEMO_VS9_PROJ) vs10\$(DEMO_VS1X_PROJ):
@echo Renaming $** to $@...
@move $** $@
!endif
vs11\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
vs12\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
vs14\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
vs15\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
vs16\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
vs17\$(DEMO_VS1X_PROJ): vs10\$(DEMO_VS1X_PROJ)
vs11\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
vs12\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
vs14\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
vs15\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
vs16\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
vs17\$(DEMO_VS1X_PROJ_FILTERS): vs10\$(DEMO_VS1X_PROJ_FILTERS)
vs11\$(DEMO_VS1X_PROJ):
@echo Copying and updating $** for VS2012
@$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v110<"
vs12\$(DEMO_VS1X_PROJ):
@echo Copying and updating $** for VS2013
@$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v120<"
vs14\$(DEMO_VS1X_PROJ):
@echo Copying and updating $** for VS2015
@$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v140<"
vs15\$(DEMO_VS1X_PROJ):
@echo Copying and updating $** for VS2017
@$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v141<"
vs16\$(DEMO_VS1X_PROJ):
@echo Copying and updating $** for VS2019
@$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v142<"
vs17\$(DEMO_VS1X_PROJ):
@echo Copying and updating $** for VS2022
@$(PYTHON) replace.py -a=replace-str -i=$** -o=$@ --instring=">v100<" --outstring=">v143<"
# VS2012+ .vcxproj.filters: We simply copy the VS2010 ones
vs11\$(DEMO_VS1X_PROJ_FILTERS) \
vs12\$(DEMO_VS1X_PROJ_FILTERS) \
vs14\$(DEMO_VS1X_PROJ_FILTERS) \
vs15\$(DEMO_VS1X_PROJ_FILTERS) \
vs16\$(DEMO_VS1X_PROJ_FILTERS) \
vs17\$(DEMO_VS1X_PROJ_FILTERS):
@echo Copying $** to $@...
@copy $** $@
regenerate-demos-h-win32: ..\demos\gtk-demo\geninclude.py $(demo_actual_sources) $(GTK3_DEMO_VCPROJS)
@echo Regenerating demos.h.win32 and gtk3-demo VS project files...
@-del ..\demos\gtk-demo\demos.h.win32
@cd ..\demos\gtk-demo
@$(PYTHON) geninclude.py demos.h.win32 $(demo_sources)
@cd ..\..\win32
@echo Regenerating gtk3-demo VS project files...
@-del vs9\$(DEMO_VS9_PROJ) vs10\$(DEMO_VS1X_PROJ) vs10\$(DEMO_VS1X_PROJ_FILTERS)
@for %%s in ($(demo_sources) gtkfishbowl.c main.c) do \
@echo. ^<File RelativePath^="..\..\demos\gtk-demo\%%s" /^>>>gtk3-demo.sourcefiles & \
@echo. ^<ClCompile Include^="..\..\demos\gtk-demo\%%s" /^>>>gtk3-demo.vs10.sourcefiles & \
@echo. ^<ClCompile Include^="..\..\demos\gtk-demo\%%s"^>^<Filter^>Source Files^</Filter^>^</ClCompile^>>>gtk3-demo.vs10.sourcefiles.filters
@$(CPP) /nologo /EP /I. vs9\$(DEMO_VS9_PROJ)in>$(DEMO_VS9_PROJ).tmp
@for /f "usebackq tokens=* delims=" %%l in ($(DEMO_VS9_PROJ).tmp) do @echo %%l>>$(DEMO_VS9_PROJ).tmp1
@$(CPP) /nologo /EP /I. vs10\$(DEMO_VS1X_PROJ)in>$(DEMO_VS1X_PROJ).tmp
@for /f "usebackq tokens=* delims=" %%l in ($(DEMO_VS1X_PROJ).tmp) do @echo %%l>>$(DEMO_VS1X_PROJ).tmp1
@$(CPP) /nologo /EP /I. vs10\$(DEMO_VS1X_PROJ_FILTERS)in> $(DEMO_VS1X_PROJ_FILTERS).tmp
@for /f "usebackq tokens=* delims=" %%l in ($(DEMO_VS1X_PROJ_FILTERS).tmp) do @ echo %%l>>vs10\$(DEMO_VS1X_PROJ_FILTERS)
@if not "$(FONT_FEATURES_DEMO)" == "" \
if not "$(FONT_FEATURES_USE_PANGOFT2)" == "" \
($(PYTHON) replace.py -a=replace-str -i=$(DEMO_VS9_PROJ).tmp1 -o=vs9\$(DEMO_VS9_PROJ) --instring="AdditionalDependencies=\"\"" --outstring="AdditionalDependencies=\"$(DEMO_DEP_LIBS_PANGOFT2_VS9)\"") & \
($(PYTHON) replace.py -a=replace-str -i=$(DEMO_VS1X_PROJ).tmp1 -o=vs10\$(DEMO_VS1X_PROJ) --instring=">%(AdditionalDependencies)<" --outstring=">$(DEMO_DEP_LIBS_PANGOFT2_VS1X);%(AdditionalDependencies)<")
@if not "$(FONT_FEATURES_DEMO)" == "" \
if "$(FONT_FEATURES_USE_PANGOFT2)" == "" \
($(PYTHON) replace.py -a=replace-str -i=$(DEMO_VS9_PROJ).tmp1 -o=vs9\$(DEMO_VS9_PROJ) --instring="AdditionalDependencies=\"\"" --outstring="AdditionalDependencies=\"$(DEMO_DEP_LIBS_NEW_PANGO)\"") & \
($(PYTHON) replace.py -a=replace-str -i=$(DEMO_VS1X_PROJ).tmp1 -o=vs10\$(DEMO_VS1X_PROJ) --instring=">%(AdditionalDependencies)<" --outstring=">$(DEMO_DEP_LIBS_NEW_PANGO);%(AdditionalDependencies)<")
@if "$(FONT_FEATURES_DEMO)" == "" copy $(DEMO_VS9_PROJ).tmp1 vs9\$(DEMO_VS9_PROJ) & copy $(DEMO_VS1X_PROJ).tmp1 vs10\$(DEMO_VS1X_PROJ)
@del *vc*proj*.tmp* gtk3-demo.*sourcefiles*
@for %%v in (11 12 14 15 16 17) do @(copy /y vs10\$(DEMO_VS1X_PROJ_FILTERS) vs%v\ & del vs%v\gtk3-demo.vcxproj)
@$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS1X_PROJ) -o=vs11\$(DEMO_VS1X_PROJ) --instring=">v100<" --outstring=">v110<"
@$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS1X_PROJ) -o=vs12\$(DEMO_VS1X_PROJ) --instring=">v100<" --outstring=">v120<"
@$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS1X_PROJ) -o=vs14\$(DEMO_VS1X_PROJ) --instring=">v100<" --outstring=">v140<"
@$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS1X_PROJ) -o=vs15\$(DEMO_VS1X_PROJ) --instring=">v100<" --outstring=">v141<"
@$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS1X_PROJ) -o=vs16\$(DEMO_VS1X_PROJ) --instring=">v100<" --outstring=">v142<"
@$(PYTHON) replace.py -a=replace-str -i=vs10\$(DEMO_VS1X_PROJ) -o=vs17\$(DEMO_VS1X_PROJ) --instring=">v100<" --outstring=">v143<"
# Remove the generated files
clean: