1 # Makefile for lib-src subdirectory in GNU Emacs.
2 # Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2012
3 # 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
--no-site-lisp
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 PROFILING_CFLAGS
= @PROFILING_CFLAGS@
40 WARN_CFLAGS
= @WARN_CFLAGS@
41 WERROR_CFLAGS
= @WERROR_CFLAGS@
43 # Program name transformation.
44 TRANSFORM
= @program_transform_name@
46 # ==================== Where To Install Things ====================
48 # Location to install Emacs.app under GNUstep / Mac OS X.
49 # Later values may use this.
50 ns_appbindir
=@ns_appbindir@
52 # The default location for installation. Everything is placed in
53 # subdirectories of this directory. The default values for many of
54 # the variables below are expressed in terms of this one, so you may
55 # not need to change them. This is set with the --prefix option to
59 # Like `prefix', but used for architecture-specific files. This is
60 # set with the --exec-prefix option to `../configure'.
61 exec_prefix=@
exec_prefix@
63 # Where to install Emacs and other binaries that people will want to
64 # run directly (like etags). This is set with the --bindir option
68 # Where to install and expect executable files to be run by Emacs
69 # rather than directly by users, and other architecture-dependent
70 # data. ${archlibdir} is usually below this. This is set with the
71 # --libexecdir option to `../configure'.
72 libexecdir
=@libexecdir@
74 # Directory for local state files for all programs.
75 localstatedir
=@localstatedir@
77 # Where to find the source code. This is set by the configure
78 # script's `--srcdir' option. However, the value of ${srcdir} in
79 # this makefile is not identical to what was specified with --srcdir,
80 # since the variable here has `/lib-src' added at the end.
82 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
86 # The top-level source directory, also set by configure.
87 top_srcdir
=@top_srcdir@
89 # ==================== Emacs-specific directories ====================
91 # These variables hold the values Emacs will actually use. They are
92 # based on the values of the standard Make variables above.
94 # Where to put executables to be run by Emacs rather than the user.
95 # This path usually includes the Emacs version and configuration name,
96 # so that multiple configurations for multiple versions of Emacs may
97 # be installed at once. This can be set with the --archlibdir option
99 archlibdir
=@archlibdir@
104 # ==================== Utility Programs for the Build =================
106 # ../configure figures out the correct values for these.
108 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
109 INSTALL_SCRIPT
= @INSTALL_SCRIPT@
110 # By default, we uphold the dignity of our programs.
114 # ========================== Lists of Files ===========================
116 # Things that a user might actually run, which should be installed in bindir.
117 INSTALLABLES
= etags
${EXEEXT} ctags
${EXEEXT} emacsclient
${EXEEXT} \
120 INSTALLABLE_SCRIPTS
= grep-changelog
122 # Things that Emacs runs internally, or during the build process,
123 # which should not be installed in bindir.
124 UTILITIES
= profile
${EXEEXT} movemail
${EXEEXT} hexl
${EXEEXT} \
125 update-game-score
${EXEEXT}
127 DONT_INSTALL
= test-distrib
${EXEEXT} make-docfile
${EXEEXT}
129 # Like UTILITIES, but they're not system-dependent, and should not be
130 # deleted by the distclean target.
133 # All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
134 EXE_FILES
= ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
136 # Specify additional -D flags for movemail. Options:
137 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
138 # See the comments about locking in movemail.c. Normally the values
139 # set by configure should be correct and you should not need to do anything.
140 # If neither flag is set, you need to use blessmail.
143 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
144 BLESSMAIL_TARGET
=@BLESSMAIL_TARGET@
146 ## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
148 ## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
150 ## -lkrb5 if HAVE_LIBKRB5
152 ## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
153 CRYPTOLIB
=@CRYPTOLIB@
154 ## -lcom_err if HAVE_LIBCOM_ERR
155 COM_ERRLIB
=@COM_ERRLIB@
156 ## -lhesiod if HAVE_LIBHESIOD
157 LIBHESIOD
=@LIBHESIOD@
158 ## -lresolv if HAVE_LIBRESOLV
159 LIBRESOLV
=@LIBRESOLV@
160 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
161 LIBS_MAIL
=@LIBS_MAIL@
162 ## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
163 LIB_CLOCK_GETTIME
= @LIB_CLOCK_GETTIME@
165 ## Extra libraries to use when linking movemail.
166 LIBS_MOVE
= $(LIBS_MAIL
) $(KRB4LIB
) $(DESLIB
) $(KRB5LIB
) $(CRYPTOLIB
) \
167 $(COM_ERRLIB
) $(LIBHESIOD
) $(LIBRESOLV
)
169 ## Some systems define this to request special libraries.
170 LIBS_SYSTEM
= @LIBS_SYSTEM@
172 BASE_CFLAGS
= $(C_SWITCH_SYSTEM
) $(C_SWITCH_MACHINE
) \
173 $(WARN_CFLAGS
) $(WERROR_CFLAGS
) \
174 -I.
-I..
/src
-I..
/lib \
175 -I
${srcdir} -I
${srcdir}/..
/src
-I
${srcdir}/..
/lib
177 ALL_CFLAGS
= ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
178 LINK_CFLAGS
= ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
179 CPP_CFLAGS
= ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
181 # Configuration files for .o files to depend on.
182 config_h
= ..
/src
/config.h
$(srcdir)/..
/src
/conf_post.h
184 all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
186 .PHONY
: all need-blessmail maybe-blessmail
188 LOADLIBES
= ..
/lib
/libgnu.a
$(LIBS_SYSTEM
)
189 $(EXE_FILES
): ..
/lib
/libgnu.a
191 ## Only used if we need blessmail, but no harm in always defining.
192 ## This makes the actual blessmail executable.
194 $(EMACS
) $(EMACSOPT
) -l
$(srcdir)/..
/lisp
/mail
/blessmail.el
197 ## This checks if we need to run blessmail.
198 ## Do not charge ahead and do it! Let the installer decide.
199 need-blessmail
: blessmail
200 @if
[ `wc -l <blessmail` != 2 ] ; then \
201 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
202 echo Assuming
$$dir is really the mail spool directory
, you should
; \
203 echo run lib-src
/blessmail
$(DESTDIR
)${archlibdir}/movemail
${EXEEXT}; \
204 echo
as root
, to give movemail
${EXEEXT} appropriate permissions.
; \
205 echo Do that after running make
install.
; \
208 ## This is the target invoked by the top-level Makefile.
209 maybe-blessmail
: $(BLESSMAIL_TARGET
)
211 ## Install the internal utilities. Until they are installed, we can
212 ## just run them directly from lib-src.
213 ## If the chown/chmod commands fail, that is not a big deal.
214 ## update-game-score will detect at runtime that it is not setuid,
215 ## and handle things accordingly.
216 $(DESTDIR
)${archlibdir}: all
218 @echo
"Installing utilities run internally by Emacs."
219 umask
022; ${MKDIR_P} $(DESTDIR
)${archlibdir}
220 if
[ `cd $(DESTDIR)${archlibdir} && /bin/pwd` != `/bin/pwd` ]; then \
221 for file in
${UTILITIES}; do \
222 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $$file $(DESTDIR
)${archlibdir}/$$file ; \
225 umask
022; ${MKDIR_P} $(DESTDIR
)${gamedir}; \
226 touch
$(DESTDIR
)${gamedir}/snake-scores
; \
227 touch
$(DESTDIR
)${gamedir}/tetris-scores
228 -if chown
${gameuser} $(DESTDIR
)${archlibdir}/update-game-score
&& chmod u
+s
$(DESTDIR
)${archlibdir}/update-game-score
; then \
229 chown
${gameuser} $(DESTDIR
)${gamedir}; \
230 chmod u
=rwx
,g
=rwx
,o
=rx
$(DESTDIR
)${gamedir}; \
232 if
[ `cd $(DESTDIR)${archlibdir} && /bin/pwd` \
233 != `cd ${srcdir} && /bin/pwd` ]; then \
234 for file in
${SCRIPTS}; do \
235 $(INSTALL_SCRIPT
) ${srcdir}/$$file $(DESTDIR
)${archlibdir}/$$file; \
239 .PHONY
: install uninstall mostlyclean clean distclean maintainer-clean
240 .PHONY
: extraclean
check tags
242 install: $(DESTDIR
)${archlibdir}
244 @echo
"Installing utilities for users to run."
245 umask
022; ${MKDIR_P} $(DESTDIR
)${bindir}
246 for file in
${INSTALLABLES} ; do \
247 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $${file} $(DESTDIR
)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
249 for file in
${INSTALLABLE_SCRIPTS} ; do \
250 $(INSTALL_SCRIPT
) ${srcdir}/$${file} $(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
254 for file in
${INSTALLABLES}; do \
255 rm -f
$(DESTDIR
)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
257 for file in
${INSTALLABLE_SCRIPTS}; do \
258 rm -f
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
260 if
[ -d
$(DESTDIR
)${archlibdir} ]; then \
261 (cd
$(DESTDIR
)${archlibdir} && rm -f
${UTILITIES} ${SCRIPTS}) \
272 -rm -f Makefile blessmail
274 maintainer-clean
: distclean
277 extraclean
: maintainer-clean
280 ## Test the contents of the directory.
282 @echo
"We don't have any tests for the lib-src/ directory yet."
288 ## This verifies that the non-ASCII characters in the file \`testfile\'
289 ## have not been clobbered by whatever means were used to copy and
290 ## distribute Emacs. If they were clobbered, all the .elc files were
292 test-distrib
${EXEEXT}: ${srcdir}/test-distrib.c
293 $(CC
) ${ALL_CFLAGS} -o test-distrib
${srcdir}/test-distrib.c
294 .
/test-distrib
${srcdir}/testfile
296 ..
/lib
/libgnu.a
: $(config_h
)
297 cd ..
/lib
&& $(MAKE
) libgnu.a
299 regex.o
: $(srcdir)/..
/src
/regex.c
$(srcdir)/..
/src
/regex.h
$(config_h
)
300 ${CC} -c
${CPP_CFLAGS} -DCONFIG_BROKETS
-DINHIBIT_STRING_HEADER \
301 ${srcdir}/..
/src
/regex.c
303 etags
${EXEEXT}: ${srcdir}/etags.c regex.o
$(config_h
)
304 $(CC
) ${ALL_CFLAGS} -DEMACS_NAME
="\"GNU Emacs\"" \
305 -DVERSION
="\"${version}\"" ${srcdir}/etags.c \
306 regex.o
$(LOADLIBES
) -o etags
308 ebrowse
${EXEEXT}: ${srcdir}/ebrowse.c
${srcdir}/..
/lib
/min-max.h
$(config_h
)
309 $(CC
) ${ALL_CFLAGS} -DVERSION
="\"${version}\"" \
310 ${srcdir}/ebrowse.c
$(LOADLIBES
) -o ebrowse
312 ## We depend on etags to assure that parallel makes do not write two
313 ## etags.o files on top of each other.
314 ctags
${EXEEXT}: etags
${EXEEXT}
315 $(CC
) ${ALL_CFLAGS} -DCTAGS
-DEMACS_NAME
="\"GNU Emacs\"" \
316 -DVERSION
="\"${version}\"" ${srcdir}/etags.c \
317 regex.o
$(LOADLIBES
) -o ctags
319 profile
${EXEEXT}: ${srcdir}/profile.c
$(config_h
)
320 $(CC
) ${ALL_CFLAGS} ${srcdir}/profile.c \
321 $(LOADLIBES
) $(LIB_CLOCK_GETTIME
) -o profile
323 make-docfile
${EXEEXT}: ${srcdir}/make-docfile.c
$(config_h
)
324 $(CC
) ${ALL_CFLAGS} ${srcdir}/make-docfile.c
$(LOADLIBES
) \
327 movemail
${EXEEXT}: ${srcdir}/movemail.c pop.o
$(config_h
)
328 $(CC
) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
329 $(LOADLIBES
) $(LIBS_MOVE
) -o movemail
331 pop.o
: ${srcdir}/pop.c
${srcdir}/..
/lib
/min-max.h
$(config_h
)
332 $(CC
) -c
${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
334 emacsclient
${EXEEXT}: ${srcdir}/emacsclient.c
$(config_h
)
335 $(CC
) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
336 -DVERSION
="\"${version}\"" \
337 $(LOADLIBES
) -o emacsclient
339 hexl
${EXEEXT}: ${srcdir}/hexl.c
$(config_h
)
340 $(CC
) ${ALL_CFLAGS} ${srcdir}/hexl.c
$(LOADLIBES
) -o hexl
342 update-game-score
${EXEEXT}: ${srcdir}/update-game-score.c
$(config_h
)
343 $(CC
) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR
="\"$(gamedir)\"" \
344 ${srcdir}/update-game-score.c
$(LOADLIBES
) -o update-game-score
346 ## Makefile ends here.