Corrected a long-standing error in which ending text with a literal
[xcircuit.git] / Makefile.win32
blobbf3e414fe89f0c65f854a5a747f3d7de694c1d5a
1 # Makefile for VC++ compiler (modified from original Makefile.in)
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004  Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
14 ###########################
15 # Configuration variables #
16 ###########################
18 INSTALLDIR = D:\Software\XCircuit-tcl-dev
19 TEMPDIR    = D:\Temp
21 GSDIR      = C:\gs\gs8.15
23 # Possible values: tcl, win32
24 BUILD_TYPE = tcl
26 # Additional settings for win32 build
27 USE_WIN32_COM    = 0
28 USE_WIN32_DOTNET = 0
29 XCCOMDIR         = xccom2
31 # Additional settings for tcl build
32 TCLDIR     = D:\Software\Tcl
33 TCLVERSION = 84
35 ####################################################################
36 # End of configuration. DO NOT CHANGE ANYTHING AFTER THIS POINT!!! #
37 ####################################################################
39 SOURCES = menudep.c $(xcircuit_SOURCES)
41 MAKE = $(MAKE) -f Makefile.win32
43 srcdir = .
44 top_srcdir = .
45 top_builddir = .
46 mkinstalldirs = mkdir
48 menudep_SOURCES = menudep.c
49 menudep_OBJECTS = menudep.$(OBJEXT)
50 menudep_LDADD = $(LDADD)
51 xcircuit_OBJECTS = elements.$(OBJEXT) events.$(OBJEXT) \
52         filelist.$(OBJEXT) files.$(OBJEXT) flate.$(OBJEXT) \
53         fontfile.$(OBJEXT) formats.$(OBJEXT) functions.$(OBJEXT) \
54         graphic.$(OBJEXT) help.$(OBJEXT) keybindings.$(OBJEXT) \
55         libraries.$(OBJEXT) menucalls.$(OBJEXT) netlist.$(OBJEXT) \
56         ngspice.$(OBJEXT) opengl.$(OBJEXT) parameter.$(OBJEXT) \
57         python.$(OBJEXT) rcfile.$(OBJEXT) render.$(OBJEXT) \
58         schema.$(OBJEXT) selection.$(OBJEXT) text.$(OBJEXT) \
59         undo.$(OBJEXT) xcircuit.$(OBJEXT) $(WIN32_OBJECTS)
60 DEFAULT_INCLUDES = -I. -I$(srcdir)
61 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
62         $(CPPFLAGS) $(CFLAGS)
63 CCLD = $(CC)
64 LINK = $(CCLD) $(CFLAGS) $(LDFLAGS) -Fe$@
65 SOURCES = menudep.c $(xcircuit_SOURCES)
66 DIST_SOURCES = menudep.c $(xcircuit_SOURCES)
67 man1dir = $(mandir)
68 MANS = $(man_MANS)
69 DIST_SUBDIRS = $(SUBDIRS)
70 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
71 distdir = $(PACKAGE)-$(VERSION)
72 top_distdir = $(distdir)
73 DIST_ARCHIVES = $(distdir).zip
75 XC_CFLAGS   =
76 XC_LIBS     =
77 XC_OBJECT   =
78 XC_INCLUDES =
80 !if "$(BUILD_TYPE)" == "win32"
81 WIN32_OBJECTS = xcwin32.$(OBJEXT) xtfuncs.$(OBJEXT) xtgui.$(OBJEXT) resources.res
82 BUILTINS_DIR  = WinBuiltinsDir()
83 STARTUP_FILE  = startup.script
84 XC_CFLAGS     = -DHAVE_XPM -D_CRT_SECURE_NO_DEPRECATE
85 !if "$(USE_WIN32_COM)" != "0"
86 XC_CFLAGS = $(XC_CFLAGS) -DUSE_WIN32_COM
87 XC_DEPEND = $(XCCOMDIR)\XCCom.lib
88 XC_LIBS = $(XCCOMDIR)\XCCom.lib ole32.lib oleaut32.lib
89 !if "$(USE_WIN32_DOTNET)" != "0"
90 XC_CFLAGS = $(XC_CFLAGS) -DUSE_WIN32_DOTNET
91 !endif
92 !endif
93 !else
94 WIN32_OBJECTS = tclxcircuit.$(OBJEXT) tkSimple.$(OBJEXT) w32x11.$(OBJEXT)
95 BUILTINS_DIR  = \"$(librarydir:\=/)\"
96 SCRIPTS_DIR  = \"$(scriptsdir:\=/)\"
97 STARTUP_FILE  = xcstartup.tcl
98 XC_CFLAGS     = -DTCL_WRAPPER -D_CRT_SECURE_NO_DEPRECATE
99 XC_INCLUDES   = -I$(TCLDIR)\include
100 XC_LIBS       = $(TCLDIR)\lib\tcl$(TCLVERSION).lib $(TCLDIR)\lib\tk$(TCLVERSION).lib
101 !endif
104 # Override standard "make" target when compiling under TCL
105 ALL_TARGET = all-recursive
106 INSTALL_TARGET = install
108 CC = cl
109 CFLAGS = -Zi -DSPICE_EXEC=\"$(SPICE_EXEC:\=/)\" -DHAVE_PUTENV -DGS_EXEC=\"$(GS_EXEC:\=/)\" -DXC_WIN32 -DDOUBLEBUFFER $(XC_CFLAGS)
110 CPP = cl
111 CPPFLAGS =
112 RM = del /q
113 RMDIR = rmdir /s /q
115 # Main compiler arguments
116 DEFS = $(PATHNAMES)
117 ECHO_C = echo
118 ECHO_N = echo
119 ECHO_T = echo
120 EGREP = egrep
121 EXEEXT = .exe
122 EXTRA_LIB_SPECS =
123 GS_EXEC = $(GSDIR)\bin\gswin32c.exe
124 INC_SPECS = -I. $(XC_INCLUDES)
125 INSTALL_DATA = copy /y
126 INSTALL_PROGRAM = copy /y
127 INSTALL_SCRIPT = copy /y
128 INSTALL_STRIP_PROGRAM = copy /y
129 INTERP_PATH = tcl
130 LD = link
131 LDDL_FLAGS =
132 LDFLAGS =
133 LIBS =  ws2_32.lib gdi32.lib user32.lib kernel32.lib comdlg32.lib comctl32.lib $(XC_LIBS)
134 #       imm32.lib shell32.lib comctl32.lib advapi32.lib
136 LIB_SPECS =
137 PP = pp.exe
139 # Man page
140 MAKEINFO = makeinfo
141 OBJEXT = obj
142 PACKAGE = xcircuit
143 PACKAGE_NAME = xcircuit
144 PATH_SEPARATOR = \\
145 VERSION = 3.7
146 REVISION = 21
147 SHDLIB_EXT = .dll
148 SHLIB_CFLAGS = /LD /ML
149 SHLIB_LIB_SPECS =
150 SPICE_EXEC = ngspice.exe
151 SUBDIRS =
152 TCL_LIB_DIR = $(TCLDIR)\lib
153 WISH_EXE = $(TCLDIR)\bin\wish$(TCLVERSION).exe
154 WRAPPER_SCRIPT =
155 XCIRCUIT_TARGET = $(BUILD_TYPE)
156 X_EXTRA_LIBS =
157 prefix = $(INSTALLDIR)
158 bindir = $(prefix)\bin
159 datadir = $(prefix)
160 exec_prefix = $(prefix)\bin
161 includedir = $(prefix)\include
162 libdir = $(prefix)\lib
163 libexecdir = $(prefix)\bin
164 mandir = $(prefix)\doc
165 mkdir_p = mkdir
167 # Temporary directory (if not overridden by environment variable TMPDIR)
168 tmpdir = $(TEMPDIR)
170 # Directories for app-defaults file and manual page
171 PATHNAMES = -DPROG_VERSION=$(VERSION) \
172         -DPROG_REVISION=$(REVISION) \
173         -DCAD_DIR=\"$(prefix:\=/)\" \
174         -DTEMP_DIR=\"$(tmpdir:\=/)\" \
175         -DBUILTINS_DIR=$(BUILTINS_DIR) \
176         -DBUILTINS_FILE=\"$(BUILTINS_FILE)\" \
177         -DUSER_RC_FILE=\"$(USER_RC_FILE)\" \
178         -DPROLOGUE_DIR=$(BUILTINS_DIR) \
179         -DPROLOGUE_FILE=\"$(PROLOGUE_FILE)\" \
180         -DSTARTUP_FILE=\"$(STARTUP_FILE)\" \
181         -DLGF_LIB=\"$(LGF_LIB)\"
183 xcircuit_SOURCES = elements.c events.c filelist.c files.c \
184         flate.c fontfile.c formats.c functions.c graphic.c \
185         help.c keybindings.c libraries.c menucalls.c \
186         netlist.c ngspice.c opengl.c parameter.c python.c \
187         rcfile.c render.c schema.c selection.c text.c undo.c \
188         tclxcircuit.c tkSimple.c xcircuit.c w32x11.c
190 xcircuit_DEPEND = $(XC_DEPEND)
191 xcircuit_LDADD =
192 man_MANS = lib/xcircuit.1
193 INCLUDES = $(INC_SPECS)
195 # Library directory and files
196 librarydir = $(datadir)\$(PACKAGE)-$(VERSION)
197 scriptsdir = $(datadir)\$(PACKAGE)-$(VERSION)
198 USER_RC_FILE = .xcircuitrc
199 PROLOGUE_FILE = xcircps2.pro
200 LGF_LIB = lgf.lps
201 SIGNAL_LIB = signal.lps
202 MUSIC_LIB = musiclib.lps
203 FONTS_LPS = courier courieriso2 courieriso5 helvetica helveticaiso2 \
204         helveticaiso5 myfont symbol times_roman times_romaniso2 \
205         times_romaniso5
207 FONTS_XFE = courier courieriso courieriso2 courieriso5 helvetica \
208         helveticaiso helveticaiso2 helveticaiso5 myfont symbol \
209         times_roman times_romaniso times_romaniso2 times_romaniso5
211 SCRIPTS_PY = spice gettext pagebbox
212 WRAPPER_INIT = xcircuit.tcl
213 WRAPPER_OBJ = xcircuit$(SHDLIB_EXT)
214 WRAPPER_SO = xcircuit.dll
215 WRAPPER_SH = xcircuit.bat
216 CONSOLE = tkcon.tcl
217 CONSOLE_SCRIPT = console.tcl
219 all: all-recursive
221 .SUFFIXES:
222 .SUFFIXES: .c .o .obj .rc .res
224 .c.o:
225         $(COMPILE) -c $<
227 .c.obj:
228         $(COMPILE) -c "$<"
230 .rc.res:
231         rc -fo$@ $(XC_CFLAGS) /i$(XCCOMDIR) $<
233 ##################
234 # Building rules #
235 ##################
237 menudep$(EXEEXT): menudep.$(OBJEXT)
238         $(CC) -Fe$@ $**
240 menudep.h: menudep$(EXEEXT) menus.h
241         .\menudep$(EXEEXT)
243 xcwrap.obj: xcwrap.c menudep.h
244         $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) $(PATHNAMES) $(INCLUDES) \
245                 xcwrap.c -c -Foxcwrap.$(OBJEXT)
247 lib\tcl\xcircuit$(SHDLIB_EXT): xcwrap.$(OBJEXT) $(xcircuit_OBJECTS) $(xcircuit_DEPEND)
248         -$(RM) lib\xcircuit$(SHDLIB_EXT)
249         $(CC) $(CFLAGS) $(SHLIB_CFLAGS) -Fe$@ $(LDDL_FLAGS) xcwrap.$(OBJEXT) \
250                 $(xcircuit_OBJECTS) $(xcircuit_LDADD) $(LDFLAGS) \
251                 $(X_EXTRA_LIBS) $(EXTRA_LIBS) $(LIBS) $(EXTRA_LIB_SPECS) \
252                 $(SHLIB_LIB_SPECS)
254 xcircuit$(EXEEXT): $(xcircuit_OBJECTS) $(xcircuit_DEPEND)
255         $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCLUDES) $(xcircuit_OBJECTS) \
256                 -Fe$@ $(LDFLAGS) $(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS) shell32.lib \
257                 /link /SUBSYSTEM:CONSOLE
259 xcircexec$(EXEEXT): xcircexec.$(OBJEXT)
260         -$(RM) .\xcircexec$(EXEEXT)
261         $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(PATHNAMES) $(INCLUDES) \
262                 xcircexec.c -Fe$@ $(LDFLAGS) \
263                 $(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS)
265 xcircuit-win32$(EXEEXT): xcircuit-win32.c resources.res
266         $(CC) $(CFLAGS) $(CPPFLAGS) \
267                 -DWISH_EXE=L\"$(WISH_EXE:\=/)\" \
268                 -DBUILTINS_DIR=L$(BUILTINS_DIR) \
269                 $(INCLUDES) xcircuit-win32.c resources.res \
270                 -Fe$@ $(LDFLAGS) $(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS) shell32.lib advapi32.lib
272 tcl:
273         @echo Making tcl library object
274         $(MAKE) lib\tcl\xcircuit$(SHDLIB_EXT)
275         $(MAKE) lib\$(INTERP_PATH)\$(WRAPPER_SH)
276         $(MAKE) lib\$(INTERP_PATH)\$(WRAPPER_INIT)
277         $(MAKE) xcircexec$(EXEEXT)
278         $(MAKE) xcircuit-win32$(EXEEXT)
280 win32:
281         @echo Making win32
282 !if "$(USE_WIN32_COM)" != "0"
283         cd $(XCCOMDIR) && $(MAKE) && cd ..
284 !endif
285         $(MAKE) xcircuit$(EXEEXT)
287 help.c: menudep.h
288 menucalls.c: menudep.h
289 rcfile.c: menudep.h
290 schema.c: menudep.h
291 xcircuit.c: menudep.h
292 parameter.c: menudep.h
293 python.c: menudep.h
294 tclxcircuit.c: menudep.h
295 resources.rc: lib/pixmaps/xcircuit.ico
297 $(PP): pp.c
298         $(CC) -Zi pp.c
300 lib\$(INTERP_PATH)\$(WRAPPER_SH): $(PP) lib\$(INTERP_PATH)\$(WRAPPER_SH).in
301         $(PP) $(PATHNAMES) -DXCLIBDIR=\"$(librarydir:\=/)\" \
302                 -DWRAPPER_INIT=\"$(WRAPPER_INIT)\" -DCONSOLE=\"$(CONSOLE)\" \
303                 -DCONSOLE_SCRIPT=\"$(CONSOLE_SCRIPT)\" \
304                 -DTCLLIBDIR=\"$(TCL_LIB_DIR:\=/)\" \
305                 -DWISH_EXE=\"$(WISH_EXE:\=/)\" \
306                 lib/$(INTERP_PATH)/$(WRAPPER_SH).in > $@
308 lib\$(INTERP_PATH)\$(WRAPPER_INIT): $(PP) lib\$(INTERP_PATH)\$(WRAPPER_INIT).in
309         $(PP) $(PATHNAMES) -DLIBDIR=\"$(librarydir:\=/)\" \
310                 lib/$(INTERP_PATH)/$(WRAPPER_INIT).in > $@
312 lib\xcircuit.1: $(PP) lib\xcircuit.1.in
313         $(PP) -DLIBDIR=\"$(libdir)\" \
314                 -DSCRIPTSDIR=\"$(scriptsdir)\" \
315                 -DLGF=1 -DPYTHON=0 -DTCL=1 -DNOINTERP=0 \
316                 lib\xcircuit.1.in > $@
318 install-data-local: lib/xcircuit.1
319         @echo "Installing library files"
320         $(mkinstalldirs) $(DESTDIR)$(librarydir)
321         cd lib
322         for %i in ($(PROLOGUE_FILE) *.lps) do $(INSTALL_DATA) %i $(DESTDIR)$(librarydir)
323         cd ..
324         cd lib\$(INTERP_PATH)
325         for %i in ($(STARTUP_FILE)) do $(INSTALL_DATA) %i $(DESTDIR)$(librarydir)
326         cd ..\..
327         @echo "Installing .lps font files"
328         $(mkinstalldirs) $(DESTDIR)$(librarydir)\fonts
329         for %i in ($(FONTS_LPS)) do $(INSTALL_DATA) lib\fonts\%i.lps $(DESTDIR)$(librarydir)\fonts
330         @echo "Installing .xfe font files"
331         for %i in ($(FONTS_XFE)) do $(INSTALL_DATA) lib\fonts\%i.xfe $(DESTDIR)$(librarydir)\fonts
332         @echo "Installing scripts (if option enabled)"
334 # Note that MacOS/Fink uses SHDLIB_EXT = .dylib but Tcl expects .so anyway.
335 # So we make a symbolic link if SHDLIB_EXT != .so
337 install-tcl: xcircexec$(EXEEXT) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH) lib/$(INTERP_PATH)/$(WRAPPER_INIT) xcircuit-win32$(EXEEXT)
338         if exist $(prefix) $(RMDIR) $(prefix)
339         @echo "Installing standard XCircuit library files"
340         $(MAKE) $(AM_MAKEFLAGS) install-data-local
341         @echo "Installing Tcl files"
342         cd lib\$(INTERP_PATH)
343         for %i in ($(WRAPPER_OBJ) *.tcl) do $(INSTALL_DATA) %i $(DESTDIR)$(librarydir)
344         cd ..\..
345         $(INSTALL_DATA) xcircexec$(EXEEXT) $(DESTDIR)$(librarydir)
346         @echo "Installing pixmap images"
347         $(mkinstalldirs) $(DESTDIR)$(librarydir)\pixmaps
348         cd lib\pixmaps
349         for %i in (*.gif *.xbm) do $(INSTALL_DATA) %i $(DESTDIR)$(librarydir)\pixmaps
350         cd ..\..
351         @echo "Installing shell script as xcircuit executable"
352         $(mkinstalldirs) $(DESTDIR)$(bindir)
353         $(INSTALL_DATA) lib\$(INTERP_PATH)\$(WRAPPER_SH) $(DESTDIR)$(bindir)
354         $(INSTALL_DATA) xcircuit-win32$(EXEEXT) $(DESTDIR)$(bindir)
356 install-win32: xcircuit$(EXEEXT)
357         if exist $(prefix) $(RMDIR) $(prefix)
358         $(MAKE) $(AM_MAKEFLAGS) install-data-local "librarydir=$(prefix)"
359         $(INSTALL_DATA) xcircuit$(EXEEXT) $(DESTDIR)$(prefix)
361 clean:
362         -$(RM) lib\$(INTERP_PATH)\$(WRAPPER_OBJ) lib\$(INTERP_PATH)\$(WRAPPER_SH)
363         -for %e in (ilk exp pdb lib) do @if exist lib\$(INTERP_PATH)\xcircuit.%e $(RM) lib\$(INTERP_PATH)\xcircuit.%e
364         -$(RM) lib\$(INTERP_PATH)\$(WRAPPER_INIT)
365         -for %f in (*.$(OBJEXT) xcircexec$(EXEEXT) lib\xcircuit.1 xcircuit$(EXEEXT) xcircuit.suo) do $(RM) %f
366         -for %e in (aps res) do $(RM) resources.%e
367         -for %e in (ilk exp pdb lib) do @if exist xcircexec.%e $(RM) xcircexec.%e
368         -for %e in (ilk exp pdb lib) do @if exist xcircuit.%e $(RM) xcircuit.%e
369         -for %e in (ilk exp pdb lib) do @if exist pp.%e $(RM) pp.%e
370         -for %e in (ilk exp pdb lib exe) do @if exist xcircuit-win32.%e $(RM) xcircuit-win32.%e
371         -$(RM) menudep$(EXEEXT) menudep.h
372         -$(RM) pp$(EXEEXT)
373         -$(RM) *.pdb
374         -$(RM) *~
375 !if "$(BUILD_TYPE)" == "win32" && "$(USE_WIN32_COM)" != "0"
376         cd $(XCCOMDIR) && $(MAKE) clean && cd ..
377 !endif
379 $(ALL_TARGET):
380         $(MAKE) $(XCIRCUIT_TARGET)
382 $(INSTALL_TARGET):
383         (MAKE) install-tcl
385 examples: all
386 !if "$(BUILD_TYPE)" == "win32" && "$(USE_WIN32_COM)" != "0"
387         cd $(XCCOMDIR) && $(MAKE) examples && cd ..
388 !endif
390 !if "$(BUILD_TYPE)" == "win32"
391 xcircuit.h: xcwin32.h
392 xcwin32.c: xcircuit.h
393 !else
394 xcircuit.h: tkwin32.h
395 !endif
396 elements.c: xcircuit.h
397 events.c: xcircuit.h
398 filelist.c: xcircuit.h
399 files.c: xcircuit.h
400 flate.c: xcircuit.h
401 fontfile.c: xcircuit.h
402 formats.c: xcircuit.h
403 functions.c: xcircuit.h
404 graphic.c: xcircuit.h
405 help.c: xcircuit.h
406 keybindings.c: xcircuit.h
407 libraries.c: xcircuit.h
408 menucalls.c: xcircuit.h
409 netlist.c: xcircuit.h
410 ngspice.c: xcircuit.h
411 opengl.c: xcircuit.h
412 parameter.c: xcircuit.h
413 python.c: xcircuit.h
414 rcfile.c: xcircuit.h
415 render.c: xcircuit.h
416 schema.c: xcircuit.h
417 selection.c: xcircuit.h
418 text.c: xcircuit.h
419 undo.c: xcircuit.h
420 xcircuit.c: xcircuit.h
421 xtgui.c: xcircuit.h
422 xtfuncs.c: xcircuit.h
423 !if "$(BUILD_TYPE)" == "win32" && "$(USE_WIN32_COM)" != "0"
424 resources.rc: $(XCCOMDIR)/XCCom.tlb
425 !endif