XEmacs 21.2.14.
[chise/xemacs-chise.git.1] / lib-src / Makefile.in.in
1 ##   Makefile for lib-src subdirectory in XEmacs.
2 ##   Copyright (C) 1985, 1987, 1988, 1993, 1994 Free Software Foundation, Inc.
3 ##   Copyright (C) 1996, 1997 Sun Microsystems, Inc.
4
5 ## This file is part of XEmacs.
6
7 ## XEmacs is free software; you can redistribute it and/or modify it
8 ## under the terms of the GNU General Public License as published by the
9 ## Free Software Foundation; either version 2, or (at your option) any
10 ## later version.
11
12 ## XEmacs is distributed in the hope that it will be useful, but WITHOUT
13 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 ## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 ## for more details.
16
17 ## You should have received a copy of the GNU General Public License
18 ## along with XEmacs; see the file COPYING.  If not, write to
19 ## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 ## Boston, MA 02111-1307, USA.
21
22 ## Note: FSF Makefile.in.in does something weird so that the comments
23 ## above a certain point in this file are in shell format instead of
24 ## in C format.  How the hell is this supposed to work? */
25
26 ## For performance and consistency, no built-in rules
27 .SUFFIXES:
28 .SUFFIXES: .c .h .o
29 ## ==================== Things "configure" will edit ====================
30
31 @SET_MAKE@
32 SHELL = /bin/sh
33 RM = rm -f
34 pwd = /bin/pwd
35
36 CC=@CC@
37 CPP=@CPP@
38 CFLAGS=@CFLAGS@
39 CPPFLAGS=@CPPFLAGS@
40 LDFLAGS=@LDFLAGS@
41 ALLOCA=@ALLOCA@
42 LN_S=@LN_S@
43 version=@version@
44
45 ## This will be the name of the generated binary and is set automatically
46 ## by configure.
47 PROGNAME=@PROGNAME@
48
49 ## ==================== Where To Install Things ====================
50
51 prefix=@prefix@
52 exec_prefix=@exec_prefix@
53 bindir=@bindir@
54 libdir=@libdir@
55 srcdir=@srcdir@
56 top_srcdir=@top_srcdir@
57 archlibdir=@archlibdir@
58 configuration=@configuration@
59 moduledir=@moduledir@
60 sitemoduledir=@sitemoduledir@
61
62 ## ==================== Utility Programs for the Build =================
63
64 INSTALL = @install_pp@ @INSTALL@
65 INSTALL_PROGRAM = @INSTALL_PROGRAM@
66 INSTALL_DATA = @INSTALL_DATA@
67
68 ## ========================== Lists of Files ===========================
69
70 #define NO_SHORTNAMES
71 #define NOT_C_CODE
72 #include "../src/config.h"
73
74 ## Things that a user might actually run,
75 ## which should be installed in bindir.
76 #ifdef WINDOWSNT
77 INSTALLABLES_BASE = etags ctags b2m ootags
78 #else
79 INSTALLABLES_BASE = etags ctags b2m gnuclient ootags
80 #endif
81 INSTALLABLE_SCRIPTS = rcs-checkin pstogif gnudoit gnuattach
82 #ifdef HAVE_SHLIB
83 #ifdef HAVE_MS_WINDOWS
84 INSTALLABLES = $(INSTALLABLES_BASE) runxemacs rungnuclient ellcc
85 #else
86 INSTALLABLES = $(INSTALLABLES_BASE) ellcc
87 #endif
88 #else
89 #ifdef HAVE_MS_WINDOWS
90 INSTALLABLES = $(INSTALLABLES_BASE) runxemacs rungnuclient
91 #else
92 INSTALLABLES = $(INSTALLABLES_BASE) 
93 #endif
94 #endif
95
96
97 ## Things that Emacs runs internally, or during the build process,
98 ## which should not be installed in bindir.
99 #ifdef WINDOWSNT
100 UTILITIES= make-path wakeup profile make-docfile digest-doc \
101         sorted-doc movemail cvtmail yow hexl \
102         mmencode
103 #else
104 UTILITIES= make-path wakeup profile make-docfile digest-doc \
105         sorted-doc movemail cvtmail fakemail yow hexl \
106         gnuserv mmencode
107 #endif
108 ## These need to be conditional on I18N3 make-msgfile make-po
109
110 ## Like UTILITIES, but they are not system-dependent, and should not be
111 ## deleted by the distclean target.
112 GEN_SCRIPTS = rcs2log vcdiff gzip-el.sh
113 PKG_SCRIPTS = add-big-package.sh
114 SCRIPTS = $(GEN_SCRIPTS) $(PKG_SCRIPTS)
115
116 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
117
118 SOURCES = COPYING ChangeLog Makefile.in.in README aixcc.lex emacs.csh \
119         makedoc.com *.[chy] $(SCRIPTS)
120 ## Additional -D flags for movemail (add to MOVE_FLAGS if desired):
121 ## MAIL_USE_POP         Support mail retrieval from a POP mailbox.
122 ## MAIL_USE_MMDF                Support MMDF mailboxes.
123 ## MAIL_USE_FLOCK       Use flock for file locking (see the comments
124 ##                      about locking in movemail.c)
125 ## MAIL_UNLINK_SPOOL    Unlink the user spool mailbox after reading
126 ##                      it (instead of just emptying it).
127 ## KERBEROS             Support Kerberized POP.
128 ## KRB5                 Support Kerberos Version 5 pop instead of
129 ##                      Version 4 (define this in addition to
130 ##                      KERBEROS).
131 ## HESIOD               Support Hesiod lookups of user mailboxes.
132 ## MAILHOST             A string, the host name of the default POP
133 ##                      mail host for the site.
134
135 MOVE_FLAGS=
136 ##
137 ## Additional libraries for movemail:
138 ## For KERBEROS
139 ## MOVE_LIBS= -lkrb -ldes -lcom_err
140 ## For KERBEROS + KRB5
141 ## MOVE_LIBS= -lkrb5 -lcrypto -lisode -lcom_err
142 ## Add "-lhesiod" if HESIOD is defined.
143
144 MOVE_LIBS=
145
146 ## ========================== start of cpp stuff =======================
147
148 #ifdef USE_GNU_MAKE
149 vpath %.c @srcdir@
150 vpath %.h @srcdir@
151 #else
152 VPATH=@srcdir@
153 #endif
154
155 c_switch_general=@c_switch_general@
156 c_switch_all=@c_switch_all@
157 ld_switch_general=@ld_switch_general@
158 ld_switch_all=@ld_switch_all@
159 ld_libs_general=@ld_libs_general@
160
161 ## We need to #define emacs to get the right versions of some files.
162
163 cppflags = -Demacs -I$(top_srcdir)/src -I../src $(CPPFLAGS)
164 cflags   = $(CFLAGS) $(cppflags) $(c_switch_general)
165 ldflags  = $(LDFLAGS) $(ld_switch_general) $(ld_libs_general)
166
167 ## This is the default compilation command.
168 ## But we should never rely on it, because some make version
169 ## failed to find it for getopt.o.
170 ## Using an explicit command made it work.
171 .c.o:
172         ${CC} -c $(cflags) $<
173
174 all: ${UTILITIES} ${INSTALLABLES} srcdir-symlink.stamp
175
176 ## Make symlinks for shell scripts if using --srcdir
177 srcdir-symlink.stamp:
178         for f in ${SCRIPTS}; do \
179                 if test ! -r $$f; then ${LN_S} ${srcdir}/$$f $$f; fi; \
180         done; \
181         touch $@;
182
183 #undef MOVEMAIL_NEEDS_BLESSING
184 #if !defined (MAIL_USE_FLOCK) && ! defined (MAIL_USE_LOCKF)
185 #define MOVEMAIL_NEEDS_BLESSING
186 blessmail = blessmail
187 blessmail:
188         ../src/xemacs -batch -l ../lisp/blessmail.el
189         chmod +x $@
190 #endif /* movemail needs blessing */
191
192 maybe-blessmail: $(blessmail)
193 #ifdef MOVEMAIL_NEEDS_BLESSING
194 ## Do not charge ahead and do it!  Let the installer decide.
195 ##        ./blessmail ${archlibdir}/movemail
196         @if test `wc -l <blessmail` != 2; then \
197           dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
198           echo "*************************************************************";\
199           echo "Assuming $$dir is really the mail spool directory, you should";\
200           echo "run  lib-src/blessmail ${archlibdir}/movemail"; \
201           echo "as root, to give  movemail  appropriate permissions."; \
202           echo "Do that after running  make install."; \
203           echo "You can also do  make blessmail. "; \
204           echo "*************************************************************";\
205         fi
206 #endif
207
208 do-blessmail: $(blessmail)
209 #ifdef MOVEMAIL_NEEDS_BLESSING
210         ./blessmail ${archlibdir}/movemail
211 #endif
212
213 ## Install the internal utilities.  Until they are installed, we can
214 ## just run them directly from lib-src.
215 ${archlibdir}: all
216         @echo; echo "Installing utilities run internally by XEmacs."
217         ./make-path ${archlibdir}
218         if test "`(cd ${archlibdir} && $(pwd))`" != "`$(pwd)`"; then \
219           for f in ${UTILITIES}; do \
220             (cd .. && $(INSTALL_PROGRAM) lib-src/$$f ${archlibdir}/$$f) ; \
221           done ; \
222         fi
223         if test "`(cd ${archlibdir} && $(pwd))`" \
224              != "`(cd ${srcdir}     && $(pwd))`"; then \
225           for f in ${SCRIPTS}; do \
226             (cd .. && $(INSTALL_PROGRAM) ${srcdir}/$$f ${archlibdir}/$$f); \
227           done ; \
228         fi
229
230 ## We do not need to install "wakeup" explicitly, because it will be
231 ## copied when this whole directory is copied.
232 .PHONY : all maybe-blessmail install uninstall
233 install: ${archlibdir}
234         @echo; echo "Installing utilities for users to run."
235         for file in ${INSTALLABLES} ; do \
236           (cd .. && $(INSTALL_PROGRAM) lib-src/$${file} ${bindir}/$${file}) ; \
237         done
238         for file in ${INSTALLABLE_SCRIPTS} ; do \
239           (cd .. && $(INSTALL_PROGRAM) ${srcdir}/$${file} ${bindir}/$${file}) ; \
240         done
241
242 uninstall:
243         (cd ${bindir} && \
244          $(RM) ${INSTALLABLES} ${INSTALLABLE_SCRIPTS})
245         (cd ${archlibdir} && \
246          $(RM) ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS})
247
248 .PHONY: mostlyclean clean distclean realclean extraclean
249 mostlyclean:
250         $(RM) *.o *.i core
251 clean: mostlyclean
252         $(RM) ${INSTALLABLES} ${UTILITIES} *.exe
253 distclean: clean
254         $(RM) DOC *.tab.c *.tab.h aixcc.c TAGS ellcc.h
255         $(RM) GNUmakefile Makefile Makefile.in blessmail config.values
256 realclean: distclean
257 extraclean: distclean
258         $(RM) *~ \#*
259
260 .PHONY: unlock relock check
261 unlock:
262         chmod u+w $(SOURCES)
263 relock:
264         chmod u-w $(SOURCES)
265
266 ## Test the contents of the directory.
267 check:
268         @echo "We don't have any tests for XEmacs yet."
269
270 TAGS: etags
271         etags *.[ch]
272
273 GETOPTOBJS = getopt.o getopt1.o $(ALLOCA)
274 GETOPTDEPS = $(GETOPTOBJS) ${srcdir}/getopt.h
275 getopt.o: ${srcdir}/getopt.c ${srcdir}/getopt.h
276         ${CC} -c $(cflags) ${srcdir}/getopt.c
277 getopt1.o: ${srcdir}/getopt1.c ${srcdir}/getopt.h
278         ${CC} -c $(cflags) ${srcdir}/getopt1.c
279 alloca.o: ${srcdir}/../src/alloca.c
280         ${CC} -c $(cflags) ${srcdir}/../src/alloca.c
281
282 regex.o: ${srcdir}/../src/regex.c ${srcdir}/../src/regex.h
283         $(CC) -c `echo $(cflags) | sed 's/-Demacs/ /'` \
284                 -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
285
286 etags_args = -I. $(cflags) -I${srcdir} -I${srcdir}/../src \
287         -DVERSION='"${version}"' ${srcdir}/etags.c \
288         $(GETOPTOBJS) regex.o $(ldflags)
289 etags_deps   = ${srcdir}/etags.c $(GETOPTDEPS) regex.o ../src/config.h
290
291 etags: ${etags_deps}
292         $(CC) ${etags_args} -o $@
293
294 ellcc_args = -I. $(cflags) -I${srcdir} -I${srcdir}/../src \
295     ${srcdir}/ellcc.c $(ldflags)
296 ellcc_deps = ${srcdir}/ellcc.c ellcc.h ../src/config.h
297
298 ellcc: ${ellcc_deps}
299         $(CC) ${ellcc_args} -o $@
300
301 run_args = -I. $(cflags) -I${srcdir} -I${srcdir}/../src \
302         -DVERSION='"${version}"' ${srcdir}/run.c \
303         $(ldflags) -Wl,--subsystem,windows -e _mainCRTStartup
304 run_deps   = ${srcdir}/run.c ${srcdir}/run.h ${srcdir}/run.rc \
305         ${srcdir}/../nt/xemacs.ico ${srcdir}/../nt/file.ico \
306         ${srcdir}/../nt/lisp.ico
307
308 run: ${run_deps}
309         windres --include-dir ${srcdir}/../nt -i run.rc -o run_res.o
310         $(CC) run_res.o ${run_args} -o $@
311         strip $@.exe
312
313 runxemacs: run
314         cp run.exe $@.exe
315
316 rungnuclient: run
317         cp run.exe $@.exe
318
319 ootags_args = -I. $(cflags) -I${srcdir} -I${srcdir}/../src \
320         -DVERSION='"${version}"' ${srcdir}/ootags.c \
321         $(GETOPTOBJS) regex.o $(ldflags)
322 ootags_deps   = ${srcdir}/ootags.c $(GETOPTDEPS) regex.o ../src/config.h
323
324 ootags: ${ootags_deps}
325         $(CC) ${ootags_args} -o $@
326
327 ## ctags depends on etags to assure that parallel makes do not write
328 ## two etags.o files on top of each other.
329 ctags: ${etags_deps} etags
330         $(CC) -DCTAGS ${etags_args} -o $@
331
332 wakeup: ${srcdir}/wakeup.c
333         $(CC) $(cflags) ${srcdir}/wakeup.c $(ldflags) -o $@
334
335 profile: ${srcdir}/profile.c
336         $(CC) $(cflags) ${srcdir}/profile.c $(ldflags) -o $@
337
338 make-docfile: ${srcdir}/make-docfile.c
339         $(CC) $(cflags) ${srcdir}/make-docfile.c $(ldflags) -o $@
340
341 digest-doc: ${srcdir}/digest-doc.c
342         $(CC) $(cflags) ${srcdir}/digest-doc.c $(ldflags) -o $@
343
344 sorted-doc: ${srcdir}/sorted-doc.c
345         $(CC) $(cflags) ${srcdir}/sorted-doc.c $(ldflags) -o $@
346
347 b2m: ${srcdir}/b2m.c ../src/config.h
348         $(CC) $(cflags) ${srcdir}/b2m.c $(ldflags) -o $@
349
350 movemail: ${srcdir}/movemail.c ${srcdir}/pop.c ${srcdir}/pop.h $(GETOPTDEPS) regex.o \
351         ../src/config.h
352         $(CC) $(cflags) ${MOVE_FLAGS} ${srcdir}/movemail.c ${srcdir}/pop.c \
353         $(GETOPTOBJS) regex.o $(ldflags) ${MOVE_LIBS} -o $@
354
355 cvtmail: ${srcdir}/cvtmail.c
356         $(CC) $(cflags) ${srcdir}/cvtmail.c $(ldflags) -o $@
357
358 fakemail: ${srcdir}/fakemail.c ../src/config.h
359         $(CC) $(cflags) ${srcdir}/fakemail.c $(ldflags) -o $@
360
361 yow: ${srcdir}/yow.c ../src/paths.h
362         $(CC) $(cflags) ${srcdir}/yow.c $(ldflags) -o $@
363
364 hexl: ${srcdir}/hexl.c
365         $(CC) $(cflags) ${srcdir}/hexl.c $(ldflags) -o $@
366
367 make-msgfile: ${srcdir}/make-msgfile.c
368         $(CC) $(cflags) ${srcdir}/make-msgfile.c $(ldflags) -o $@
369
370 make-po: ${srcdir}/make-po.c
371         $(CC) $(cflags) ${srcdir}/make-po.c $(ldflags) -o $@
372
373 cflags_gnuserv  = $(CFLAGS) $(cppflags) $(c_switch_all)
374 ldflags_gnuserv = $(LDFLAGS) $(ld_switch_all) @libs_xauth@ $(ld_libs_general)
375 gnuslib.o: ${srcdir}/gnuslib.c ${srcdir}/gnuserv.h ../src/config.h
376         $(CC) -c $(cflags_gnuserv) ${srcdir}/gnuslib.c
377 gnuclient: ${srcdir}/gnuclient.c gnuslib.o ${srcdir}/gnuserv.h
378         $(CC) $(cflags_gnuserv) ${srcdir}/$@.c gnuslib.o ${ldflags_gnuserv} -o $@
379 gnuserv: ${srcdir}/gnuserv.c gnuslib.o ${srcdir}/gnuserv.h
380         $(CC) $(cflags_gnuserv) ${srcdir}/$@.c gnuslib.o ${ldflags_gnuserv} -o $@
381
382 ## mmencode binary is used by tm - but is really part of the metamail package
383 ## mmencode.c was merged copy of mmencode.c and codes.c of metamail
384 mmencode : ${srcdir}/mmencode.c
385         $(CC) $(cflags) ${srcdir}/mmencode.c -o $@
386
387
388 ## The timer utility (timer.c, getdate.y) is not used in XEmacs
389 ## because XEmacs provides built-in timer facilities.
390
391 make-path: ${srcdir}/make-path.c ../src/config.h
392         $(CC) $(cflags) ${srcdir}/make-path.c -o $@
393
394 ## These are NOT included in INSTALLABLES or UTILITIES.
395 ## See ../src/Makefile.in.in.
396 aixcc: ${srcdir}/aixcc.c
397         $(CC) $(cflags) ${srcdir}/aixcc.c -o $@
398
399 aixcc.c: ${srcdir}/aixcc.lex
400         lex ${srcdir}/aixcc.lex
401         mv lex.yy.c aixcc.c