xref: /plan9/sys/src/cmd/gs/src/winint.mak (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1#    Copyright (C) 1997, 2003 Aladdin Enterprises.  All rights reserved.
2#
3# This software is provided AS-IS with no warranty, either express or
4# implied.
5#
6# This software is distributed under license and may not be copied,
7# modified or distributed except as expressly authorized under the terms
8# of the license contained in the file LICENSE in this distribution.
9#
10# For more information about licensing, please refer to
11# http://www.ghostscript.com/licensing/. For information on
12# commercial licensing, go to http://www.artifex.com/licensing/ or
13# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14# San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
16# $Id: winint.mak,v 1.26 2005/04/12 22:05:40 giles Exp $
17# Common interpreter makefile section for 32-bit MS Windows.
18
19# This makefile must be acceptable to Microsoft Visual C++, Watcom C++,
20# and Borland C++.  For this reason, the only conditional directives
21# allowed are !if[n]def, !else, and !endif.
22
23
24# Include the generic makefile.
25!include $(PSSRCDIR)\int.mak
26!include $(PSSRCDIR)\cfonts.mak
27
28# Define the C++ compiler invocation for library modules.
29GLCPP=$(CPP) $(CO) $(I_)$(GLI_)$(_I)
30
31# Define the compilation rule for Windows interpreter code.
32# This requires PS*_ to be defined, so it has to come after int.mak.
33PSCCWIN=$(CC_WX) $(CCWINFLAGS) $(I_)$(PSI_)$(_I) $(PSF_)
34
35# Define the name of this makefile.
36WININT_MAK=$(PSSRC)winint.mak
37
38# Define the location of the WinZip self-extracting-archive-maker.
39!ifndef WINZIPSE_XE
40!ifdef WIN64
41WINZIPSE_XE="C:\Program Files (x86)\WinZip Self-Extractor\WZIPSE32.EXE"
42!else
43WINZIPSE_XE="C:\Program Files\WinZip Self-Extractor\WZIPSE32.EXE"
44!endif
45!endif
46
47# Define the name and location of the zip archive maker.
48!ifndef ZIP_XE
49ZIP_XE="zip.exe" -X
50!endif
51
52# Define the setup and install programs, which are only suitable
53# for the DLL build.
54# If MAKEDLL==0, these names are never referenced.
55!ifndef SETUP_XE_NAME
56SETUP_XE_NAME=setupgs.exe
57!endif
58!ifndef SETUP_XE
59SETUP_XE=$(BINDIR)\$(SETUP_XE_NAME)
60!endif
61!ifndef UNINSTALL_XE_NAME
62UNINSTALL_XE_NAME=uninstgs.exe
63!endif
64!ifndef UNINSTALL_XE
65UNINSTALL_XE=$(BINDIR)\$(UNINSTALL_XE_NAME)
66!endif
67
68# Define the RCOMP switch for including INCDIR.
69!if "$(INCDIR)"==""
70i_INCDIR=
71!else
72i_INCDIR=-i$(INCDIR)
73!endif
74
75
76# ----------------------------- Main program ------------------------------ #
77
78ICONS=$(GLGEN)gswin.ico $(GLGEN)gswin16.ico
79
80GS_ALL=$(INT_ALL) $(INTASM)\
81  $(LIB_ALL) $(LIBCTR) $(ld_tr) $(GSDLL_OBJ).res $(PSSRC)$(GSDLL).def $(ICONS)
82
83dwdll_h=$(PSSRC)dwdll.h
84dwimg_h=$(GLSRC)dwimg.h
85dwtrace_h=$(GLSRC)dwtrace.h
86dwmain_h=$(PSSRC)dwmain.h
87dwtext_h=$(GLSRC)dwtext.h
88dwreg_h=$(GLSRC)dwreg.h
89
90# Make the icons from their text form.
91
92$(GLGEN)gswin.ico: $(GLSRC)gswin.icx $(ECHOGS_XE) $(WININT_MAK)
93	$(ECHOGS_XE) -wb $(GLGEN)gswin.ico -n -X -r $(GLSRC)gswin.icx
94
95$(GLGEN)gswin16.ico: $(GLSRC)gswin16.icx $(ECHOGS_XE) $(WININT_MAK)
96	$(ECHOGS_XE) -wb $(GLGEN)gswin16.ico -n -X -r $(GLSRC)gswin16.icx
97
98# resources for short EXE loader (no dialogs)
99$(GS_OBJ).res: $(PSSRC)dwmain.rc $(dwmain_h) $(ICONS) $(WININT_MAK)
100	$(ECHOGS_XE) -w $(PSGEN)_exe.rc -x 23 define -s gstext_ico $(GLGENDIR)\gswin.ico
101	$(ECHOGS_XE) -a $(PSGEN)_exe.rc -x 23 define -s gsgraph_ico $(GLGENDIR)\gswin.ico
102	$(ECHOGS_XE) -a $(PSGEN)_exe.rc -R $(PSSRC)dwmain.rc
103	$(RCOMP) -i$(PSSRCDIR) -i$(PSGENDIR) $(i_INCDIR) -r $(RO_)$(GS_OBJ).res $(PSGEN)_exe.rc
104	del $(PSGEN)_exe.rc
105
106# resources for main program (includes dialogs)
107$(GSDLL_OBJ).res: $(PSSRC)gsdll32.rc $(gp_mswin_h) $(ICONS) $(WININT_MAK)
108	$(ECHOGS_XE) -w $(PSGEN)_dll.rc -x 23 define -s gstext_ico $(GLGENDIR)\gswin.ico
109	$(ECHOGS_XE) -a $(PSGEN)_dll.rc -x 23 define -s gsgraph_ico $(GLGENDIR)\gswin.ico
110	$(ECHOGS_XE) -a $(PSGEN)_dll.rc -R $(PSSRC)gsdll32.rc
111	$(RCOMP) -i$(PSSRCDIR) -i$(PSGENDIR) -i$(GLSRCDIR) $(i_INCDIR) -r $(RO_)$(GSDLL_OBJ).res $(PSGEN)_dll.rc
112	del $(PSGEN)_dll.rc
113
114
115# Modules for big EXE
116
117!if $(DEBUG)
118DWTRACE=$(GLOBJ)dwtrace.obj
119!else
120DWTRACE=
121!endif
122
123
124DWOBJNO = $(PSOBJ)dwnodll.obj $(GLOBJ)dwimg.obj $(DWTRACE) $(PSOBJ)dwmain.obj \
125$(GLOBJ)dwtext.obj $(GLOBJ)dwreg.obj
126
127$(PSOBJ)dwnodll.obj: $(PSSRC)dwnodll.c $(AK)\
128 $(dwdll_h) $(iapi_h)
129	$(PSCCWIN) $(COMPILE_FOR_EXE) $(PSO_)dwnodll.obj $(C_) $(PSSRC)dwnodll.c
130
131# Compile gsdll.c, the main program of the DLL.
132
133$(PSOBJ)gsdll.obj: $(PSSRC)gsdll.c $(AK) $(iapi_h) $(ghost_h)
134	$(PSCCWIN) $(COMPILE_FOR_DLL) $(PSO_)gsdll.$(OBJ) $(C_) $(PSSRC)gsdll.c
135
136$(GLOBJ)gp_msdll.obj: $(GLSRC)gp_msdll.c $(AK) $(iapi_h)
137	$(PSCCWIN) $(COMPILE_FOR_DLL) $(GLO_)gp_msdll.$(OBJ) $(C_) $(GLSRC)gp_msdll.c
138
139# Modules for console mode EXEs
140
141OBJC=$(PSOBJ)dwmainc.obj $(PSOBJ)dwdllc.obj $(GLOBJ)gscdefs.obj $(GLOBJ)gp_wgetv.obj \
142$(GLOBJ)dwimg.obj $(DWTRACE) $(GLOBJ)dwreg.obj
143
144OBJCNO=$(PSOBJ)dwmainc.obj $(PSOBJ)dwnodllc.obj $(GLOBJ)dwimg.obj $(DWTRACE) $(GLOBJ)dwreg.obj
145
146$(PSOBJ)dwmainc.obj: $(PSSRC)dwmainc.c $(AK) $(windows__h) $(fcntl__h) $(unistd__h) \
147  $(iapi_h) $(vdtrace_h) $(gdevdsp_h) $(dwdll_h) $(dwimg_h) $(dwtrace_h)
148	$(PSCCWIN) $(COMPILE_FOR_CONSOLE_EXE) $(PSO_)dwmainc.obj $(C_) $(PSSRC)dwmainc.c
149
150$(PSOBJ)dwdllc.obj: $(PSSRC)dwdll.c $(AK) $(dwdll_h) $(iapi_h)
151	$(PSCCWIN) $(COMPILE_FOR_CONSOLE_EXE) $(PSO_)dwdllc.obj $(C_) $(PSSRC)dwdll.c
152
153$(PSOBJ)dwnodllc.obj: $(PSSRC)dwnodll.c $(AK) $(dwdll_h) $(iapi_h)
154	$(PSCCWIN) $(COMPILE_FOR_CONSOLE_EXE) $(PSO_)dwnodllc.obj $(C_) $(PSSRC)dwnodll.c
155
156
157# Modules for small EXE loader.
158
159DWOBJ=$(PSOBJ)dwdll.obj $(GLOBJ)dwimg.obj $(DWTRACE) $(PSOBJ)dwmain.obj \
160$(GLOBJ)dwtext.obj $(GLOBJ)gscdefs.obj $(GLOBJ)gp_wgetv.obj $(GLOBJ)dwreg.obj
161
162$(PSOBJ)dwdll.obj: $(PSSRC)dwdll.c $(AK)\
163 $(dwdll_h) $(iapi_h)
164	$(PSCCWIN) $(COMPILE_FOR_EXE) $(PSO_)dwdll.obj $(C_) $(PSSRC)dwdll.c
165
166$(GLOBJ)dwimg.obj: $(GLSRC)dwimg.c $(AK)\
167 $(dwmain_h) $(dwdll_h) $(dwtext_h) $(dwimg_h) $(gdevdsp_h) $(stdio__h) \
168 $(gscdefs_h) $(iapi_h) $(dwreg_h)
169	$(GLCPP) $(COMPILE_FOR_EXE) $(GLO_)dwimg.obj $(C_) $(GLSRC)dwimg.c
170
171$(GLOBJ)dwtrace.obj: $(GLSRC)dwtrace.c $(AK)\
172 $(dwimg_h) $(dwtrace_h)\
173 $(gscdefs_h) $(stdpre_h) $(gsdll_h) $(vdtrace_h)
174	$(GLCPP) $(COMPILE_FOR_EXE) $(GLO_)dwtrace.obj $(C_) $(GLSRC)dwtrace.c
175
176$(PSOBJ)dwmain.obj: $(PSSRC)dwmain.c $(AK)  $(windows__h) \
177 $(iapi_h) $(vdtrace_h) $(dwmain_h) $(dwdll_h) $(dwtext_h) $(dwimg_h) $(dwtrace_h) \
178 $(dwreg_h) $(gdevdsp_h)
179	$(PSCCWIN) $(COMPILE_FOR_EXE) $(PSO_)dwmain.obj $(C_) $(PSSRC)dwmain.c
180
181$(GLOBJ)dwtext.obj: $(GLSRC)dwtext.c $(AK) $(dwtext_h)
182	$(GLCPP) $(COMPILE_FOR_EXE) $(GLO_)dwtext.obj $(C_) $(GLSRC)dwtext.c
183
184$(GLOBJ)dwreg.obj: $(PSSRC)dwreg.c $(AK) $(dwreg_h)
185	$(GLCPP) $(COMPILE_FOR_EXE) $(GLO_)dwreg.obj $(C_) $(GLSRC)dwreg.c
186
187
188# ---------------------- Setup and uninstall program ---------------------- #
189
190
191# Modules for setup program
192# These modules shouldn't be referenced if MAKEDDLL==0,but dependencies here
193# don't hurt.
194
195$(PSOBJ)dwsetup.res: $(PSSRC)dwsetup.rc $(PSSRC)dwsetup.h $(GLGEN)gswin.ico
196	$(RCOMP) -i$(PSSRCDIR) -i$(PSGENDIR) -i$(PSOBJDIR) $(i_INCDIR) -r $(RO_)$(PSOBJ)dwsetup.res $(PSSRC)dwsetup.rc
197
198$(PSOBJ)dwsetup.obj: $(PSSRC)dwsetup.cpp $(PSSRC)dwsetup.h $(PSSRC)dwinst.h
199	$(PSCCWIN) $(COMPILE_FOR_EXE) $(PSO_)dwsetup.obj $(C_) $(PSSRC)dwsetup.cpp
200
201$(PSOBJ)dwinst.obj: $(PSSRC)dwinst.cpp $(PSSRC)dwinst.h
202	$(PSCCWIN) $(COMPILE_FOR_EXE) $(PSO_)dwinst.obj $(C_) $(PSSRC)dwinst.cpp
203
204# Modules for uninstall program
205
206$(PSOBJ)dwuninst.res: $(PSSRC)dwuninst.rc $(PSSRC)dwuninst.h $(GLGEN)gswin.ico
207	$(RCOMP) -i$(PSSRCDIR) -i$(PSGENDIR) -i$(PSOBJDIR) $(i_INCDIR) -r $(RO_)$(PSOBJ)dwuninst.res $(PSSRC)dwuninst.rc
208
209$(PSOBJ)dwuninst.obj: $(PSSRC)dwuninst.cpp $(PSSRC)dwuninst.h
210	$(PSCCWIN) $(COMPILE_FOR_EXE) $(PSO_)dwuninst.obj $(C_) $(PSSRC)dwuninst.cpp
211
212
213# ------------------------- Distribution archive -------------------------- #
214
215# The following section of this makefile was developed by, and is maintained
216# by, the developer of GSview.  If you have any questions about it, please
217# contact bug-gswin@ghostscript.com.
218
219# Create a self-extracting archive with setup program.
220# This assumes that the current directory is named gs#.## relative to its
221# parent, where #.## is the Ghostscript version, and that the files and
222# directories listed in ZIPTEMPFILE and ZIPFONTFILES are the complete list
223# of needed files and directories relative to the current directory's parent.
224
225ZIPTEMPFILE=gs$(GS_DOT_VERSION)\obj\dwfiles.rsp
226ZIPPROGFILE1=gs$(GS_DOT_VERSION)\bin\gsdll32.dll
227ZIPPROGFILE2=gs$(GS_DOT_VERSION)\bin\gsdll32.lib
228ZIPPROGFILE3=gs$(GS_DOT_VERSION)\bin\gswin32.exe
229ZIPPROGFILE4=gs$(GS_DOT_VERSION)\bin\gswin32c.exe
230ZIPPROGFILE5=gs$(GS_DOT_VERSION)\bin\gs16spl.exe
231ZIPPROGFILE6=gs$(GS_DOT_VERSION)\doc
232ZIPPROGFILE7=gs$(GS_DOT_VERSION)\examples
233ZIPPROGFILE8=gs$(GS_DOT_VERSION)\lib
234ZIPPROGFILE9=gs$(GS_DOT_VERSION)\Resource
235ZIPFONTDIR=fonts
236ZIPFONTFILES=$(ZIPFONTDIR)\*.*
237
238# Make the zip archive.
239FILELIST_TXT=filelist.txt
240FONTLIST_TXT=fontlist.txt
241!ifdef WIN64
242ZIPTARGET=gs$(GS_VERSION)w64
243!else
244ZIPTARGET=gs$(GS_VERSION)w32
245!endif
246zip: $(SETUP_XE) $(UNINSTALL_XE)
247	cd ..
248	copy gs$(GS_DOT_VERSION)\$(SETUP_XE) .
249	copy gs$(GS_DOT_VERSION)\$(UNINSTALL_XE) .
250	echo $(ZIPPROGFILE1) >  $(ZIPTEMPFILE)
251	echo $(ZIPPROGFILE2) >> $(ZIPTEMPFILE)
252	echo $(ZIPPROGFILE3) >> $(ZIPTEMPFILE)
253	echo $(ZIPPROGFILE4) >> $(ZIPTEMPFILE)
254	echo $(ZIPPROGFILE5) >> $(ZIPTEMPFILE)
255	echo $(ZIPPROGFILE6) >> $(ZIPTEMPFILE)
256	echo $(ZIPPROGFILE7) >> $(ZIPTEMPFILE)
257	echo $(ZIPPROGFILE8) >> $(ZIPTEMPFILE)
258	echo $(ZIPPROGFILE9) >> $(ZIPTEMPFILE)
259	$(SETUP_XE_NAME) -title "AFPL Ghostscript $(GS_DOT_VERSION)" -dir "gs$(GS_DOT_VERSION)" -list "$(FILELIST_TXT)" @$(ZIPTEMPFILE)
260	$(SETUP_XE_NAME) -title "AFPL Ghostscript Fonts" -dir "fonts" -list "$(FONTLIST_TXT)" $(ZIPFONTFILES)
261	-del $(ZIPTARGET).zip
262	$(ZIP_XE) -9 $(ZIPTARGET).zip $(SETUP_XE_NAME) $(UNINSTALL_XE_NAME) $(FILELIST_TXT) $(FONTLIST_TXT)
263	$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPFONTDIR)
264	$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE1)
265	$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE2)
266	$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE3)
267	$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE4)
268	rem
269	rem	Don't flag error if Win32s spooler file is missing.
270	rem	This occurs when using MSVC++.
271	rem
272	-$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE5)
273	$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE6)
274	$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE7)
275	$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE8)
276	$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE9)
277	-del $(ZIPTEMPFILE)
278	-del $(SETUP_XE_NAME)
279	-del $(UNINSTALL_XE_NAME)
280	-del $(FILELIST_TXT)
281	-del $(FONTLIST_TXT)
282	cd gs$(GS_DOT_VERSION)
283
284# Now convert to a self extracting archive.
285# This involves making a few temporary files.
286ZIP_RSP = $(PSOBJ)setupgs.rsp
287# Note that we use ECHOGS_XE rather than echo for the .txt files
288# to avoid ANSI/OEM character mapping.
289# Use a special icon WinZip SE can't handle 48 pixel 32-bit icons
290# as used by Windows XP.
291archive: zip $(PSOBJ)gswin16.ico $(ECHOGS_XE)
292	$(ECHOGS_XE) -w $(ZIP_RSP) -q "-win32 -setup"
293	$(ECHOGS_XE) -a $(ZIP_RSP) -q -st -x 22 AFPL Ghostscript $(GS_DOT_VERSION) for Win32 -x 22
294	$(ECHOGS_XE) -a $(ZIP_RSP) -q -i -s $(PSOBJ)gswin16.ico
295	$(ECHOGS_XE) -a $(ZIP_RSP) -q -a -s $(PSOBJ)about.txt
296	$(ECHOGS_XE) -a $(ZIP_RSP) -q -t -s $(PSOBJ)dialog.txt
297	$(ECHOGS_XE) -a $(ZIP_RSP) -q -c -s $(SETUP_XE_NAME)
298	$(ECHOGS_XE) -w $(PSOBJ)about.txt "AFPL Ghostscript is Copyright " -x A9 " 2005 artofcode LLC."
299	$(ECHOGS_XE) -a $(PSOBJ)about.txt See license in gs$(GS_DOT_VERSION)\doc\Public.htm.
300	$(ECHOGS_XE) -a $(PSOBJ)about.txt See gs$(GS_DOT_VERSION)\doc\Commprod.htm regarding commercial distribution.
301	$(ECHOGS_XE) -w $(PSOBJ)dialog.txt This installs AFPL Ghostscript $(GS_DOT_VERSION).
302	$(ECHOGS_XE) -a $(PSOBJ)dialog.txt AFPL Ghostscript displays, prints and converts PostScript and PDF files.
303	$(WINZIPSE_XE) ..\$(ZIPTARGET) @$(PSOBJ)setupgs.rsp
304# Don't delete temporary files, because make continues
305# before these files are used.
306#	-del $(ZIP_RSP)
307#	-del $(PSOBJ)about.txt
308#	-del $(PSOBJ)dialog.txt
309
310
311# end of winint.mak
312