[libgxps] nmake: build xpstopdf tool



commit 3f1d00d07b6ecb6072a309947aa877c11705223f
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date:   Wed Jan 4 09:55:16 2017 +0100

    nmake: build xpstopdf tool

 nmake/Makefile.vc           |    3 +-
 nmake/build-rules-msvc.mak  |   24 +++++++++++++++++++++-
 nmake/config-msvc.mak       |    5 +++-
 nmake/create-lists-msvc.mak |   23 +++++++++++++++++++++
 nmake/generate-msvc.mak     |    2 +-
 nmake/info-msvc.mak         |    4 +++
 nmake/install.mak           |    2 +
 tools/Makefile.am           |   41 +++++++------------------------------
 tools/Makefile.sources      |   46 +++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 113 insertions(+), 37 deletions(-)
---
diff --git a/nmake/Makefile.vc b/nmake/Makefile.vc
index 98e1a60..10fab47 100644
--- a/nmake/Makefile.vc
+++ b/nmake/Makefile.vc
@@ -11,6 +11,7 @@
 
 # Include the Makefile portions with the source listings
 !include ..\libgxps\Makefile.sources
+!include ..\tools\Makefile.sources
 
 # Include the Makefile portion that enables features based on user input
 !include config-msvc.mak
@@ -21,7 +22,7 @@
 # into the lists we need for compilation and introspection
 !include create-lists-msvc.mak
 
-all: $(GXPS_LIBS) $(EXTRA_TARGETS) all-build-info
+all: $(GXPS_LIBS) $(GXPS_TOOLS) $(EXTRA_TARGETS) all-build-info
 
 tests: all $(GXPS_TESTS)
 
diff --git a/nmake/build-rules-msvc.mak b/nmake/build-rules-msvc.mak
index 3b95565..18ba792 100644
--- a/nmake/build-rules-msvc.mak
+++ b/nmake/build-rules-msvc.mak
@@ -18,6 +18,16 @@
 $<
 <<
 
+{..\tools\}.c{$(CFG)\$(PLAT)\tools\}.obj::
+       $(CXX) $(CFLAGS) $(GXPS_DEFINES) $(GXPS_LIB_CFLAGS) /Fo$(CFG)\$(PLAT)\tools\ /c @<<
+$<
+<<
+
+{..\tools\}.c{$(CFG)\$(PLAT)\xpstopdf\}.obj::
+       $(CXX) $(CFLAGS) $(GXPS_DEFINES) /DCONVERTER_TYPE=GXPS_TYPE_PDF_CONVERTER 
/DCONVERTER_HEADER=gxps-pdf-converter.h $(GXPS_LIB_CFLAGS) /Fo$(CFG)\$(PLAT)\xpstopdf\ /c @<<
+$<
+<<
+
 # Inference rules for building the test programs
 # Used for programs with a single source file.
 # Format is as follows
@@ -44,6 +54,11 @@ $(gxps_dll_OBJS)
 <<
        @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
 
+$(CFG)\$(PLAT)\gxpstools.lib: $(CFG)\$(PLAT)\gxps.lib $(CFG)\$(PLAT)\tools $(gxps_tools_OBJS)
+       lib $(LDFLAGS_BASE) $(CFG)\$(PLAT)\gxps.lib -out:$@ @<<
+$(gxps_tools_OBJS)
+<<
+
 # Rules for linking Executables
 # Format is as follows (the mt command is needed for MSVC 2005/2008 builds):
 # $(dll_name_with_path): $(dependent_libs_files_objects_and_items)
@@ -51,7 +66,11 @@ $(gxps_dll_OBJS)
 # $(dependent_objects)
 # <<
 #      @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
-
+$(CFG)\$(PLAT)\xpstopdf.exe: $(CFG)\$(PLAT)\gxps.lib $(CFG)\$(PLAT)\gxpstools.lib $(CFG)\$(PLAT)\xpstopdf 
$(xpstopdf_OBJS)
+       link $(LDFLAGS) $(CFG)\$(PLAT)\gxps.lib $(CFG)\$(PLAT)\gxpstools.lib $(GXPS_DEP_LIBS) -out:$@ @<<
+$(xpstopdf_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
 
 # Other .obj files requiring individual attention, that could not be covered by the inference rules.
 # Format is as follows (all dirs must have a trailing '\'):
@@ -63,10 +82,13 @@ $(gxps_dll_OBJS)
 
 clean:
        @-del /f /q $(CFG)\$(PLAT)\*.pdb
+       @-if exist $(CFG)\$(PLAT)\.exe.manifest del /f /q $(CFG)\$(PLAT)\*.exe.manifest
+       @-if exist $(CFG)\$(PLAT)\.exe del /f /q $(CFG)\$(PLAT)\*.exe
        @-del /f /q $(CFG)\$(PLAT)\*.dll.manifest
        @-del /f /q $(CFG)\$(PLAT)\*.dll
        @-del /f /q $(CFG)\$(PLAT)\*.ilk
        @-del /f /q $(CFG)\$(PLAT)\*.obj
        @-del /f /q $(CFG)\$(PLAT)\gxps\*.obj
+       @-if exist $(CFG)\$(PLAT)\tools del /f /q $(CFG)\$(PLAT)\tools\*.obj
        @-rmdir /s /q $(CFG)\$(PLAT)
        @-del vc$(VSVER)0.pdb
diff --git a/nmake/config-msvc.mak b/nmake/config-msvc.mak
index f206e9d..3509670 100644
--- a/nmake/config-msvc.mak
+++ b/nmake/config-msvc.mak
@@ -28,12 +28,14 @@ GXPS_HEADERS = \
 GXPS_DEP_LIBS = user32.lib Advapi32.lib $(GXPS_MAIN_LIBS)
 
 # We build the GXPS DLL/LIB at least
-GXPS_LIBS = $(CFG)\$(PLAT)\gxps.lib
+GXPS_LIBS = $(CFG)\$(PLAT)\gxps.lib $(CFG)\$(PLAT)\gxpstools.lib
 
 # Note: All the utility and test programs require GLib support to be present!
 GXPS_TESTS =
 GXPS_TESTS_DEP_LIBS = $(GXPS_MAIN_LIBS)
 
+GXPS_TOOLS =
+
 # Use libtool-style DLL names, if desired
 !if "$(LIBTOOL_DLL_NAME)" == "1"
 GXPS_DLL_FILENAME = $(CFG)\$(PLAT)\libgxps-0
@@ -53,6 +55,7 @@ GXPS_CFLAGS = \
 # Enable cairo-pdf if desired
 !if "$(CAIRO_PDF)" == "1"
 GXPS_DEFINES = $(GXPS_DEFINES) /DHAVE_CAIRO_PDF=1
+GXPS_TOOLS = $(GXPS_TOOLS) $(CFG)\$(PLAT)\xpstopdf.exe
 !endif
 
 # Enable cairo-ps if desired
diff --git a/nmake/create-lists-msvc.mak b/nmake/create-lists-msvc.mak
index 6bd33e6..24b75ca 100644
--- a/nmake/create-lists-msvc.mak
+++ b/nmake/create-lists-msvc.mak
@@ -48,6 +48,29 @@ NULL=
 !if [del /f /q gxps_objs.mak]
 !endif
 
+# For gxpstools
+!if [call create-lists.bat header gxps_objs.mak gxps_tools_OBJS]
+!endif
+
+!if [for %c in ($(LIBGXPS_TOOLS_SOURCES)) do @if "%~xc" == ".c" @call create-lists.bat file gxps_objs.mak 
^$(CFG)\^$(PLAT)\tools\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer gxps_objs.mak]
+!endif
+
+# For xpstopdf
+!if "$(CAIRO_PDF)" == "1"
+
+!if [call create-lists.bat header gxps_objs.mak xpstopdf_OBJS]
+!endif
+
+!if [for %c in ($(XPS_TO_PDF_SOURCES)) do @if "%~xc" == ".c" @call create-lists.bat file gxps_objs.mak 
^$(CFG)\^$(PLAT)\xpstopdf\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer gxps_objs.mak]
+!endif
+!endif
+
 # Gather the list of headers
 !if [call create-lists.bat header gxps_srcs.mak GXPS_ACTUAL_HEADERS]
 !endif
diff --git a/nmake/generate-msvc.mak b/nmake/generate-msvc.mak
index ff18efb..0c42829 100644
--- a/nmake/generate-msvc.mak
+++ b/nmake/generate-msvc.mak
@@ -4,5 +4,5 @@
 # one is maintaining the NMake build files.
 
 # Create the build directories
-$(CFG)\$(PLAT)\gxps:
+$(CFG)\$(PLAT)\gxps $(CFG)\$(PLAT)\tools $(CFG)\$(PLAT)\xpstopdf:
        @-mkdir $@
diff --git a/nmake/info-msvc.mak b/nmake/info-msvc.mak
index 66b1bf5..0133e32 100644
--- a/nmake/info-msvc.mak
+++ b/nmake/info-msvc.mak
@@ -4,6 +4,10 @@ INC_FEATURES =
 BUILT_TOOLS =
 BUILT_LIBRARIES = GXPS
 
+!if "$(CAIRO_PDF)" == "1"
+BUILT_TOOLS = xpstopdf.exe $(BUILT_TOOLS)
+!endif
+
 build-info-gxps:
        @echo.
        @echo ==================================
diff --git a/nmake/install.mak b/nmake/install.mak
index 3cb24ad..e3a123d 100644
--- a/nmake/install.mak
+++ b/nmake/install.mak
@@ -8,4 +8,6 @@ install: all
        @copy /b $(GXPS_DLL_FILENAME).dll $(PREFIX)\bin
        @copy /b $(GXPS_DLL_FILENAME).pdb $(PREFIX)\bin
        @copy /b $(CFG)\$(PLAT)\gxps.lib $(PREFIX)\lib
+       @if exist $(CFG)\$(PLAT)\xpstopdf.exe copy /b $(CFG)\$(PLAT)\xpstopdf.exe $(PREFIX)\bin
+       @if exist $(CFG)\$(PLAT)\xpstopdf.exe copy /b $(CFG)\$(PLAT)\xpstopdf.pdb $(PREFIX)\bin
        @for %h in ($(GXPS_ACTUAL_HEADERS)) do @copy %h $(PREFIX)\include\libgxps
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 0bf1538..d6f971d 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,14 +1,8 @@
+include Makefile.sources
+
 noinst_LTLIBRARIES = libgxpstools.la
 
-libgxpstools_la_SOURCES = \
-       gxps-converter.c        \
-       gxps-converter.h        \
-       gxps-image-converter.c  \
-       gxps-image-converter.h  \
-       gxps-image-writer.c     \
-       gxps-image-writer.h     \
-       gxps-print-converter.c  \
-       gxps-print-converter.h
+libgxpstools_la_SOURCES = $(LIBGXPS_TOOLS_SOURCES)
 
 libgxpstools_la_CPPFLAGS = \
        -I$(top_srcdir)         \
@@ -36,12 +30,7 @@ tools_cflags = \
 if HAVE_LIBPNG
 bin_PROGRAMS += xpstopng
 
-xpstopng_SOURCES = \
-       gxps-converter-main.c   \
-       gxps-png-converter.c    \
-       gxps-png-converter.h    \
-       gxps-png-writer.c       \
-       gxps-png-writer.h
+xpstopng_SOURCES = $(XPS_TO_PNG_SOURCES)
 
 xpstopng_CPPFLAGS = \
        $(tools_cppflags)                               \
@@ -61,12 +50,7 @@ endif # HAVE_LIBPNG
 if HAVE_LIBJPEG
 bin_PROGRAMS += xpstojpeg
 
-xpstojpeg_SOURCES = \
-       gxps-converter-main.c   \
-       gxps-jpeg-converter.c   \
-       gxps-jpeg-converter.h   \
-       gxps-jpeg-writer.c      \
-       gxps-jpeg-writer.h
+xpstojpeg_SOURCES = $(XPS_TO_JPEG_SOURCES)
 
 xpstojpeg_CPPFLAGS = \
        $(tools_cppflags)                               \
@@ -85,10 +69,7 @@ endif # HAVE_LIBJPEG
 if HAVE_CAIRO_PDF
 bin_PROGRAMS += xpstopdf
 
-xpstopdf_SOURCES = \
-       gxps-converter-main.c   \
-       gxps-pdf-converter.c    \
-       gxps-pdf-converter.h
+xpstopdf_SOURCES = $(XPS_TO_PDF_SOURCES)
 
 xpstopdf_CPPFLAGS = \
        $(tools_cppflags)                               \
@@ -108,10 +89,7 @@ endif # HAVE_CAIRO_PDF
 if HAVE_CAIRO_PS
 bin_PROGRAMS += xpstops
 
-xpstops_SOURCES = \
-       gxps-converter-main.c   \
-       gxps-ps-converter.c     \
-       gxps-ps-converter.h
+xpstops_SOURCES = $(XPS_TO_PS_SOURCES)
 
 xpstops_CPPFLAGS = \
        $(tools_cppflags)                               \
@@ -131,10 +109,7 @@ endif # HAVE_CAIRO_PS
 if HAVE_CAIRO_SVG
 bin_PROGRAMS += xpstosvg
 
-xpstosvg_SOURCES = \
-       gxps-converter-main.c   \
-       gxps-svg-converter.c    \
-       gxps-svg-converter.h
+xpstosvg_SOURCES = $(XPS_TO_SVG_SOURCES)
 
 xpstosvg_CPPFLAGS = \
        $(tools_cppflags)                               \
diff --git a/tools/Makefile.sources b/tools/Makefile.sources
new file mode 100644
index 0000000..6f132d2
--- /dev/null
+++ b/tools/Makefile.sources
@@ -0,0 +1,46 @@
+NULL =
+
+LIBGXPS_TOOLS_SOURCES = \
+       gxps-converter.c        \
+       gxps-converter.h        \
+       gxps-image-converter.c  \
+       gxps-image-converter.h  \
+       gxps-image-writer.c     \
+       gxps-image-writer.h     \
+       gxps-print-converter.c  \
+       gxps-print-converter.h  \
+       $(NULL)
+
+XPS_TO_PNG_SOURCES = \
+       gxps-converter-main.c   \
+       gxps-png-converter.c    \
+       gxps-png-converter.h    \
+       gxps-png-writer.c       \
+       gxps-png-writer.h       \
+       $(NULL)
+
+XPS_TO_JPEG_SOURCES = \
+       gxps-converter-main.c   \
+       gxps-jpeg-converter.c   \
+       gxps-jpeg-converter.h   \
+       gxps-jpeg-writer.c      \
+       gxps-jpeg-writer.h      \
+       $(NULL)
+
+XPS_TO_PDF_SOURCES = \
+       gxps-converter-main.c   \
+       gxps-pdf-converter.c    \
+       gxps-pdf-converter.h    \
+       $(NULL)
+
+XPS_TO_PS_SOURCES = \
+       gxps-converter-main.c   \
+       gxps-ps-converter.c     \
+       gxps-ps-converter.h     \
+       $(NULL)
+
+XPS_TO_SVG_SOURCES = \
+       gxps-converter-main.c   \
+       gxps-svg-converter.c    \
+       gxps-svg-converter.h    \
+       $(NULL)


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