1 # Makefile for lib-src subdirectory in GNU Emacs.
2 # Copyright (C) 1985, 1987, 1988, 1993, 1994, 2001, 2002, 2003, 2004,
3 # 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 # This file is part of GNU Emacs.
7 # GNU Emacs is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # GNU Emacs is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21 # Avoid trouble on systems where the `SHELL' variable might be
22 # inherited from the environment.
25 # Following ../lisp/Makefile.in.
27 EMACSOPT
= -batch
--no-site-file
--multibyte
29 # ==================== Things `configure' will edit ====================
34 ## Used in $archlibdir.
35 configuration
=@configuration@
37 C_SWITCH_SYSTEM
=@C_SWITCH_SYSTEM@
38 C_SWITCH_MACHINE
=@C_SWITCH_MACHINE@
39 C_WARNINGS_SWITCH
= @C_WARNINGS_SWITCH@
40 PROFILING_CFLAGS
= @PROFILING_CFLAGS@
41 PROFILING_LDFLAGS
= @PROFILING_LDFLAGS@
43 # Program name transformation.
44 TRANSFORM
= @program_transform_name@
46 # ==================== Where To Install Things ====================
48 # The default location for installation. Everything is placed in
49 # subdirectories of this directory. The default values for many of
50 # the variables below are expressed in terms of this one, so you may
51 # not need to change them. This is set with the --prefix option to
55 # Like `prefix', but used for architecture-specific files. This is
56 # set with the --exec-prefix option to `../configure'.
57 exec_prefix=@
exec_prefix@
59 # Where to install Emacs and other binaries that people will want to
60 # run directly (like etags). This is set with the --bindir option
64 # Where to install and expect executable files to be run by Emacs
65 # rather than directly by users, and other architecture-dependent
66 # data. ${archlibdir} is usually below this. This is set with the
67 # --libexecdir option to `../configure'.
68 libexecdir
=@libexecdir@
70 # Directory for local state files for all programs.
71 localstatedir
=@localstatedir@
73 # Where to find the source code. This is set by the configure
74 # script's `--srcdir' option. However, the value of ${srcdir} in
75 # this makefile is not identical to what was specified with --srcdir,
76 # since the variable here has `/lib-src' added at the end.
78 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
82 # The top-level source directory, also set by configure.
83 top_srcdir
=@top_srcdir@
85 # ==================== Emacs-specific directories ====================
87 # These variables hold the values Emacs will actually use. They are
88 # based on the values of the standard Make variables above.
90 # Where to put executables to be run by Emacs rather than the user.
91 # This path usually includes the Emacs version and configuration name,
92 # so that multiple configurations for multiple versions of Emacs may
93 # be installed at once. This can be set with the --archlibdir option
95 archlibdir
=@archlibdir@
100 # ==================== Utility Programs for the Build =================
102 # ../configure figures out the correct values for these.
104 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
105 INSTALL_DATA
= @INSTALL_DATA@
106 INSTALL_SCRIPT
= @INSTALL_SCRIPT@
107 # By default, we uphold the dignity of our programs.
110 # ========================== Lists of Files ===========================
112 # Things that a user might actually run, which should be installed in bindir.
113 INSTALLABLES
= etags
${EXEEXT} ctags
${EXEEXT} emacsclient
${EXEEXT} \
114 b2m
${EXEEXT} ebrowse
${EXEEXT}
116 INSTALLABLE_SCRIPTS
= rcs-checkin grep-changelog
117 STAMP_INST_SCRIPTS
= stamp-rcs-checkin stamp-grep-changelog
119 # Things that Emacs runs internally, or during the build process,
120 # which should not be installed in bindir.
121 UTILITIES
= profile
${EXEEXT} digest-doc
${EXEEXT} sorted-doc
${EXEEXT} \
122 movemail
${EXEEXT} fakemail
${EXEEXT} \
123 hexl
${EXEEXT} update-game-score
${EXEEXT}
125 DONT_INSTALL
= test-distrib
${EXEEXT} make-docfile
${EXEEXT}
127 # Like UTILITIES, but they're not system-dependent, and should not be
128 # deleted by the distclean target.
129 SCRIPTS
= rcs2log vcdiff
130 STAMP_SCRIPTS
= stamp-rcs2log stamp-vcdiff
132 EXECUTABLES
= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
134 # Specify additional -D flags for movemail. Options:
135 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
136 # See the comments about locking in movemail.c. Normally the values
137 # set by configure should be correct and you should not need to do anything.
138 # If neither flag is set, you need to use blessmail.
141 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
142 BLESSMAIL_TARGET
=@BLESSMAIL_TARGET@
144 ## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
146 ## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
148 ## -lkrb5 if HAVE_LIBKRB5
150 ## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
151 CRYPTOLIB
=@CRYPTOLIB@
152 ## -lcom_err if HAVE_LIBCOM_ERR
153 COM_ERRLIB
=@COM_ERRLIB@
154 ## -lhesiod if HAVE_LIBHESIOD
155 LIBHESIOD
=@LIBHESIOD@
156 ## -lresolv if HAVE_LIBRESOLV
157 LIBRESOLV
=@LIBRESOLV@
158 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
159 LIBS_MAIL
=@LIBS_MAIL@
161 ## Extra libraries to use when linking movemail.
162 LIBS_MOVE
= $(LIBS_MAIL
) $(KRB4LIB
) $(DESLIB
) $(KRB5LIB
) $(CRYPTOLIB
) \
163 $(COM_ERRLIB
) $(LIBHESIOD
) $(LIBRESOLV
)
165 ## Some systems define this to request special libraries.
166 LIBS_SYSTEM
= @LIBS_SYSTEM@
168 # Those files shared with other GNU utilities need HAVE_CONFIG_H
169 # defined before they know they can take advantage of the information
170 # in ../src/config.h.
171 BASE_CFLAGS
= $(C_SWITCH_SYSTEM
) $(C_SWITCH_MACHINE
) ${C_WARNINGS_SWITCH} \
172 -DHAVE_CONFIG_H
-I.
-I..
/src
-I
${srcdir} -I
${srcdir}/..
/src
174 ALL_CFLAGS
= ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
175 LINK_CFLAGS
= ${BASE_CFLAGS} ${PROFILING_LDFLAGS} ${LDFLAGS} ${CFLAGS}
176 CPP_CFLAGS
= ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
178 LOADLIBES
=$(LIBS_SYSTEM
)
181 ## This is the default compilation command.
182 ## But we should never rely on it, because some make version failed to
183 ## find it for getopt.o.
184 ## Using an explicit command made it work.
186 ${CC} -c
${CPP_CFLAGS} $<
188 all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
190 ## These targets copy the scripts into the build directory so that
191 ## they can be run from there in an uninstalled Emacs.
192 ## The "-" is prepended because some versions of cp barf when srcdir
193 ## is the current directory, and thus the file will be copied into itself.
194 stamp-rcs2log
: $(srcdir)/rcs2log
195 -cp
-p
$(srcdir)/rcs2log rcs2log
198 stamp-rcs-checkin
: $(srcdir)/rcs-checkin
199 -cp
-p
$(srcdir)/rcs-checkin rcs-checkin
202 stamp-grep-changelog
: $(srcdir)/grep-changelog
203 -cp
-p
$(srcdir)/grep-changelog grep-changelog
206 stamp-vcdiff
: $(srcdir)/vcdiff
207 -cp
-p
$(srcdir)/vcdiff vcdiff
210 ## Only used if we need blessmail, but no harm in always defining.
211 ## This makes the actual blessmail executable.
213 $(EMACS
) $(EMACSOPT
) -l
$(srcdir)/..
/lisp
/mail
/blessmail.el
216 ## This checks if we need to run blessmail.
217 ## Do not charge ahead and do it! Let the installer decide.
218 need-blessmail
: blessmail
219 @if
[ `wc -l <blessmail` != 2 ] ; then \
220 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
221 echo Assuming
$$dir is really the mail spool directory
, you should
; \
222 echo run lib-src
/blessmail
$(DESTDIR
)${archlibdir}/movemail
${EXEEXT}; \
223 echo
as root
, to give movemail
${EXEEXT} appropriate permissions.
; \
224 echo Do that after running make
install.
; \
227 ## This is the target invoked by the top-level Makefile.
228 maybe-blessmail
: $(BLESSMAIL_TARGET
)
230 ## Install the internal utilities. Until they are installed, we can
231 ## just run them directly from lib-src.
232 ## If the chown/chmod commands fail, that is not a big deal.
233 ## update-game-score will detect at runtime that it is not setuid,
234 ## and handle things accordingly.
235 $(DESTDIR
)${archlibdir}: all
237 @echo
"Installing utilities run internally by Emacs."
238 umask
022; $(top_srcdir
)/mkinstalldirs
$(DESTDIR
)${archlibdir}
239 if
[ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
240 for file in
${UTILITIES}; do \
241 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $$file $(DESTDIR
)${archlibdir}/$$file ; \
244 umask
022; $(top_srcdir
)/mkinstalldirs
$(DESTDIR
)${gamedir}; \
245 touch
$(DESTDIR
)${gamedir}/snake-scores
; \
246 touch
$(DESTDIR
)${gamedir}/tetris-scores
247 -if chown
${gameuser} $(DESTDIR
)${archlibdir}/update-game-score
&& chmod u
+s
$(DESTDIR
)${archlibdir}/update-game-score
; then \
248 chown
${gameuser} $(DESTDIR
)${gamedir}; \
249 chmod u
=rwx
,g
=rwx
,o
=rx
$(DESTDIR
)${gamedir}; \
251 if
[ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
252 != `(cd ${srcdir} && /bin/pwd)` ]; then \
253 for file in
${SCRIPTS}; do \
254 $(INSTALL_SCRIPT
) ${srcdir}/$$file $(DESTDIR
)${archlibdir}/$$file; \
258 install: $(DESTDIR
)${archlibdir}
260 @echo
"Installing utilities for users to run."
261 for file in
${INSTALLABLES} ; do \
262 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $${file} $(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
263 chmod a
+rx
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
265 for file in
${INSTALLABLE_SCRIPTS} ; do \
266 $(INSTALL_SCRIPT
) ${srcdir}/$${file} $(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
267 chmod a
+rx
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
271 (cd
$(DESTDIR
)${bindir}; \
272 for file in
${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
273 rm -f
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
275 if
[ -d
$(DESTDIR
)${archlibdir} ]; then \
276 (cd
$(DESTDIR
)${archlibdir} && \
277 rm -f
${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
281 -rm -f core
*.o getopt.h getopt.h-t
284 -rm -f
${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
285 -rm -f fns
*.el
*.tab.c
*.tab.h stamp-
*
289 -rm -f Makefile blessmail
291 maintainer-clean
: distclean
294 extraclean
: maintainer-clean
297 ## Test the contents of the directory.
299 @echo
"We don't have any tests for the lib-src/ directory yet."
305 ## This verifies that the non-ASCII characters in the file \`testfile\'
306 ## have not been clobbered by whatever means were used to copy and
307 ## distribute Emacs. If they were clobbered, all the .elc files were
309 test-distrib
${EXEEXT}: ${srcdir}/test-distrib.c
310 $(CC
) ${ALL_CFLAGS} -o test-distrib
${srcdir}/test-distrib.c
311 .
/test-distrib
${srcdir}/testfile
313 ## We need the following in order to create a <getopt.h> when the system
314 ## does not have one that works with the given compiler.
315 GETOPT_H
= @GETOPT_H@
317 cp
$(srcdir)/getopt_.h
$@
-t
320 GETOPTOBJS
= @GETOPTOBJS@
321 GETOPTDEPS
= $(GETOPTOBJS
) $(GETOPT_H
)
322 getopt.o
: ${srcdir}/getopt.c
$(GETOPT_H
) ${srcdir}/gettext.h
323 ${CC} -c
${CPP_CFLAGS} ${srcdir}/getopt.c
324 getopt1.o
: ${srcdir}/getopt1.c
$(GETOPT_H
)
325 ${CC} -c
${CPP_CFLAGS} ${srcdir}/getopt1.c
328 REGEXPDEPS
= $(REGEXPOBJ
) $(srcdir)/..
/src
/regex.h
330 regex.o
: $(srcdir)/..
/src
/regex.c
$(srcdir)/..
/src
/regex.h ..
/src
/config.h
331 ${CC} -c
${CPP_CFLAGS} -DCONFIG_BROKETS
-DINHIBIT_STRING_HEADER \
332 ${srcdir}/..
/src
/regex.c
334 etags
${EXEEXT}: ${srcdir}/etags.c
$(GETOPTDEPS
) $(REGEXPDEPS
) ..
/src
/config.h
335 $(CC
) ${ALL_CFLAGS} -DEMACS_NAME
="\"GNU Emacs\"" \
336 -DVERSION
="\"${version}\"" ${srcdir}/etags.c
$(GETOPTOBJS
) \
337 $(REGEXPOBJ
) $(LOADLIBES
) -o etags
339 ebrowse
${EXEEXT}: ${srcdir}/ebrowse.c
$(GETOPTDEPS
) ..
/src
/config.h
340 $(CC
) ${ALL_CFLAGS} -DVERSION
="\"${version}\"" \
341 ${srcdir}/ebrowse.c
$(GETOPTOBJS
) $(LOADLIBES
) -o ebrowse
343 ## We depend on etags to assure that parallel makes do not write two
344 ## etags.o files on top of each other.
345 ctags
${EXEEXT}: etags
${EXEEXT}
346 $(CC
) ${ALL_CFLAGS} -DCTAGS
-DEMACS_NAME
="\"GNU Emacs\"" \
347 -DVERSION
="\"${version}\"" ${srcdir}/etags.c
$(GETOPTOBJS
) \
348 $(REGEXPOBJ
) $(LOADLIBES
) -o ctags
350 profile
${EXEEXT}: ${srcdir}/profile.c ..
/src
/config.h
351 $(CC
) ${ALL_CFLAGS} ${srcdir}/profile.c
$(LOADLIBES
) -o profile
353 make-docfile
${EXEEXT}: ${srcdir}/make-docfile.c ..
/src
/config.h
354 $(CC
) ${ALL_CFLAGS} ${srcdir}/make-docfile.c
$(LOADLIBES
) \
357 digest-doc
${EXEEXT}: ${srcdir}/digest-doc.c
358 $(CC
) ${ALL_CFLAGS} ${srcdir}/digest-doc.c
$(LOADLIBES
) -o digest-doc
360 sorted-doc
${EXEEXT}: ${srcdir}/sorted-doc.c
361 $(CC
) ${ALL_CFLAGS} ${srcdir}/sorted-doc.c
$(LOADLIBES
) -o sorted-doc
363 b2m
${EXEEXT}: ${srcdir}/b2m.c ..
/src
/config.h
$(GETOPTDEPS
)
364 $(CC
) ${ALL_CFLAGS} ${srcdir}/b2m.c
-DVERSION
="\"${version}\"" \
365 $(GETOPTOBJS
) $(LOADLIBES
) -o b2m
367 movemail
${EXEEXT}: movemail.o pop.o
$(GETOPTDEPS
)
368 $(CC
) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o \
369 $(GETOPTOBJS
) $(LOADLIBES
) $(LIBS_MOVE
) -o movemail
371 movemail.o
: ${srcdir}/movemail.c ..
/src
/config.h
$(GETOPT_H
)
372 $(CC
) -c
${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
374 pop.o
: ${srcdir}/pop.c ..
/src
/config.h
375 $(CC
) -c
${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
377 fakemail
${EXEEXT}: ${srcdir}/fakemail.c ..
/src
/config.h
378 $(CC
) ${ALL_CFLAGS} ${srcdir}/fakemail.c
$(LOADLIBES
) -o fakemail
380 emacsclient
${EXEEXT}: ${srcdir}/emacsclient.c ..
/src
/config.h
$(GETOPTDEPS
)
381 $(CC
) ${ALL_CFLAGS} ${srcdir}/emacsclient.c
$(GETOPTOBJS
) \
382 -DVERSION
="\"${version}\"" \
383 $(LOADLIBES
) -o emacsclient
385 hexl
${EXEEXT}: ${srcdir}/hexl.c ..
/src
/config.h
386 $(CC
) ${ALL_CFLAGS} ${srcdir}/hexl.c
$(LOADLIBES
) -o hexl
388 update-game-score
${EXEEXT}: update-game-score.o
$(GETOPTDEPS
)
389 $(CC
) ${LINK_CFLAGS} update-game-score.o
$(GETOPTOBJS
) \
390 $(LOADLIBES
) -o update-game-score
392 update-game-score.o
: ${srcdir}/update-game-score.c ..
/src
/config.h
$(GETOPT_H
)
393 $(CC
) -c
${CPP_CFLAGS} ${srcdir}/update-game-score.c \
394 -DHAVE_SHARED_GAME_DIR
="\"$(gamedir)\""
396 ## Makefile ends here.