Merge branch 'master' into xcircuit-3.10
[xcircuit.git] / Makefile.am
blob90a83572b82d2e4cdc7670995610e0820fd91427
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 PATHNAMES = -DPROG_VERSION=\"$(VERSION)\" \
38         -DPROG_REVISION=\"$(REVISION)\" \
39         -DCAD_DIR=\"$(libdir)\" \
40         -DTEMP_DIR=\"$(tmpdir)\" \
41         -DRESOURCES_DIR=\"$(appdefaultsdir)\" \
42         -DSCRIPTS_DIR=\"$(scriptsdir)\" \
43         -DBUILTINS_DIR=\"$(librarydir)\" \
44         -DBUILTINS_FILE=\"$(BUILTINS_FILE)\" \
45         -DUSER_RC_FILE=\"$(USER_RC_FILE)\" \
46         -DPROLOGUE_DIR=\"$(librarydir)\" \
47         -DPROLOGUE_FILE=\"$(PROLOGUE_FILE)\" \
48         -DCYRILLIC_ENC_FILE=\"$(CYRILLIC_ENC_FILE)\" \
49         -DISOLATIN2_ENC_FILE=\"$(ISOLATIN2_ENC_FILE)\" \
50         -DISOLATIN5_ENC_FILE=\"$(ISOLATIN5_ENC_FILE)\" \
51         -DSTARTUP_FILE=\"$(STARTUP_FILE)\" \
52         -DLGF_LIB=\"$(LGF_LIB)\" \
53         -DASG_SPICE_LIB=\"$(ASG_SPICE_LIB)\"
55 xcircuit_SOURCES = elements.c events.c filelist.c files.c \
56         flate.c fontfile.c formats.c functions.c graphic.c \
57         help.c keybindings.c libraries.c menucalls.c \
58         netlist.c ngspice.c parameter.c python.c \
59         rcfile.c render.c schema.c selection.c svg.c text.c undo.c \
60         tclxcircuit.c tkSimple.c xcircuit.c xtfuncs.c xtgui.c \
61         cairo.c utf8encodings.c
62 cairo.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
63 elements.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
64 events.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
65 fontfile.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
66 text.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
67 utf8encodings.$(OBJEXT) : CFLAGS += -pedantic -Wall -Wextra
69 xcircuit_DEPEND = @SUBLIB@
70 xcircuit_LDADD = @SUBLIB@ @STDLIBS@
72 help.c: menudep.h
73 menucalls.c: menudep.h
74 rcfile.c: menudep.h
75 schema.c: menudep.h
76 xcircuit.c: menudep.h
77 parameter.c: menudep.h
78 python.c: menudep.h
79 tclxcircuit.c: menudep.h
80 xtgui.c: menudep.h
81 xtfuncs.c: menudep.h
83 # Man page
84 M4_DEFS = @M4_DEFS@ @DEFS@
85 man_MANS = lib/xcircuit.1
87 # Main compiler arguments
88 DEFS = @DEFS@ $(PATHNAMES)
89 INCLUDES = -IXw ${INC_SPECS}
90 SHDLIB_EXT = @SHDLIB_EXT@
91 LDDL_FLAGS = @LDDL_FLAGS@
92 LDFLAGS = @LDFLAGS@
93 EXTRA_LIB_SPECS = @EXTRA_LIB_SPECS@
94 TCL_LIB_DIR = @TCL_LIB_DIR@
95 WISH_EXE = @WISH_EXE@
96 INTERPRETER = @INTERPRETER@
98 # Library directory and files
99 librarydir = $(libdir)/$(PACKAGE)-$(VERSION)
100 scriptsdir = $(libdir)/$(PACKAGE)-$(VERSION)
101 USER_RC_FILE = .xcircuitrc
102 PROLOGUE_FILE = xcircps2.pro
103 CYRILLIC_ENC_FILE = cyrillic.enc
104 ISOLATIN2_ENC_FILE = isolatin2.enc
105 ISOLATIN5_ENC_FILE = isolatin5.enc
106 ENCODING_FILES = ${CYRILLIC_ENC_FILE} ${ISOLATIN2_ENC_FILE} ${ISOLATIN5_ENC_FILE}
107 LGF_LIB = lgf.lps
108 ASG_SPICE_LIB = asg_spice.lps
109 SIGNAL_LIB = signal.lps
110 MUSIC_LIB = musiclib.lps
111 STARTUP_FILE = @STARTUP_FILE@
112 INTERP_PATH = @INTERP_PATH@
114 FONTS_LPS = courier courieriso2 courieriso5 helvetica helveticaiso2 \
115         helveticaiso5 myfont symbol times_roman times_romaniso2 \
116         times_romaniso5
117 FONTS_XFE = courier courieriso courieriso2 courieriso5 courier_cyrillic \
118         helvetica helveticaiso helveticaiso2 helveticaiso5 helvetica_cyrillic \
119         times_roman times_romaniso times_romaniso2 times_romaniso5 \
120         times_roman_cyrillic myfont symbol
121 SCRIPTS_PY = spice gettext pagebbox
123 WRAPPER_INIT = xcircuit.tcl
124 WRAPPER_OBJ = xcircuit${SHDLIB_EXT}
125 WRAPPER_SO = xcircuit.so
126 WRAPPER_SH = xcircuit.sh
127 CONSOLE = tkcon.tcl
128 CONSOLE_SCRIPT = console.tcl
130 menudep$(EXEEXT): menudep.o
131         $(CC) -o $@ menudep.o
133 menudep.h: menudep$(EXEEXT)
134         ./menudep$(EXEEXT)
136 xcwrap.o: xcwrap.c menudep.h
137         $(CC) ${CPPFLAGS} ${CFLAGS} ${DEFS} \
138                 $(PATHNAMES) $(INCLUDES) \
139                 xcwrap.c -c -o xcwrap.o
141 lib/$(INTERP_PATH)/$(WRAPPER_OBJ): xcwrap.o ${xcircuit_OBJECTS} ${xcircuit_DEPEND}
142         $(RM) lib/$(INTERP_PATH)/$(WRAPPER_OBJ)
143         $(SHLIB_LD) ${CFLAGS} -o $@ ${LDDL_FLAGS} xcwrap.o \
144                 ${xcircuit_OBJECTS} ${xcircuit_LDADD} ${SHLIB_LIB_SPECS} \
145                 ${LDFLAGS} ${X_EXTRA_LIBS} ${EXTRA_LIBS} -lc ${LIBS} \
146                 ${LIB_SPECS} ${EXTRA_LIB_SPECS}
148 xcircexec$(EXEEXT): xcircexec.o
149         $(RM) ./xcircexec$(EXEEXT)
150         $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(PATHNAMES) $(INCLUDES) \
151                 xcircexec.c -o xcircexec$(EXEEXT) ${LIB_SPECS} \
152                 ${LD_RUN_PATH} ${LDFLAGS} ${LIBS} ${EXTRA_LIB_SPECS}
154 xcircdnull$(EXEEXT): xcircdnull.o
155         $(RM) ./xcircdnull$(EXEEXT)
156         $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(PATHNAMES) $(INCLUDES) \
157                 xcircdnull.c -o xcircdnull$(EXEEXT) ${LIB_SPECS} \
158                 ${LD_RUN_PATH} ${LDFLAGS} ${LIBS} ${EXTRA_LIB_SPECS}
160 tcl:
161         @echo Making tcl library object
162         list='$(SUBDIRS)'; for subdir in $$list; do \
163            test "$$subdir" = . || (echo "Making tcl in $$subdir"; \
164            cd $$subdir && $(MAKE) $(AM_MAKEFLAGS)) \
165         done
166         $(MAKE) lib/$(INTERP_PATH)/$(WRAPPER_OBJ)
167         $(MAKE) lib/$(INTERP_PATH)/$(WRAPPER_SH)
168         $(MAKE) lib/$(INTERP_PATH)/$(WRAPPER_INIT)
169         $(MAKE) xcircexec$(EXEEXT)
170         $(MAKE) xcircdnull$(EXEEXT)
172 lib/$(INTERP_PATH)/$(WRAPPER_SH): lib/$(INTERP_PATH)/$(WRAPPER_SH).in
173         sed -e '/XCLIBDIR/s#XCLIBDIR#$(librarydir)#' \
174                 -e '/WRAPPER_INIT/s/WRAPPER_INIT/$(WRAPPER_INIT)/' \
175                 -e '/CONSOLE_SCRIPT/s/CONSOLE_SCRIPT/$(CONSOLE_SCRIPT)/' \
176                 -e '/CONSOLE/s/CONSOLE/$(CONSOLE)/' \
177                 -e '/PROG_VERSION/s/PROG_VERSION/$(VERSION)/' \
178                 -e '/PROG_REVISION/s/PROG_REVISION/$(REVISION)/' \
179                 -e '/TCLLIBDIR/s#TCLLIBDIR#$(TCL_LIB_DIR)#' \
180                 -e '/WISH_EXE/s#WISH_EXE#$(WISH_EXE)#' \
181                 lib/$(INTERP_PATH)/$(WRAPPER_SH).in > $@
182         chmod 0755 $@
184 lib/$(INTERP_PATH)/$(WRAPPER_INIT): lib/$(INTERP_PATH)/$(WRAPPER_INIT).in
185         sed -e '/LIBDIR/s#LIBDIR#$(librarydir)#' \
186                 -e '/SCRIPTSDIR/s#SCRIPTSDIR#$(scriptsdir)#' \
187                 lib/$(INTERP_PATH)/$(WRAPPER_INIT).in > $@
188         chmod 0755 $@
190 lib/xcircuit.1: lib/xcircuit.1.in
191         sed -e '/LIBDIR/s#LIBDIR#$(libdir)#' \
192                 -e "/^${HAVE_LGF}/s/^${HAVE_LGF} //" \
193                 -e "/^${INTERPRETER}/s/^${INTERPRETER} //" \
194                 -e '/^PYTHON /d' \
195                 -e '/^TCL /d' \
196                 -e '/^LGF /d' \
197                 -e '/^NOINTERP /d' \
198                 lib/xcircuit.1.in > $@
200 install-data-local: lib/xcircuit.1
201         @echo "Installing app-defaults file"
202         $(mkinstalldirs) $(DESTDIR)$(appdefaultsdir)
203         $(mkinstalldirs) $(DESTDIR)$(appmandir)
204         $(INSTALL_DATA) lib/XCircuit.ad $(DESTDIR)$(appdefaultsdir)/XCircuit
205         $(INSTALL_DATA) lib/xcircuit.1 $(DESTDIR)$(appmandir)/xcircuit.1
206         @echo "Installing library and netlist files"
207         $(mkinstalldirs) $(DESTDIR)$(librarydir)
208         ( cd lib ; for i in $(PROLOGUE_FILE) $(ENCODING_FILES) *.lps *.cir; do \
209                 $(INSTALL_DATA) $$i $(DESTDIR)$(librarydir); \
210         done )
211         ( cd lib/$(INTERP_PATH) ; for i in $(STARTUP_FILE); do \
212                 $(INSTALL_DATA) $$i $(DESTDIR)$(librarydir); \
213         done )
214         @echo "Installing .lps font files"
215         $(mkinstalldirs) $(DESTDIR)$(librarydir)/fonts
216         for i in $(FONTS_LPS); do \
217                 $(INSTALL_DATA) lib/fonts/$$i.lps $(DESTDIR)$(librarydir)/fonts; \
218         done
219         @echo "Installing .xfe font files"
220         for i in $(FONTS_XFE); do \
221                 $(INSTALL_DATA) lib/fonts/$$i.xfe $(DESTDIR)$(librarydir)/fonts; \
222         done
223         @echo "Installing scripts (if option enabled)"
224         if test "$(PYTHON)" != ""; then \
225                 $(mkinstalldirs) $(DESTDIR)$(scriptsdir)/python; \
226                 for i in $(SCRIPTS_PY); do \
227                         $(INSTALL_DATA) lib/python/$$i.py \
228                                 $(DESTDIR)$(scriptsdir)/python; \
229                 done; \
230         fi
232 # Note that MacOS/Fink uses SHDLIB_EXT = .dylib but Tcl expects .so anyway.
233 # So we make a symbolic link if SHDLIB_EXT != .so
235 install-tcl: xcircexec$(EXEEXT) xcircdnull$(EXEEXT) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH) lib/$(INTERP_PATH)/$(WRAPPER_INIT)
236         @echo "Installing standard XCircuit library files"
237         $(MAKE) $(AM_MAKEFLAGS) install-data-local
238         @echo "Installing Tcl files"
239         $(mkinstalldirs) $(DESTDIR)$(librarydir)
240         $(mkinstalldirs) $(DESTDIR)$(scriptsdir)
241         ( cd lib/$(INTERP_PATH) ; for i in $(WRAPPER_OBJ) *.tcl ; do \
242                 $(INSTALL_DATA) $$i $(DESTDIR)$(scriptsdir); \
243                 done )
244         $(INSTALL_DATA) xcircexec$(EXEEXT) $(DESTDIR)$(librarydir)
245         $(INSTALL_DATA) xcircdnull$(EXEEXT) $(DESTDIR)$(librarydir)
246         chmod 0755 $(DESTDIR)$(librarydir)/$(CONSOLE)
247         chmod 0755 $(DESTDIR)$(librarydir)/$(CONSOLE_SCRIPT)
248         chmod 0755 $(DESTDIR)$(librarydir)/$(WRAPPER_OBJ)
249         chmod 0755 $(DESTDIR)$(librarydir)/xcircexec$(EXEEXT)
250         chmod 0755 $(DESTDIR)$(librarydir)/xcircdnull$(EXEEXT)
252         if test "${SHDLIB_EXT}" != ".so"; then \
253           ( cd $(DESTDIR)$(librarydir); \
254             $(RM) $(WRAPPER_SO) ; \
255             ln -s $(WRAPPER_OBJ) $(WRAPPER_SO) ) ; \
256         fi
258         @echo "Installing GIF images"
259         $(mkinstalldirs) $(DESTDIR)$(librarydir)/pixmaps
260         ( cd lib/pixmaps ; for i in `ls *.gif *.xbm *.ico` ; do \
261                 $(INSTALL_DATA) $$i $(DESTDIR)$(librarydir)/pixmaps; \
262         done )
263         @echo "Installing shell script as xcircuit executable"
264         $(mkinstalldirs) $(DESTDIR)$(bindir)
265         $(INSTALL_DATA) lib/$(INTERP_PATH)/$(WRAPPER_SH) $(DESTDIR)$(bindir)/xcircuit
266         chmod 0755 $(DESTDIR)$(bindir)/xcircuit
268 clean:
269         (cd ./Xw; $(RM) *.o *.a *.bak core)
270         (cd ./asg; $(MAKE) clean)
271         (cd ./spiceparser; $(MAKE) clean)
272         $(RM) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH)
273         $(RM) lib/$(INTERP_PATH)/$(WRAPPER_INIT)
274         $(RM) xcircuit *.o *.bak lib/xcircuit.1 core
275         $(RM) xcircexec$(EXEEXT) xcircdnull$(EXEEXT)
276         $(RM) menudep$(EXEEXT) menudep.h
277         $(RM) config.cache config.log
279 distclean:
280         (cd ./Xw; $(RM) *.o *.a *.bak Makefile core)
281         (cd ./asg; $(MAKE) clean ; $(RM) Makefile)
282         (cd ./spiceparser; $(MAKE) clean ; $(RM) Makefile)
283         $(RM) xcircuit *.o *.bak core
284         $(RM) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH)
285         $(RM) menudep$(EXEEXT) menudep.h lib/xcircuit.1
286         $(RM) xcircexec$(EXEEXT) xcircdnull$(EXEEXT)
287         $(RM) Makefile config.cache config.log config.status
288         $(RM) xcircuit-$(FULL_VERSION) xcircuit.spec xcircuit-$(FULL_VERSION).tgz
290 dist:
291         $(RM) xcircuit.spec xcircuit-$(FULL_VERSION) xcircuit-$(FULL_VERSION).tgz
292         sed -e /%VERSION%/s/%VERSION%/$(FULL_VERSION)/ \
293             xcircuit.spec.in > xcircuit.spec
294         ln -nsf . xcircuit-$(FULL_VERSION)
295         tar zchvf xcircuit-$(FULL_VERSION).tgz --exclude CVS \
296             --exclude xcircuit-$(FULL_VERSION)/xcircuit-$(FULL_VERSION) \
297             --exclude xcircuit-$(FULL_VERSION)/xcircuit-$(FULL_VERSION).tgz \
298             xcircuit-$(FULL_VERSION)
300 quiteclean:
301         (cd ./Xw; $(RM) *.o *.a *.bak Makefile.in Makefile core)
302         (cd ./asg; $(MAKE) clean ; $(RM) Makefile.in Makefile)
303         (cd ./spiceparser; $(MAKE) clean ; $(RM) Makefile.in Makefile)
304         $(RM) xcircuit *.o *.bak core
305         $(RM) lib/$(INTERP_PATH)/$(WRAPPER_OBJ) lib/$(INTERP_PATH)/$(WRAPPER_SH)
306         $(RM) menudep$(EXEEXT) menudep.h lib/xcircuit.1
307         $(RM) xcircexec$(EXEEXT) xcircdnull$(EXEEXT)
308         $(RM) install-sh missing mkinstalldirs Makefile.in Makefile
309         $(RM) config.* aclocal.m4
311 $(ALL_TARGET):
312         $(MAKE) tcl
314 $(INSTALL_TARGET):
315         $(MAKE) install-tcl