Applied one other trick to use the Tk command "font measure" to
[xcircuit.git] / Makefile.am
blobb3a029998467ea6760cf7a31c69a8f4726ccc346
1 ## Process this file with automake to produce Makefile.in
3 AUTOMAKE_OPTIONS = foreign no-dependencies no-dist
5 AM_CFLAGS = $(cairo_CFLAGS) $(fontconfig_CFLAGS) ${GS_CFLAGS}
6 LIBS += $(cairo_LIBS) $(fontconfig_LIBS) ${GS_LIBS}
8 # Additional files to distribute
9 EXTRA_DIST = COPYRIGHT README README.ISOLatin2 README.notes
11 SUBDIRS = @SUBDIRS@
12 VERSION = @VERSION@
13 REVISION = @REVISION@
14 FULL_VERSION = @VERSION@.@REVISION@
16 # Override standard "make" target when compiling under TCL
17 ALL_TARGET = @ALL_TARGET@
18 INSTALL_TARGET = @INSTALL_TARGET@
20 # Menudep program generates menudep.h needed by some of the
21 # source files for Xcircuit
22 noinst_PROGRAMS = menudep$(EXEEXT)
24 # Automake files
25 ac_aux_dir = dist
27 # Requirements for Xcircuit
28 bin_PROGRAMS = xcircuit
30 # Temporary directory (if not overridden by environment variable TMPDIR)
31 tmpdir = /tmp
33 # Directories for app-defaults file and manual page
34 appdefaultsdir = $(libdir)/$(PACKAGE)-$(VERSION)/app-defaults
35 appmandir = $(libdir)/$(PACKAGE)-$(VERSION)/man
37 install_appdefaultsdir = @DIST_DIR@/lib/$(PACKAGE)-$(VERSION)/app-defaults
38 install_appmandir = @DIST_DIR@/lib/$(PACKAGE)-$(VERSION)/man
39 install_bindir = @DIST_DIR@/bin
41 PATHNAMES = -DPROG_VERSION=\"$(VERSION)\" \
42         -DPROG_REVISION=\"$(REVISION)\" \
43         -DCAD_DIR=\"$(libdir)\" \
44         -DTEMP_DIR=\"$(tmpdir)\" \
45         -DRESOURCES_DIR=\"$(appdefaultsdir)\" \
46         -DSCRIPTS_DIR=\"$(scriptsdir)\" \
47         -DBUILTINS_DIR=\"$(librarydir)\" \
48         -DBUILTINS_FILE=\"$(BUILTINS_FILE)\" \
49         -DUSER_RC_FILE=\"$(USER_RC_FILE)\" \
50         -DPROLOGUE_DIR=\"$(librarydir)\" \
51         -DPROLOGUE_FILE=\"$(PROLOGUE_FILE)\" \
52         -DCYRILLIC_ENC_FILE=\"$(CYRILLIC_ENC_FILE)\" \
53         -DISOLATIN2_ENC_FILE=\"$(ISOLATIN2_ENC_FILE)\" \
54         -DISOLATIN5_ENC_FILE=\"$(ISOLATIN5_ENC_FILE)\" \
55         -DSTARTUP_FILE=\"$(STARTUP_FILE)\" \
56         -DLGF_LIB=\"$(LGF_LIB)\" \
57         -DASG_SPICE_LIB=\"$(ASG_SPICE_LIB)\"
59 xcircuit_SOURCES = elements.c events.c filelist.c files.c \
60         flate.c fontfile.c formats.c functions.c graphic.c \
61         help.c keybindings.c libraries.c menucalls.c \
62         netlist.c ngspice.c parameter.c python.c \
63         rcfile.c render.c schema.c selection.c svg.c text.c undo.c \
64         tclxcircuit.c tkSimple.c xcircuit.c xtfuncs.c xtgui.c \
65         cairo.c utf8encodings.c
66 cairo.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
67 elements.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
68 events.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
69 fontfile.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
70 text.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
71 utf8encodings.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
73 xcircuit_DEPEND = @SUBLIB@
74 xcircuit_LDADD = @SUBLIB@ @STDLIBS@
76 help.c: menudep.h
77 menucalls.c: menudep.h
78 rcfile.c: menudep.h
79 schema.c: menudep.h
80 xcircuit.c: menudep.h
81 parameter.c: menudep.h
82 python.c: menudep.h
83 tclxcircuit.c: menudep.h
84 xtgui.c: menudep.h
85 xtfuncs.c: menudep.h
87 # Man page
88 M4_DEFS = @M4_DEFS@ @DEFS@
89 man_MANS = lib/xcircuit.1
91 # Main compiler arguments
92 DEFS = @DEFS@ $(PATHNAMES)
93 INCLUDES = -IXw ${INC_SPECS}
94 SHDLIB_EXT = @SHDLIB_EXT@
95 LDDL_FLAGS = @LDDL_FLAGS@
96 LDFLAGS = @LDFLAGS@
97 EXTRA_LIB_SPECS = @EXTRA_LIB_SPECS@
98 TCL_LIB_DIR = @TCL_LIB_DIR@
99 WISH_EXE = @WISH_EXE@
100 INTERPRETER = @INTERPRETER@
102 # Library directory and files
103 librarydir = $(libdir)/$(PACKAGE)-$(VERSION)
104 scriptsdir = $(libdir)/$(PACKAGE)-$(VERSION)
105 install_librarydir = @DIST_DIR@/lib/$(PACKAGE)-$(VERSION)
106 install_scriptsdir = @DIST_DIR@/lib/$(PACKAGE)-$(VERSION)
107 USER_RC_FILE = .xcircuitrc
108 PROLOGUE_FILE = xcircps2.pro
109 CYRILLIC_ENC_FILE = cyrillic.enc
110 ISOLATIN2_ENC_FILE = isolatin2.enc
111 ISOLATIN5_ENC_FILE = isolatin5.enc
112 ENCODING_FILES = ${CYRILLIC_ENC_FILE} ${ISOLATIN2_ENC_FILE} ${ISOLATIN5_ENC_FILE}
113 LGF_LIB = lgf.lps
114 ASG_SPICE_LIB = asg_spice.lps
115 SIGNAL_LIB = signal.lps
116 MUSIC_LIB = musiclib.lps
117 STARTUP_FILE = @STARTUP_FILE@
118 INTERP_PATH = @INTERP_PATH@
120 FONTS_LPS = courier courieriso2 courieriso5 helvetica helveticaiso2 \
121         helveticaiso5 myfont symbol times_roman times_romaniso2 \
122         times_romaniso5
123 FONTS_XFE = courier courieriso courieriso2 courieriso5 courier_cyrillic \
124         helvetica helveticaiso helveticaiso2 helveticaiso5 helvetica_cyrillic \
125         times_roman times_romaniso times_romaniso2 times_romaniso5 \
126         times_roman_cyrillic myfont symbol
127 SCRIPTS_PY = spice gettext pagebbox
129 WRAPPER_INIT = xcircuit.tcl
130 WRAPPER_OBJ = xcircuit${SHDLIB_EXT}
131 WRAPPER_SO = xcircuit.so
132 WRAPPER_SH = xcircuit.sh
133 CONSOLE = tkcon.tcl
134 CONSOLE_SCRIPT = console.tcl
136 menudep$(EXEEXT): menudep.o
137         $(CC) -o $@ menudep.o
139 menudep.h: menudep$(EXEEXT)
140         ./menudep$(EXEEXT)
142 xcwrap.o: xcwrap.c menudep.h
143         $(CC) ${CPPFLAGS} ${CFLAGS} ${DEFS} \
144                 $(PATHNAMES) $(INCLUDES) \
145                 xcwrap.c -c -o xcwrap.o
147 lib/$(INTERP_PATH)/$(WRAPPER_OBJ): xcwrap.o ${xcircuit_OBJECTS} ${xcircuit_DEPEND}
148         $(RM) lib/$(INTERP_PATH)/$(WRAPPER_OBJ)
149         $(SHLIB_LD) ${CFLAGS} -o $@ ${LDDL_FLAGS} xcwrap.o \
150                 ${xcircuit_OBJECTS} ${xcircuit_LDADD} ${SHLIB_LIB_SPECS} \
151                 ${LDFLAGS} ${X_EXTRA_LIBS} ${EXTRA_LIBS} -lc ${LIBS} \
152                 ${LIB_SPECS} ${EXTRA_LIB_SPECS}
154 xcircexec$(EXEEXT): xcircexec.o
155         $(RM) ./xcircexec$(EXEEXT)
156         $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(PATHNAMES) $(INCLUDES) \
157                 xcircexec.c -o xcircexec$(EXEEXT) ${LIB_SPECS} \
158                 ${LD_RUN_PATH} ${LDFLAGS} ${LIBS} ${EXTRA_LIB_SPECS}
160 xcircdnull$(EXEEXT): xcircdnull.o
161         $(RM) ./xcircdnull$(EXEEXT)
162         $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(PATHNAMES) $(INCLUDES) \
163                 xcircdnull.c -o xcircdnull$(EXEEXT) ${LIB_SPECS} \
164                 ${LD_RUN_PATH} ${LDFLAGS} ${LIBS} ${EXTRA_LIB_SPECS}
166 tcl:
167         @echo Making tcl library object
168         list='$(SUBDIRS)'; for subdir in $$list; do \
169            test "$$subdir" = . || (echo "Making tcl in $$subdir"; \
170            cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)) \
171         done
172         $(MAKE) lib/$(INTERP_PATH)/$(WRAPPER_OBJ)
173         $(MAKE) lib/$(INTERP_PATH)/$(WRAPPER_SH)
174         $(MAKE) lib/$(INTERP_PATH)/$(WRAPPER_INIT)
175         $(MAKE) xcircexec$(EXEEXT)
176         $(MAKE) xcircdnull$(EXEEXT)
178 lib/$(INTERP_PATH)/$(WRAPPER_SH): lib/$(INTERP_PATH)/$(WRAPPER_SH).in
179         sed -e '/XCLIBDIR/s#XCLIBDIR#$(librarydir)#' \
180                 -e '/WRAPPER_INIT/s/WRAPPER_INIT/$(WRAPPER_INIT)/' \
181                 -e '/CONSOLE_SCRIPT/s/CONSOLE_SCRIPT/$(CONSOLE_SCRIPT)/' \
182                 -e '/CONSOLE/s/CONSOLE/$(CONSOLE)/' \
183                 -e '/PROG_VERSION/s/PROG_VERSION/$(VERSION)/' \
184                 -e '/PROG_REVISION/s/PROG_REVISION/$(REVISION)/' \
185                 -e '/TCLLIBDIR/s#TCLLIBDIR#$(TCL_LIB_DIR)#' \
186                 -e '/WISH_EXE/s#WISH_EXE#$(WISH_EXE)#' \
187                 lib/$(INTERP_PATH)/$(WRAPPER_SH).in > $@
188         chmod 0755 $@
190 lib/$(INTERP_PATH)/$(WRAPPER_INIT): lib/$(INTERP_PATH)/$(WRAPPER_INIT).in
191         sed -e '/LIBDIR/s#LIBDIR#$(librarydir)#' \
192                 -e '/SCRIPTSDIR/s#SCRIPTSDIR#$(scriptsdir)#' \
193                 lib/$(INTERP_PATH)/$(WRAPPER_INIT).in > $@
194         chmod 0755 $@
196 lib/xcircuit.1: lib/xcircuit.1.in
197         sed -e '/LIBDIR/s#LIBDIR#$(libdir)#' \
198                 -e "/^${HAVE_LGF}/s/^${HAVE_LGF} //" \
199                 -e "/^${INTERPRETER}/s/^${INTERPRETER} //" \
200                 -e '/^PYTHON /d' \
201                 -e '/^TCL /d' \
202                 -e '/^LGF /d' \
203                 -e '/^NOINTERP /d' \
204                 lib/xcircuit.1.in > $@
206 install-data-local: lib/xcircuit.1
207         @echo "Installing app-defaults file"
208         $(mkinstalldirs) $(DESTDIR)$(install_appdefaultsdir)
209         $(mkinstalldirs) $(DESTDIR)$(install_appmandir)
210         $(INSTALL_DATA) lib/XCircuit.ad $(DESTDIR)$(install_appdefaultsdir)/XCircuit
211         $(INSTALL_DATA) lib/xcircuit.1 $(DESTDIR)$(install_appmandir)/xcircuit.1
212         @echo "Installing library and netlist files"
213         $(mkinstalldirs) $(DESTDIR)$(install_librarydir)
214         ( cd lib ; for i in $(PROLOGUE_FILE) $(ENCODING_FILES) *.lps *.cir; do \
215                 $(INSTALL_DATA) $$i $(DESTDIR)$(install_librarydir); \
216         done )
217         ( cd lib/$(INTERP_PATH) ; for i in $(STARTUP_FILE); do \
218                 $(INSTALL_DATA) $$i $(DESTDIR)$(install_librarydir); \
219         done )
220         @echo "Installing .lps font files"
221         $(mkinstalldirs) $(DESTDIR)$(install_librarydir)/fonts
222         for i in $(FONTS_LPS); do \
223                 $(INSTALL_DATA) lib/fonts/$$i.lps $(DESTDIR)$(install_librarydir)/fonts; \
224         done
225         @echo "Installing .xfe font files"
226         for i in $(FONTS_XFE); do \
227                 $(INSTALL_DATA) lib/fonts/$$i.xfe $(DESTDIR)$(install_librarydir)/fonts; \
228         done
229         @echo "Installing scripts (if option enabled)"
230         if test "$(PYTHON)" != ""; then \
231                 $(mkinstalldirs) $(DESTDIR)$(install_scriptsdir)/python; \
232                 for i in $(SCRIPTS_PY); do \
233                         $(INSTALL_DATA) lib/python/$$i.py \
234                                 $(DESTDIR)$(install_scriptsdir)/python; \
235                 done; \
236         fi
238 # Note that MacOS/Fink uses SHDLIB_EXT = .dylib but Tcl expects .so anyway.
239 # So we make a symbolic link if SHDLIB_EXT != .so
241 install-tcl: xcircexec$(EXEEXT) xcircdnull$(EXEEXT) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH) lib/$(INTERP_PATH)/$(WRAPPER_INIT)
242         @echo "Installing standard XCircuit library files"
243         $(MAKE) $(AM_MAKEFLAGS) install-data-local
244         @echo "Installing Tcl files"
245         $(mkinstalldirs) $(DESTDIR)$(install_librarydir)
246         $(mkinstalldirs) $(DESTDIR)$(install_scriptsdir)
247         ( cd lib/$(INTERP_PATH) ; for i in $(WRAPPER_OBJ) *.tcl ; do \
248                 $(INSTALL_DATA) $$i $(DESTDIR)$(install_scriptsdir); \
249                 done )
250         $(INSTALL_DATA) xcircexec$(EXEEXT) $(DESTDIR)$(install_librarydir)
251         $(INSTALL_DATA) xcircdnull$(EXEEXT) $(DESTDIR)$(install_librarydir)
252         chmod 0755 $(DESTDIR)$(install_librarydir)/$(CONSOLE)
253         chmod 0755 $(DESTDIR)$(install_librarydir)/$(CONSOLE_SCRIPT)
254         chmod 0755 $(DESTDIR)$(install_librarydir)/$(WRAPPER_OBJ)
255         chmod 0755 $(DESTDIR)$(install_librarydir)/xcircexec$(EXEEXT)
256         chmod 0755 $(DESTDIR)$(install_librarydir)/xcircdnull$(EXEEXT)
258         if test "${SHDLIB_EXT}" != ".so"; then \
259           ( cd $(DESTDIR)$(install_librarydir); \
260             $(RM) $(WRAPPER_SO) ; \
261             ln -s $(WRAPPER_OBJ) $(WRAPPER_SO) ) ; \
262         fi
264         @echo "Installing GIF images"
265         $(mkinstalldirs) $(DESTDIR)$(install_librarydir)/pixmaps
266         ( cd lib/pixmaps ; for i in `ls *.gif *.xbm *.ico` ; do \
267                 $(INSTALL_DATA) $$i $(DESTDIR)$(install_librarydir)/pixmaps; \
268         done )
269         @echo "Installing shell script as xcircuit executable"
270         $(mkinstalldirs) $(DESTDIR)$(install_bindir)
271         $(INSTALL_DATA) lib/$(INTERP_PATH)/$(WRAPPER_SH) $(DESTDIR)$(install_bindir)/xcircuit
272         chmod 0755 $(DESTDIR)$(install_bindir)/xcircuit
274 clean:
275         (cd ./Xw; $(RM) *.o *.a *.bak core)
276         (cd ./asg; $(MAKE) clean)
277         (cd ./spiceparser; $(MAKE) clean)
278         $(RM) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH)
279         $(RM) lib/$(INTERP_PATH)/$(WRAPPER_INIT)
280         $(RM) xcircuit *.o *.bak lib/xcircuit.1 core
281         $(RM) xcircexec$(EXEEXT) xcircdnull$(EXEEXT)
282         $(RM) menudep$(EXEEXT) menudep.h
283         $(RM) config.cache config.log
285 distclean:
286         (cd ./Xw; $(RM) *.o *.a *.bak Makefile core)
287         (cd ./asg; $(MAKE) clean ; $(RM) Makefile)
288         (cd ./spiceparser; $(MAKE) clean ; $(RM) Makefile)
289         $(RM) xcircuit *.o *.bak core
290         $(RM) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH)
291         $(RM) menudep$(EXEEXT) menudep.h lib/xcircuit.1
292         $(RM) xcircexec$(EXEEXT) xcircdnull$(EXEEXT)
293         $(RM) Makefile config.cache config.log config.status
294         $(RM) xcircuit-$(FULL_VERSION) xcircuit.spec xcircuit-$(FULL_VERSION).tgz
296 dist:
297         $(RM) xcircuit.spec xcircuit-$(FULL_VERSION) xcircuit-$(FULL_VERSION).tgz
298         sed -e /%VERSION%/s/%VERSION%/$(FULL_VERSION)/ \
299             xcircuit.spec.in > xcircuit.spec
300         ln -nsf . xcircuit-$(FULL_VERSION)
301         tar zchvf xcircuit-$(FULL_VERSION).tgz --exclude CVS \
302             --exclude xcircuit-$(FULL_VERSION)/xcircuit-$(FULL_VERSION) \
303             --exclude xcircuit-$(FULL_VERSION)/xcircuit-$(FULL_VERSION).tgz \
304             xcircuit-$(FULL_VERSION)
306 quiteclean:
307         (cd ./Xw; $(RM) *.o *.a *.bak Makefile.in Makefile core)
308         (cd ./asg; $(MAKE) clean ; $(RM) Makefile.in Makefile)
309         (cd ./spiceparser; $(MAKE) clean ; $(RM) Makefile.in Makefile)
310         $(RM) xcircuit *.o *.bak core
311         $(RM) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH)
312         $(RM) menudep$(EXEEXT) menudep.h lib/xcircuit.1
313         $(RM) xcircexec$(EXEEXT) xcircdnull$(EXEEXT)
314         $(RM) install-sh missing mkinstalldirs Makefile.in Makefile
315         $(RM) config.* aclocal.m4
317 $(ALL_TARGET):
318         $(MAKE) tcl
320 $(INSTALL_TARGET):
321         $(MAKE) install-tcl