MSVC builds: Add a .bat script to regenerate demos.h.win32

This adds a batch script which in turn calls the geninclude.pl.in PERL
script in demos/gtk-demo to re-generate demos.h.win32 with or without
the font features demo program by whether the "font" argument is
specified.

Note that the extra space character just before the first set FONT_MSG
line is intentional.

The complete batch script is generated upon 'make dist' so that the demo
listings can be as updated as possible.
This commit is contained in:
Chun-wei Fan
2019-01-09 00:33:48 +08:00
parent 8183f333e6
commit cd4479fb01
3 changed files with 58 additions and 7 deletions

View File

@@ -1,7 +1,14 @@
include $(top_srcdir)/Makefile.decl
GENERATED_ITEMS = regenerate-demos-h-win32.bat
regenerate-demos-h-win32.bat: $(srcdir)/regenerate-demos-h-win32.batin demos.list
-$(RM) $@
$(CPP) -P - -traditional-cpp <$< >$@
$(RM) demos.list
if HAVE_INTROSPECTION
GENERATED_ITEMS = \
GENERATED_ITEMS += \
introspection.body.mak \
Gdk_3_0_gir_list \
GdkWin32_3_0_gir_list \
@@ -19,13 +26,10 @@ introspection.body.mak: $(MSVC_INTROSPECTION_INTERMEDIATE_FILES)
done
$(RM) $(MSVC_INTROSPECTION_INTERMEDIATE_FILES)
DISTCLEANFILES = $(GENERATED_ITEMS)
else
GENERATED_ITEMS =
DISTCLEANFILES =
endif
DISTCLEANFILES = $(GENERATED_ITEMS)
SUBDIRS = \
vs9 \
vs10 \
@@ -43,6 +47,7 @@ EXTRA_DIST += \
pc_base.py \
gtkpc.py \
README_EGL_MSVC.txt \
regenerate-demos-h-win32.batin \
$(GENERATED_ITEMS)
-include $(top_srcdir)/git.mk

View File

@@ -0,0 +1,35 @@
@echo off
set TARGET=demos.h.win32
set DEMOS= ^
#include "demos.list"
set FONT_MSG=without font features demo
if "%1" == "" goto continue
if not "%1" == "font" goto fail
set DEMOS=%DEMOS% font_features.c
set FONT_MSG=with font features demo
:continue
cd ..\..\demos\gtk-demo
if exist %TARGET% ren %TARGET% %TARGET%.bak
perl geninclude.pl.in %DEMOS% > %TARGET%
goto done_script
:fail
echo Only "font" is accepted as a argument to this batch script
goto end
:done_script
for %%T in (%TARGET%) do if exist %%T if %%~zT gtr 0 echo %%T is successfully regenerated %FONT_MSG%
for %%T in (%TARGET%) do if exist %%T if %%~zT equ 0 del %%T
if exist %TARGET% if exist %TARGET%.bak del %TARGET%.bak
if not exist %TARGET% echo %TARGET% is not regenerated, restoring existing %TARGET%
if not exist %TARGET% ren %TARGET%.bak %TARGET%
:end
cd ..\..\build\win32

View File

@@ -211,9 +211,20 @@ gtk3_demo_application_EXCLUDES = dummy
include $(top_srcdir)/build/Makefile.msvcproj
$(top_builddir)/build/win32/demos.list: Makefile
-$(RM) $@
for F in $(demos_base); do \
case $$F in \
*.c) \
echo $$F' ^'>>$(top_builddir)/build/win32/demos.list \
;; \
esac \
done
dist-hook: \
$(top_builddir)/build/win32/vs9/gtk3-demo.vcproj \
$(top_builddir)/build/win32/vs9/gtk3-demo-application.vcproj
$(top_builddir)/build/win32/vs9/gtk3-demo-application.vcproj \
$(top_builddir)/build/win32/demos.list
DISTCLEANFILES = demos.h demos.h.win32 $(extra_nodist_demo_sources)