[gtk/wip/fanc999/fontchooser.win32.gtk3: 2/3] MSVC builds: Add a .bat script to regenerate demos.h.win32



commit 2d94c8f09a371fdd1c5135bb4ae5a4c25ea8797f
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Jan 9 00:33:48 2019 +0800

    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.
    
    The complete batch script is generated upon 'make dist' so that the demo
    listings can be as updated as possible.

 build/win32/Makefile.am                    | 17 ++++++++++-----
 build/win32/regenerate-demos-h-win32.batin | 35 ++++++++++++++++++++++++++++++
 demos/gtk-demo/Makefile.am                 | 13 ++++++++++-
 3 files changed, 58 insertions(+), 7 deletions(-)
---
diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am
index e47c8c411e..198ff4aff2 100644
--- a/build/win32/Makefile.am
+++ b/build/win32/Makefile.am
@@ -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
diff --git a/build/win32/regenerate-demos-h-win32.batin b/build/win32/regenerate-demos-h-win32.batin
new file mode 100644
index 0000000000..258e430950
--- /dev/null
+++ b/build/win32/regenerate-demos-h-win32.batin
@@ -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
+
diff --git a/demos/gtk-demo/Makefile.am b/demos/gtk-demo/Makefile.am
index edec751e10..4683a29b58 100644
--- a/demos/gtk-demo/Makefile.am
+++ b/demos/gtk-demo/Makefile.am
@@ -209,9 +209,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)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]