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