XEmacs 21.2-b1
[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 archlibdir=@archlibdir@
57 configuration=@configuration@
58 ## ==================== Utility Programs for the Build =================
59
60 INSTALL = @install_pp@ @INSTALL@
61 INSTALL_PROGRAM = @INSTALL_PROGRAM@
62 INSTALL_DATA = @INSTALL_DATA@
63
64 ## ========================== Lists of Files ===========================
65
66 #define NO_SHORTNAMES
67 #define NOT_C_CODE
68 #include "../src/config.h"
69
70 ## Things that a user might actually run,
71 ## which should be installed in bindir.
72 INSTALLABLES_BASE = etags ctags b2m gnuclient ootags
73 INSTALLABLE_SCRIPTS = rcs-checkin pstogif install-sid send-pr gnudoit gnuattach
74 #ifdef HAVE_MS_WINDOWS
75 INSTALLABLES = $(INSTALLABLES_BASE) runemacs
76 #else
77 INSTALLABLES = $(INSTALLABLES_BASE) 
78 #endif
79
80
81 ## Things that Emacs runs internally, or during the build process,
82 ## which should not be installed in bindir.
83 UTILITIES= make-path wakeup profile make-docfile digest-doc \
84         sorted-doc movemail cvtmail fakemail yow hexl \
85         gnuserv mmencode
86 ## These need to be conditional on I18N3 make-msgfile make-po
87
88 ## Like UTILITIES, but they are not system-dependent, and should not be
89 ## deleted by the distclean target.
90 GEN_SCRIPTS = rcs2log vcdiff gzip-el.sh install-sid send-pr
91 TM_SCRIPTS = tm-au tm-file tm-html tm-image tm-mpeg tm-plain tm-ps tmdecode
92 PKG_SCRIPTS = add-big-package.sh
93 SCRIPTS = $(GEN_SCRIPTS) $(TM_SCRIPTS) $(PKG_SCRIPTS)
94
95 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
96
97 SOURCES = COPYING ChangeLog Makefile.in.in README aixcc.lex emacs.csh \
98         makedoc.com *.[chy] $(SCRIPTS)
99 ## Additional -D flags for movemail (add to MOVE_FLAGS if desired):
100 ## MAIL_USE_POP         Support mail retrieval from a POP mailbox.
101 ## MAIL_USE_MMDF                Support MMDF mailboxes.
102 ## MAIL_USE_FLOCK       Use flock for file locking (see the comments
103 ##                      about locking in movemail.c)
104 ## MAIL_UNLINK_SPOOL    Unlink the user spool mailbox after reading
105 ##                      it (instead of just emptying it).
106 ## KERBEROS             Support Kerberized POP.
107 ## KRB5                 Support Kerberos Version 5 pop instead of
108 ##                      Version 4 (define this in addition to
109 ##                      KERBEROS).
110 ## HESIOD               Support Hesiod lookups of user mailboxes.
111 ## MAILHOST             A string, the host name of the default POP
112 ##                      mail host for the site.
113
114 MOVE_FLAGS=
115 ##
116 ## Additional libraries for movemail:
117 ## For KERBEROS
118 ## MOVE_LIBS= -lkrb -ldes -lcom_err
119 ## For KERBEROS + KRB5
120 ## MOVE_LIBS= -lkrb5 -lcrypto -lisode -lcom_err
121 ## Add "-lhesiod" if HESIOD is defined.
122
123 MOVE_LIBS=
124
125 ## ========================== start of cpp stuff =======================
126
127 #ifdef USE_GNU_MAKE
128 vpath %.c @srcdir@
129 vpath %.h @srcdir@
130 #else
131 VPATH=@srcdir@
132 #endif
133
134 c_switch_general=@c_switch_general@
135 c_switch_all=@c_switch_all@
136 ld_switch_general=@ld_switch_general@
137 ld_switch_all=@ld_switch_all@
138 ld_libs_general=@ld_libs_general@
139
140 ## We need to #define emacs to get the right versions of some files.
141
142 cppflags = -Demacs -I../src $(CPPFLAGS)
143 cflags   = $(CFLAGS) $(cppflags) $(c_switch_general)
144 ldflags  = $(LDFLAGS) $(ld_switch_general) $(ld_libs_general)
145
146 ## This is the default compilation command.
147 ## But we should never rely on it, because some make version
148 ## failed to find it for getopt.o.
149 ## Using an explicit command made it work.
150 .c.o:
151         ${CC} -c $(cflags) $<
152
153 all: ${UTILITIES} ${INSTALLABLES} srcdir-symlink.stamp
154
155 ## Make symlinks for shell scripts if using --srcdir
156 srcdir-symlink.stamp:
157         for f in ${SCRIPTS}; do \
158                 if test ! -r $$f; then ${LN_S} ${srcdir}/$$f $$f; fi; \
159         done; \
160         touch $@;
161
162 #undef MOVEMAIL_NEEDS_BLESSING
163 #if !defined (MAIL_USE_FLOCK) && ! defined (MAIL_USE_LOCKF)
164 #define MOVEMAIL_NEEDS_BLESSING
165 blessmail = blessmail
166 blessmail:
167         ../src/xemacs -batch -l ../lisp/blessmail.el
168         chmod +x $@
169 #endif /* movemail needs blessing */
170
171 maybe-blessmail: $(blessmail)
172 #ifdef MOVEMAIL_NEEDS_BLESSING
173 ## Do not charge ahead and do it!  Let the installer decide.
174 ##        ./blessmail ${archlibdir}/movemail
175         @if test `wc -l <blessmail` != 2; then \
176           dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
177           echo "*************************************************************";\
178           echo "Assuming $$dir is really the mail spool directory, you should";\
179           echo "run  lib-src/blessmail ${archlibdir}/movemail"; \
180           echo "as root, to give  movemail  appropriate permissions."; \
181           echo "Do that after running  make install."; \
182           echo "You can also do  make blessmail. "; \
183           echo "*************************************************************";\
184         fi
185 #endif
186
187 do-blessmail: $(blessmail)
188 #ifdef MOVEMAIL_NEEDS_BLESSING
189         ./blessmail ${archlibdir}/movemail
190 #endif
191
192 ## Install the internal utilities.  Until they are installed, we can
193 ## just run them directly from lib-src.
194 ${archlibdir}: all
195         @echo; echo "Installing utilities run internally by XEmacs."
196         ./make-path ${archlibdir}
197         if test "`(cd ${archlibdir} && $(pwd))`" != "`$(pwd)`"; then \
198           for f in ${UTILITIES}; do \
199             (cd .. && $(INSTALL_PROGRAM) lib-src/$$f ${archlibdir}/$$f) ; \
200           done ; \
201         fi
202         if test "`(cd ${archlibdir} && $(pwd))`" \
203              != "`(cd ${srcdir}     && $(pwd))`"; then \
204           for f in ${SCRIPTS}; do \
205             (cd .. && $(INSTALL_PROGRAM) ${srcdir}/$$f ${archlibdir}/$$f); \
206           done ; \
207         fi
208
209 ## We do not need to install "wakeup" explicitly, because it will be
210 ## copied when this whole directory is copied.
211 .PHONY : all maybe-blessmail install uninstall
212 install: ${archlibdir}
213         @echo; echo "Installing utilities for users to run."
214         for file in ${INSTALLABLES} ; do \
215           (cd .. && $(INSTALL_PROGRAM) lib-src/$${file} ${bindir}/$${file}) ; \
216         done
217         for file in ${INSTALLABLE_SCRIPTS} ; do \
218           (cd .. && $(INSTALL_PROGRAM) ${srcdir}/$${file} ${bindir}/$${file}) ; \
219         done
220
221 uninstall:
222         (cd ${bindir} && \
223          $(RM) ${INSTALLABLES} ${INSTALLABLE_SCRIPTS})
224         (cd ${archlibdir} && \
225          $(RM) ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS})
226
227 .PHONY: mostlyclean clean distclean realclean extraclean
228 mostlyclean:
229         $(RM) *.o *.i core
230 clean: mostlyclean
231         $(RM) ${INSTALLABLES} ${UTILITIES} *.exe
232 distclean: clean
233         $(RM) DOC *.tab.c *.tab.h aixcc.c TAGS
234         $(RM) Makefile Makefile.in blessmail config.values
235 realclean: distclean
236 extraclean: distclean
237         $(RM) *~ \#*
238
239 .PHONY: unlock relock check
240 unlock:
241         chmod u+w $(SOURCES)
242 relock:
243         chmod u-w $(SOURCES)
244
245 ## Test the contents of the directory.
246 check:
247         @echo "We don't have any tests for XEmacs yet."
248
249 TAGS: etags
250         etags *.[ch]
251
252 GETOPTOBJS = getopt.o getopt1.o $(ALLOCA)
253 GETOPTDEPS = $(GETOPTOBJS) ${srcdir}/getopt.h
254 getopt.o: ${srcdir}/getopt.c ${srcdir}/getopt.h
255         ${CC} -c $(cflags) ${srcdir}/getopt.c
256 getopt1.o: ${srcdir}/getopt1.c ${srcdir}/getopt.h
257         ${CC} -c $(cflags) ${srcdir}/getopt1.c
258 alloca.o: ${srcdir}/../src/alloca.c
259         ${CC} -c $(cflags) ${srcdir}/../src/alloca.c
260
261 regex.o: ${srcdir}/../src/regex.c ${srcdir}/../src/regex.h
262         $(CC) -c `echo $(cflags) | sed 's/-Demacs/ /'` \
263                 -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
264
265 etags_args = -I. $(cflags) -I${srcdir} -I${srcdir}/../src \
266         -DVERSION='"${version}"' ${srcdir}/etags.c \
267         $(GETOPTOBJS) regex.o $(ldflags)
268 etags_deps   = ${srcdir}/etags.c $(GETOPTDEPS) regex.o ../src/config.h
269
270 etags: ${etags_deps}
271         $(CC) ${etags_args} -o $@
272
273 runemacs_args = -I. $(cflags) -I${srcdir} -I${srcdir}/../src \
274         -DVERSION='"${version}"' ${srcdir}/../nt/runemacs.c \
275         $(ldflags) -Wl,--subsystem,windows
276 runemacs_deps   = ${srcdir}/../nt/runemacs.c ${srcdir}/../nt/xemacs.ico ../src/config.h
277
278 runemacs: ${runemacs_deps}
279         echo "runemacs ICON DISCARDABLE \"../nt/xemacs.ico\"" \
280         | windres -o runemacs_res.o
281         $(CC) runemacs_res.o ${runemacs_args} -o $@
282
283 ootags_args = -I. $(cflags) -I${srcdir} -I${srcdir}/../src \
284         -DVERSION='"${version}"' ${srcdir}/ootags.c \
285         $(GETOPTOBJS) regex.o $(ldflags)
286 ootags_deps   = ${srcdir}/ootags.c $(GETOPTDEPS) regex.o ../src/config.h
287
288 ootags: ${ootags_deps}
289         $(CC) ${ootags_args} -o $@
290
291 ## ctags depends on etags to assure that parallel makes do not write
292 ## two etags.o files on top of each other.
293 ctags: ${etags_deps} etags
294         $(CC) -DCTAGS ${etags_args} -o $@
295
296 wakeup: ${srcdir}/wakeup.c
297         $(CC) $(cflags) ${srcdir}/wakeup.c $(ldflags) -o $@
298
299 profile: ${srcdir}/profile.c
300         $(CC) $(cflags) ${srcdir}/profile.c $(ldflags) -o $@
301
302 make-docfile: ${srcdir}/make-docfile.c
303         $(CC) $(cflags) ${srcdir}/make-docfile.c $(ldflags) -o $@
304
305 digest-doc: ${srcdir}/digest-doc.c
306         $(CC) $(cflags) ${srcdir}/digest-doc.c $(ldflags) -o $@
307
308 sorted-doc: ${srcdir}/sorted-doc.c
309         $(CC) $(cflags) ${srcdir}/sorted-doc.c $(ldflags) -o $@
310
311 b2m: ${srcdir}/b2m.c ../src/config.h
312         $(CC) $(cflags) ${srcdir}/b2m.c $(ldflags) -o $@
313
314 movemail: ${srcdir}/movemail.c ${srcdir}/pop.c ${srcdir}/pop.h ../src/config.h
315         $(CC) $(cflags) ${MOVE_FLAGS} ${srcdir}/movemail.c ${srcdir}/pop.c $(ldflags) ${MOVE_LIBS} -o $@
316
317 cvtmail: ${srcdir}/cvtmail.c
318         $(CC) $(cflags) ${srcdir}/cvtmail.c $(ldflags) -o $@
319
320 fakemail: ${srcdir}/fakemail.c ../src/config.h
321         $(CC) $(cflags) ${srcdir}/fakemail.c $(ldflags) -o $@
322
323 yow: ${srcdir}/yow.c ../src/paths.h
324         $(CC) $(cflags) ${srcdir}/yow.c $(ldflags) -o $@
325
326 hexl: ${srcdir}/hexl.c
327         $(CC) $(cflags) ${srcdir}/hexl.c $(ldflags) -o $@
328
329 make-msgfile: ${srcdir}/make-msgfile.c
330         $(CC) $(cflags) ${srcdir}/make-msgfile.c $(ldflags) -o $@
331
332 make-po: ${srcdir}/make-po.c
333         $(CC) $(cflags) ${srcdir}/make-po.c $(ldflags) -o $@
334
335 cflags_gnuserv  = $(CFLAGS) $(cppflags) $(c_switch_all)
336 ldflags_gnuserv = $(LDFLAGS) $(ld_switch_all) @libs_xauth@ $(ld_libs_general)
337 gnuslib.o: ${srcdir}/gnuslib.c ${srcdir}/gnuserv.h ../src/config.h
338         $(CC) -c $(cflags_gnuserv) ${srcdir}/gnuslib.c
339 gnuclient: ${srcdir}/gnuclient.c gnuslib.o ${srcdir}/gnuserv.h
340         $(CC) $(cflags_gnuserv) ${srcdir}/$@.c gnuslib.o ${ldflags_gnuserv} -o $@
341 gnuserv: ${srcdir}/gnuserv.c gnuslib.o ${srcdir}/gnuserv.h
342         $(CC) $(cflags_gnuserv) ${srcdir}/$@.c gnuslib.o ${ldflags_gnuserv} -o $@
343
344 ## mmencode binary is used by tm - but is really part of the metamail package
345 ## mmencode.c was merged copy of mmencode.c and codes.c of metamail
346 mmencode : ${srcdir}/mmencode.c
347         $(CC) $(cflags) ${srcdir}/mmencode.c -o $@
348
349
350 ## The timer utility (timer.c, getdate.y) is not used in XEmacs
351 ## because XEmacs provides built-in timer facilities.
352
353 make-path: ${srcdir}/make-path.c ../src/config.h
354         $(CC) $(cflags) ${srcdir}/make-path.c -o $@
355
356 ## These are NOT included in INSTALLABLES or UTILITIES.
357 ## See ../src/Makefile.in.in.
358 aixcc: ${srcdir}/aixcc.c
359         $(CC) $(cflags) ${srcdir}/aixcc.c -o $@
360
361 aixcc.c: ${srcdir}/aixcc.lex
362         lex ${srcdir}/aixcc.lex
363         mv lex.yy.c aixcc.c