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