1 # Makefile for MinGW gcc64 compiler (modified from Makefile.win32)
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
14 # Prerequisites: - mingw x64 gcc compiler
15 # - make (often supplied with the gcc compiler)
18 # - graphicsmagick-1.3.14
20 # Note: This Makefile support only the tcl build.
22 ###########################
23 # Configuration variables #
24 ###########################
25 # INSTALLDIR = C:\app\xcircuit-tcl
26 # INSTALLDIR = C:/MinGW/msys/1.0/home/TEdwards/xcircuit-tcl
27 INSTALLDIR = C:/OpenCircuitDesign/XCircuit-3.9
30 TEMPDIR = C:/OpenCircuitDesign/Temp
33 # CC_EXEC = C:\app\gcc64\bin\gcc.exe
34 CC_EXEC = C:/MinGW64/bin/x86_64-w64-mingw32-gcc.exe
35 # GSDIR = C:\gs\gs9.02x64
36 GSDIR = "C:\Program Files\gs\gs9.05"
37 # GMDIR = C:\graphicsmagick-1.3.14
38 GMDIR = "C:/Program Files/GraphicsMagick"
39 WINDRES = C:/MinGW64/bin/x86_64-w64-mingw32-windres.exe
41 # Possible values: tcl, win32
44 # Additional settings for win32 build
49 # Additional settings for tcl build
50 # TCLDIR = C:\app\tclx64
56 SIZEOF_UNSIGNED_INT := 4
57 SIZEOF_UNSIGNED_LONG := 4
58 SIZEOF_UNSIGNED_LONG_LONG := 8
60 ####################################################################
61 # End of configuration. DO NOT CHANGE ANYTHING AFTER THIS POINT!!! #
62 ####################################################################
64 SOURCES = menudep.c $(xcircuit_SOURCES)
66 MK = $(MAKE) -f Makefile.mingw64
71 mkinstalldirs = mkdir -p
73 menudep_SOURCES = menudep.c
74 menudep_OBJECTS = menudep.$(OBJEXT)
75 menudep_LDADD = $(LDADD)
76 xcircuit_OBJECTS = elements.$(OBJEXT) events.$(OBJEXT) \
77 filelist.$(OBJEXT) files.$(OBJEXT) flate.$(OBJEXT) \
78 fontfile.$(OBJEXT) formats.$(OBJEXT) functions.$(OBJEXT) \
79 graphic.$(OBJEXT) help.$(OBJEXT) keybindings.$(OBJEXT) \
80 libraries.$(OBJEXT) menucalls.$(OBJEXT) netlist.$(OBJEXT) \
81 ngspice.$(OBJEXT) parameter.$(OBJEXT) python.$(OBJEXT) \
82 rcfile.$(OBJEXT) render.$(OBJEXT) svg.$(OBJEXT) \
83 schema.$(OBJEXT) selection.$(OBJEXT) text.$(OBJEXT) \
84 undo.$(OBJEXT) xcircuit.$(OBJEXT) $(WIN32_OBJECTS)
85 DEFAULT_INCLUDES = -I. -I$(srcdir)
86 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
89 LINK = $(CCLD) $(CFLAGS) $(LDFLAGS) -Fe$@ #Not in use
90 SOURCES = menudep.c $(xcircuit_SOURCES)
91 DIST_SOURCES = menudep.c $(xcircuit_SOURCES)
94 DIST_SUBDIRS = $(SUBDIRS)
95 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
96 distdir = $(PACKAGE)-$(VERSION)
97 top_distdir = $(distdir)
98 DIST_ARCHIVES = $(distdir).zip
105 ifeq ($(BUILD_TYPE),win32)
106 WIN32_OBJECTS = xcwin32.$(OBJEXT) xtfuncs.$(OBJEXT) xtgui.$(OBJEXT) resources.res
107 BUILTINS_DIR = WinBuiltinsDir()
108 STARTUP_FILE = startup.script
109 XC_CFLAGS = -DHAVE_XPM
110 ifneq ($(USE_WIN32_COM),0)
111 XC_CFLAGS = $(XC_CFLAGS) -DUSE_WIN32_COM
112 XC_DEPEND = $(XCCOMDIR)\XCCom.lib
113 XC_LIBS = $(XCCOMDIR)\XCCom.lib ole32.lib oleaut32.lib
114 ifneq ($(USE_WIN32_DOTNET),0)
115 XC_CFLAGS = $(XC_CFLAGS) -DUSE_WIN32_DOTNET
119 WIN32_OBJECTS = tclxcircuit.$(OBJEXT) tkSimple.$(OBJEXT) w32x11.$(OBJEXT)
120 BUILTINS_DIR = \"$(subst \,/,$(librarydir))\"
121 SCRIPTS_DIR = \"$(subst \,/,$(scriptsdir))\"
122 STARTUP_FILE = xcstartup.tcl
123 XC_CFLAGS = -DTCL_WRAPPER
124 XC_INCLUDES = -I$(TCLDIR)/include
125 XC_LIBS = $(TCLDIR)/bin/base-tcl8.5-thread-win32-x86_64.dll \
126 $(TCLDIR)/bin/tcl$(TCLVERSION).dll \
127 $(TCLDIR)/bin/tk$(TCLVERSION).dll
131 # Override standard "make" target when compiling under TCL
132 ALL_TARGET = all-recursive
133 INSTALL_TARGET = install
136 CFLAGS = -g -DSPICE_EXEC=\"$(subst \,/,$(SPICE_EXEC))\" -DHAVE_PUTENV -DGS_EXEC=\"$(subst \,/,$(GS_EXEC))\" -DGM_EXEC=\"$(subst \,/,$(GM_EXEC))\" -DXC_WIN32 -DDOUBLEBUFFER $(XC_CFLAGS) -DSIZEOF_VOID_P=$(SIZEOF_VOID_P) -DSIZEOF_UNSIGNED_INT=$(SIZEOF_UNSIGNED_INT) -DSIZEOF_UNSIGNED_LONG=$(SIZEOF_UNSIGNED_LONG) -DSIZEOF_UNSIGNED_LONG_LONG=$(SIZEOF_UNSIGNED_LONG_LONG) -D_MSC_VER
142 # Main compiler arguments
150 GS_EXEC = $(GSDIR)\bin\gswin64c.exe
151 GM_EXEC = $(GMDIR)\gm.exe
152 INC_SPECS = -I. $(XC_INCLUDES)
156 INSTALL_STRIP_PROGRAM = cp
158 LD = link _not_in_use_
161 LIBS = -lws2_32 -lgdi32 $(XC_LIBS)
162 # LIBS = ws2_32.lib gdi32.lib user32.lib kernel32.lib comdlg32.lib comctl32.lib $(XC_LIBS)
163 # imm32.lib shell32.lib comctl32.lib advapi32.lib
172 PACKAGE_NAME = xcircuit
177 SHLIB_CFLAGS = -shared
179 SPICE_EXEC = ngspice.exe
181 TCL_LIB_DIR = $(TCLDIR)\lib
182 WISH_EXE = $(TCLDIR)\bin\wish$(TCLVERSION).exe
184 XCIRCUIT_TARGET = $(BUILD_TYPE)
186 prefix = $(INSTALLDIR)
187 bindir = $(prefix)/bin
189 exec_prefix = $(prefix)/bin
190 includedir = $(prefix)/include
191 libdir = $(prefix)/lib
192 libexecdir = $(prefix)/bin
193 mandir = $(prefix)/doc
196 # Temporary directory (if not overridden by environment variable TMPDIR)
199 # Directories for app-defaults file and manual page
200 PATHNAMES = -DPROG_VERSION=$(VERSION) \
201 -DPROG_REVISION=$(REVISION) \
202 -DCAD_DIR=\"$(prefix)\" \
203 -DTEMP_DIR=\"$(tmpdir)\" \
204 -DSCRIPTS_DIR=\"$(scriptsdir)\" \
205 -DBUILTINS_DIR=$(BUILTINS_DIR) \
206 -DBUILTINS_FILE=\"$(BUILTINS_FILE)\" \
207 -DUSER_RC_FILE=\"$(USER_RC_FILE)\" \
208 -DPROLOGUE_DIR=$(BUILTINS_DIR) \
209 -DPROLOGUE_FILE=\"$(PROLOGUE_FILE)\" \
210 -DSTARTUP_FILE=\"$(STARTUP_FILE)\" \
211 -DLGF_LIB=\"$(LGF_LIB)\"
213 xcircuit_SOURCES = elements.c events.c filelist.c files.c \
214 flate.c fontfile.c formats.c functions.c graphic.c \
215 help.c keybindings.c libraries.c menucalls.c \
216 netlist.c ngspice.c parameter.c python.c rcfile.c \
217 render.c schema.c selection.c svg.c \
219 tclxcircuit.c tkSimple.c xcircuit.c w32x11.c
221 xcircuit_DEPEND = $(XC_DEPEND)
223 man_MANS = lib/xcircuit.1
224 INCLUDES = $(INC_SPECS)
226 # Library directory and files
227 # librarydir = $(datadir)/$(PACKAGE)-$(VERSION)
228 # scriptsdir = $(datadir)/$(PACKAGE)-$(VERSION)
229 librarydir = $(datadir)
230 scriptsdir = $(datadir)
231 USER_RC_FILE = .xcircuitrc
232 PROLOGUE_FILE = xcircps2.pro
234 SIGNAL_LIB = signal.lps
235 MUSIC_LIB = musiclib.lps
236 FONTS_LPS = courier courieriso2 courieriso5 helvetica helveticaiso2 \
237 helveticaiso5 myfont symbol times_roman times_romaniso2 \
240 FONTS_XFE = courier courieriso courieriso2 courieriso5 helvetica \
241 helveticaiso helveticaiso2 helveticaiso5 myfont symbol \
242 times_roman times_romaniso times_romaniso2 times_romaniso5
244 SCRIPTS_PY = spice gettext pagebbox
245 WRAPPER_INIT = xcircuit.tcl
246 WRAPPER_OBJ = xcircuit$(SHDLIB_EXT)
247 WRAPPER_SO = xcircuit.dll
248 WRAPPER_SH = xcircuit.bat
250 CONSOLE_SCRIPT = console.tcl
255 .SUFFIXES: .c .o .obj .rc .res
264 $(WINDRES) -o $@ -O coff $(XC_CFLAGS) -I $(XCCOMDIR) $<
271 menudep$(EXEEXT): menudep.$(OBJEXT)
272 $(CC) -o $@ menudep.$(OBJEXT)
274 menudep.h: menudep$(EXEEXT) menus.h
277 xcwrap.obj: xcwrap.c menudep.h
278 $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) $(PATHNAMES) $(INCLUDES) \
279 xcwrap.c -c -o xcwrap.$(OBJEXT)
281 lib/tcl/xcircuit$(SHDLIB_EXT): xcwrap.$(OBJEXT) $(xcircuit_OBJECTS) $(xcircuit_DEPEND)
282 -$(RM) lib\xcircuit$(SHDLIB_EXT)
283 $(CC) $(CFLAGS) $(SHLIB_CFLAGS) -o $@ $(LDDL_FLAGS) xcwrap.$(OBJEXT) \
284 $(xcircuit_OBJECTS) $(xcircuit_LDADD) $(LDFLAGS) \
285 $(X_EXTRA_LIBS) $(EXTRA_LIBS) $(LIBS) $(EXTRA_LIB_SPECS) \
288 xcircuit$(EXEEXT): $(xcircuit_OBJECTS) $(xcircuit_DEPEND)
289 $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCLUDES) $(xcircuit_OBJECTS) \
290 -o $@ $(LDFLAGS) $(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS) shell32.lib \
291 /link /SUBSYSTEM:CONSOLE
293 xcircexec$(EXEEXT): xcircexec.$(OBJEXT)
294 -$(RM) .\xcircexec$(EXEEXT)
295 $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(PATHNAMES) $(INCLUDES) \
296 xcircexec.c -o $@ $(LDFLAGS) \
297 $(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS)
299 xcircuit-win32$(EXEEXT): xcircuit-win32.c resources.res
300 $(CC) $(CFLAGS) $(CPPFLAGS) \
301 -DWISH_EXE=L\"$(subst \,/,$(WISH_EXE))\" \
302 -DBUILTINS_DIR=L$(BUILTINS_DIR) \
303 $(INCLUDES) xcircuit-win32.c resources.res \
304 -o $@ $(LDFLAGS) $(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS) -lshell32 -ladvapi32
307 @echo Making tcl library object
308 $(MK) lib/tcl/xcircuit$(SHDLIB_EXT)
309 $(MK) lib/$(INTERP_PATH)/$(WRAPPER_SH)
310 $(MK) lib/$(INTERP_PATH)/$(WRAPPER_INIT)
311 $(MK) xcircexec$(EXEEXT)
312 $(MK) xcircuit-win32$(EXEEXT)
316 ifneq ($(USE_WIN32_COM),0)
317 cd $(XCCOMDIR) && $(MK) && cd ..
319 $(MK) xcircuit$(EXEEXT)
322 menucalls.c: menudep.h
325 xcircuit.c: menudep.h
326 parameter.c: menudep.h
328 tclxcircuit.c: menudep.h
329 resources.rc: lib/pixmaps/xcircuit.ico
334 lib/$(INTERP_PATH)/$(WRAPPER_SH): $(PP) lib/$(INTERP_PATH)/$(WRAPPER_SH).in
335 $(PP) $(PATHNAMES) -DXCLIBDIR=\"$(subst \,/,$(librarydir))\" \
336 -DWRAPPER_INIT=\"$(WRAPPER_INIT)\" -DCONSOLE=\"$(CONSOLE)\" \
337 -DCONSOLE_SCRIPT=\"$(CONSOLE_SCRIPT)\" \
338 -DSCRIPTSDIR=\"$(scriptsdir)\" \
339 -DTCLLIBDIR=\"$(subst \,/,$(TCL_LIB_DIR))\" \
340 -DWISH_EXE=\"$(subst \,/,$(WISH_EXE))\" \
341 lib/$(INTERP_PATH)/$(WRAPPER_SH).in > $@
343 lib/$(INTERP_PATH)/$(WRAPPER_INIT): $(PP) lib/$(INTERP_PATH)/$(WRAPPER_INIT).in
344 $(PP) $(PATHNAMES) -DLIBDIR=\"$(subst \,/,$(librarydir))\" \
345 -DSCRIPTSDIR=\"$(scriptsdir)\" \
346 lib/$(INTERP_PATH)/$(WRAPPER_INIT).in > $@
348 lib/xcircuit.1: $(PP) lib/xcircuit.1.in
349 $(PP) -DLIBDIR=\"$(libdir)\" \
350 -DSCRIPTSDIR=\"$(scriptsdir)\" \
351 -DLGF=1 -DPYTHON=0 -DTCL=1 -DNOINTERP=0 \
352 lib/xcircuit.1.in > $@
354 install-data-local: lib/xcircuit.1
355 @echo "Installing library files"
356 $(mkinstalldirs) $(DESTDIR)$(librarydir)
357 $(INSTALL_DATA) lib/$(PROLOGUE_FILE) $(DESTDIR)$(librarydir)
358 $(INSTALL_DATA) lib/*.lps $(DESTDIR)$(librarydir)
359 $(INSTALL_DATA) lib/$(INTERP_PATH)/$(STARTUP_FILE) $(DESTDIR)$(librarydir)
360 @echo "Installing .lps font files"
361 $(mkinstalldirs) $(DESTDIR)$(librarydir)/fonts
362 $(foreach f,$(FONTS_LPS), $(INSTALL_DATA) lib/fonts/$(f).lps $(DESTDIR)$(librarydir)/fonts &)
363 @echo "Installing .xfe font files"
364 $(foreach f,$(FONTS_XFE), $(INSTALL_DATA) lib/fonts/$(f).xfe $(DESTDIR)$(librarydir)/fonts &)
365 @echo "Installing scripts (if option enabled)"
367 # Note that MacOS/Fink uses SHDLIB_EXT = .dylib but Tcl expects .so anyway.
368 # So we make a symbolic link if SHDLIB_EXT != .so
370 install-tcl: xcircexec$(EXEEXT) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH) lib/$(INTERP_PATH)/$(WRAPPER_INIT) xcircuit-win32$(EXEEXT)
371 # if $(prefix) $(RMDIR) $(prefix)
373 @echo "Installing standard XCircuit library files"
374 $(MK) $(AM_MAKEFLAGS) install-data-local
375 @echo "Installing Tcl files"
376 $(INSTALL_DATA) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) $(DESTDIR)$(librarydir)
377 $(INSTALL_DATA) lib/$(INTERP_PATH)/*.tcl $(DESTDIR)$(librarydir)
378 $(INSTALL_DATA) xcircexec$(EXEEXT) $(DESTDIR)$(librarydir)
379 @echo "Installing pixmap images"
380 $(mkinstalldirs) $(DESTDIR)$(librarydir)\pixmaps
381 $(INSTALL_DATA) lib/pixmaps/*.gif $(DESTDIR)$(librarydir)/pixmaps
382 $(INSTALL_DATA) lib/pixmaps/*.xbm $(DESTDIR)$(librarydir)/pixmaps
383 @echo "Installing shell script as xcircuit executable"
384 $(mkinstalldirs) $(DESTDIR)$(bindir)
385 $(INSTALL_DATA) lib/$(INTERP_PATH)/$(WRAPPER_SH) $(DESTDIR)$(bindir)
386 $(INSTALL_DATA) xcircuit-win32$(EXEEXT) $(DESTDIR)$(bindir)
388 install-win32: xcircuit$(EXEEXT)
389 if exist $(prefix) $(RMDIR) $(prefix)
390 $(MK) $(AM_MAKEFLAGS) install-data-local "librarydir=$(prefix)"
391 $(INSTALL_DATA) xcircuit$(EXEEXT) $(DESTDIR)$(prefix)
394 -$(RM) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH)
395 -for %%e in (ilk exp pdb lib) do @if exist lib/$(INTERP_PATH)/xcircuit.%%e $(RM) lib/$(INTERP_PATH)/xcircuit.%%e
396 -$(RM) lib/$(INTERP_PATH)/$(WRAPPER_INIT)
397 -for %%f in (*.$(OBJEXT) xcircexec$(EXEEXT) lib/xcircuit.1 xcircuit$(EXEEXT) xcircuit.suo) do $(RM) %%f
398 -for %%e in (aps res) do $(RM) resources.%%e
399 -for %%e in (ilk exp pdb lib) do @if exist xcircexec.%%e $(RM) xcircexec.%%e
400 -for %%e in (ilk exp pdb lib) do @if exist xcircuit.%%e $(RM) xcircuit.%%e
401 -for %%e in (ilk exp pdb lib) do @if exist pp.%%e $(RM) pp.%%e
402 -for %%e in (ilk exp pdb lib exe) do @if exist xcircuit-win32.%%e $(RM) xcircuit-win32.%%e
403 -$(RM) menudep$(EXEEXT) menudep.h
407 ifeq ($(BUILD_TYPE),win32)
408 ifneq ($(USE_WIN32_COM),0)
409 cd $(XCCOMDIR) && $(MK) clean && cd ..
414 $(MK) $(XCIRCUIT_TARGET)
420 ifeq ($(BUILD_TYPE),win32)
421 ifneq ($(USE_WIN32_COM),0)
422 cd $(XCCOMDIR) && $(MK) examples && cd ..
426 ifeq ($(BUILD_TYPE),win32)
427 xcircuit.h: xcwin32.h
428 xcwin32.c: xcircuit.h
430 xcircuit.h: tkwin32.h
432 elements.c: xcircuit.h
434 filelist.c: xcircuit.h
437 fontfile.c: xcircuit.h
438 formats.c: xcircuit.h
439 functions.c: xcircuit.h
440 graphic.c: xcircuit.h
442 keybindings.c: xcircuit.h
443 libraries.c: xcircuit.h
444 menucalls.c: xcircuit.h
445 netlist.c: xcircuit.h
446 ngspice.c: xcircuit.h
447 parameter.c: xcircuit.h
452 selection.c: xcircuit.h
455 xcircuit.c: xcircuit.h
457 xtfuncs.c: xcircuit.h
458 ifeq ($(BUILD_TYPE),win32)
459 ifneq ($(USE_WIN32_COM),0)
460 resources.rc: $(XCCOMDIR)/XCCom.tlb