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.
5 ## This file is part of XEmacs.
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
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
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.
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? */
26 ## For performance and consistency, no built-in rules
29 ## ==================== Things "configure" will edit ====================
45 ## This will be the name of the generated binary and is set automatically
49 ## ==================== Where To Install Things ====================
52 exec_prefix=@exec_prefix@
57 top_srcdir=@top_srcdir@
58 archlibdir=@archlibdir@
59 configuration=@configuration@
61 sitemoduledir=@sitemoduledir@
63 ## ==================== Utility Programs for the Build =================
65 INSTALL = @install_pp@ @INSTALL@
66 INSTALL_PROGRAM = @INSTALL_PROGRAM@
67 INSTALL_DATA = @INSTALL_DATA@
69 ## ========================== Lists of Files ===========================
73 #include "../src/config.h"
75 ## Things that a user might actually run,
76 ## which should be installed in bindir.
78 INSTALLABLES_BASE = etags ctags b2m ootags
80 INSTALLABLES_BASE = etags ctags b2m gnuclient ootags
82 INSTALLABLE_SCRIPTS = rcs-checkin pstogif gnudoit gnuattach
84 #ifdef HAVE_MS_WINDOWS
85 INSTALLABLES = $(INSTALLABLES_BASE) runxemacs rungnuclient ellcc
87 INSTALLABLES = $(INSTALLABLES_BASE) ellcc
90 #ifdef HAVE_MS_WINDOWS
91 INSTALLABLES = $(INSTALLABLES_BASE) runxemacs rungnuclient
93 INSTALLABLES = $(INSTALLABLES_BASE)
98 ## Things that Emacs runs internally, or during the build process,
99 ## which should not be installed in bindir.
101 UTILITIES= make-path wakeup profile make-docfile digest-doc \
102 sorted-doc movemail cvtmail yow hexl \
105 UTILITIES= make-path wakeup profile make-docfile digest-doc \
106 sorted-doc movemail cvtmail fakemail yow hexl \
109 ## These need to be conditional on I18N3 make-msgfile make-po
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)
117 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
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
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.
138 ## Additional libraries for movemail:
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.
147 ## ========================== start of cpp stuff =======================
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@
162 ## We need to #define emacs to get the right versions of some files.
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)
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.
173 ${CC} -c $(cflags) $<
175 .PHONY : all maybe-blessmail install uninstall
177 all: ${UTILITIES} ${INSTALLABLES} srcdir-symlink.stamp
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; \
186 #undef MOVEMAIL_NEEDS_BLESSING
187 #if !defined (MAIL_USE_FLOCK) && ! defined (MAIL_USE_LOCKF)
188 #define MOVEMAIL_NEEDS_BLESSING
189 blessmail = blessmail
191 ../src/xemacs -batch -l ../lisp/blessmail.el
193 #endif /* movemail needs blessing */
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 "*************************************************************";\
211 do-blessmail: $(blessmail)
212 #ifdef MOVEMAIL_NEEDS_BLESSING
213 ./blessmail ${archlibdir}/movemail
216 ## Install the internal utilities. Until they are installed, we can
217 ## just run them directly from lib-src.
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) ; \
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); \
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}) ; \
240 for file in ${INSTALLABLE_SCRIPTS} ; do \
241 (cd .. && $(INSTALL_PROGRAM) ${srcdir}/$${file} ${bindir}/$${file}) ; \
246 $(RM) ${INSTALLABLES} ${INSTALLABLE_SCRIPTS})
247 (cd ${archlibdir} && \
248 $(RM) ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS})
250 .PHONY: mostlyclean clean distclean realclean extraclean
254 $(RM) ${INSTALLABLES} ${UTILITIES} *.exe
256 $(RM) DOC *.tab.c *.tab.h aixcc.c TAGS ellcc.h
257 $(RM) GNUmakefile Makefile Makefile.in blessmail config.values
259 extraclean: distclean
262 .PHONY: unlock relock check
268 ## Test the contents of the directory.
270 @echo "We don't have any tests for XEmacs yet."
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
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
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
294 $(CC) ${etags_args} -o $@
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
301 $(CC) ${ellcc_args} -o $@
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
311 windres --include-dir ${srcdir}/../nt -i run.rc -o run_res.o
312 $(CC) run_res.o ${run_args} -o $@
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
326 ootags: ${ootags_deps}
327 $(CC) ${ootags_args} -o $@
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 $@
334 wakeup: ${srcdir}/wakeup.c
335 $(CC) $(cflags) ${srcdir}/wakeup.c $(ldflags) -o $@
337 profile: ${srcdir}/profile.c
338 $(CC) $(cflags) ${srcdir}/profile.c $(ldflags) -o $@
340 make-docfile: ${srcdir}/make-docfile.c
341 $(CC) $(cflags) ${srcdir}/make-docfile.c $(ldflags) -o $@
343 digest-doc: ${srcdir}/digest-doc.c
344 $(CC) $(cflags) ${srcdir}/digest-doc.c $(ldflags) -o $@
346 sorted-doc: ${srcdir}/sorted-doc.c
347 $(CC) $(cflags) ${srcdir}/sorted-doc.c $(ldflags) -o $@
349 b2m: ${srcdir}/b2m.c ../src/config.h
350 $(CC) $(cflags) ${srcdir}/b2m.c $(ldflags) -o $@
352 movemail: ${srcdir}/movemail.c ${srcdir}/pop.c ${srcdir}/pop.h $(GETOPTDEPS) regex.o \
354 $(CC) $(cflags) ${MOVE_FLAGS} ${srcdir}/movemail.c ${srcdir}/pop.c \
355 $(GETOPTOBJS) regex.o $(ldflags) ${MOVE_LIBS} -o $@
357 cvtmail: ${srcdir}/cvtmail.c
358 $(CC) $(cflags) ${srcdir}/cvtmail.c $(ldflags) -o $@
360 fakemail: ${srcdir}/fakemail.c ../src/config.h
361 $(CC) $(cflags) ${srcdir}/fakemail.c $(ldflags) -o $@
363 yow: ${srcdir}/yow.c ../src/paths.h
364 $(CC) $(cflags) ${srcdir}/yow.c $(ldflags) -o $@
366 hexl: ${srcdir}/hexl.c
367 $(CC) $(cflags) ${srcdir}/hexl.c $(ldflags) -o $@
369 make-msgfile: ${srcdir}/make-msgfile.c
370 $(CC) $(cflags) ${srcdir}/make-msgfile.c $(ldflags) -o $@
372 make-po: ${srcdir}/make-po.c
373 $(CC) $(cflags) ${srcdir}/make-po.c $(ldflags) -o $@
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 $@
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 $@
390 ## The timer utility (timer.c, getdate.y) is not used in XEmacs
391 ## because XEmacs provides built-in timer facilities.
393 make-path: ${srcdir}/make-path.c ../src/config.h
394 $(CC) $(cflags) ${srcdir}/make-path.c -o $@
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 $@
401 aixcc.c: ${srcdir}/aixcc.lex
402 lex ${srcdir}/aixcc.lex