1 # Makefile for lib-src subdirectory in GNU Emacs.
2 # Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2011
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 C_WARNINGS_SWITCH
= @C_WARNINGS_SWITCH@
40 PROFILING_CFLAGS
= @PROFILING_CFLAGS@
42 # Program name transformation.
43 TRANSFORM
= @program_transform_name@
45 # ==================== Where To Install Things ====================
47 # The default location for installation. Everything is placed in
48 # subdirectories of this directory. The default values for many of
49 # the variables below are expressed in terms of this one, so you may
50 # not need to change them. This is set with the --prefix option to
54 # Like `prefix', but used for architecture-specific files. This is
55 # set with the --exec-prefix option to `../configure'.
56 exec_prefix=@
exec_prefix@
58 # Where to install Emacs and other binaries that people will want to
59 # run directly (like etags). This is set with the --bindir option
63 # Where to install and expect executable files to be run by Emacs
64 # rather than directly by users, and other architecture-dependent
65 # data. ${archlibdir} is usually below this. This is set with the
66 # --libexecdir option to `../configure'.
67 libexecdir
=@libexecdir@
69 # Directory for local state files for all programs.
70 localstatedir
=@localstatedir@
72 # Where to find the source code. This is set by the configure
73 # script's `--srcdir' option. However, the value of ${srcdir} in
74 # this makefile is not identical to what was specified with --srcdir,
75 # since the variable here has `/lib-src' added at the end.
77 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
81 # The top-level source directory, also set by configure.
82 top_srcdir
=@top_srcdir@
84 # ==================== Emacs-specific directories ====================
86 # These variables hold the values Emacs will actually use. They are
87 # based on the values of the standard Make variables above.
89 # Where to put executables to be run by Emacs rather than the user.
90 # This path usually includes the Emacs version and configuration name,
91 # so that multiple configurations for multiple versions of Emacs may
92 # be installed at once. This can be set with the --archlibdir option
94 archlibdir
=@archlibdir@
99 # ==================== Utility Programs for the Build =================
101 # ../configure figures out the correct values for these.
103 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
104 INSTALL_DATA
= @INSTALL_DATA@
105 INSTALL_SCRIPT
= @INSTALL_SCRIPT@
106 # By default, we uphold the dignity of our programs.
109 # ========================== Lists of Files ===========================
111 # Things that a user might actually run, which should be installed in bindir.
112 INSTALLABLES
= etags
${EXEEXT} ctags
${EXEEXT} emacsclient
${EXEEXT} \
115 INSTALLABLE_SCRIPTS
= rcs-checkin grep-changelog
116 STAMP_INST_SCRIPTS
= stamp-rcs-checkin stamp-grep-changelog
118 # Things that Emacs runs internally, or during the build process,
119 # which should not be installed in bindir.
120 UTILITIES
= profile
${EXEEXT} movemail
${EXEEXT} hexl
${EXEEXT} \
121 update-game-score
${EXEEXT}
123 DONT_INSTALL
= test-distrib
${EXEEXT} make-docfile
${EXEEXT}
125 # Like UTILITIES, but they're not system-dependent, and should not be
126 # deleted by the distclean target.
127 SCRIPTS
= rcs2log vcdiff
128 STAMP_SCRIPTS
= stamp-rcs2log stamp-vcdiff
130 # All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
131 EXE_FILES
= ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
133 # Specify additional -D flags for movemail. Options:
134 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
135 # See the comments about locking in movemail.c. Normally the values
136 # set by configure should be correct and you should not need to do anything.
137 # If neither flag is set, you need to use blessmail.
140 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
141 BLESSMAIL_TARGET
=@BLESSMAIL_TARGET@
143 ## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
145 ## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
147 ## -lkrb5 if HAVE_LIBKRB5
149 ## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
150 CRYPTOLIB
=@CRYPTOLIB@
151 ## -lcom_err if HAVE_LIBCOM_ERR
152 COM_ERRLIB
=@COM_ERRLIB@
153 ## -lhesiod if HAVE_LIBHESIOD
154 LIBHESIOD
=@LIBHESIOD@
155 ## -lresolv if HAVE_LIBRESOLV
156 LIBRESOLV
=@LIBRESOLV@
157 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
158 LIBS_MAIL
=@LIBS_MAIL@
160 ## Extra libraries to use when linking movemail.
161 LIBS_MOVE
= $(LIBS_MAIL
) $(KRB4LIB
) $(DESLIB
) $(KRB5LIB
) $(CRYPTOLIB
) \
162 $(COM_ERRLIB
) $(LIBHESIOD
) $(LIBRESOLV
)
164 ## Some systems define this to request special libraries.
165 LIBS_SYSTEM
= @LIBS_SYSTEM@
167 # Those files shared with other GNU utilities need HAVE_CONFIG_H
168 # defined before they know they can take advantage of the information
169 # in ../src/config.h.
170 BASE_CFLAGS
= $(C_SWITCH_SYSTEM
) $(C_SWITCH_MACHINE
) ${C_WARNINGS_SWITCH} \
171 -DHAVE_CONFIG_H
-I.
-I..
/src
-I..
/lib \
172 -I
${srcdir} -I
${srcdir}/..
/src
-I
${srcdir}/..
/lib
174 ALL_CFLAGS
= ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
175 LINK_CFLAGS
= ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
176 CPP_CFLAGS
= ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
178 all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
180 LOADLIBES
= ..
/lib
/libgnu.a
$(LIBS_SYSTEM
)
181 $(EXE_FILES
): ..
/lib
/libgnu.a
183 ## These targets copy the scripts into the build directory so that
184 ## they can be run from there in an uninstalled Emacs.
185 ## Nothing to do if pwd = srcdir.
186 insrcdir
=[ "`/bin/pwd`" = "`(cd $(srcdir) && /bin/pwd)`" ]
188 stamp-rcs2log
: $(srcdir)/rcs2log
189 $(insrcdir
) || cp
-p
$(srcdir)/rcs2log rcs2log
192 stamp-rcs-checkin
: $(srcdir)/rcs-checkin
193 $(insrcdir
) || cp
-p
$(srcdir)/rcs-checkin rcs-checkin
196 stamp-grep-changelog
: $(srcdir)/grep-changelog
197 $(insrcdir
) || cp
-p
$(srcdir)/grep-changelog grep-changelog
200 stamp-vcdiff
: $(srcdir)/vcdiff
201 $(insrcdir
) || cp
-p
$(srcdir)/vcdiff vcdiff
204 ## Only used if we need blessmail, but no harm in always defining.
205 ## This makes the actual blessmail executable.
207 $(EMACS
) $(EMACSOPT
) -l
$(srcdir)/..
/lisp
/mail
/blessmail.el
210 ## This checks if we need to run blessmail.
211 ## Do not charge ahead and do it! Let the installer decide.
212 need-blessmail
: blessmail
213 @if
[ `wc -l <blessmail` != 2 ] ; then \
214 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
215 echo Assuming
$$dir is really the mail spool directory
, you should
; \
216 echo run lib-src
/blessmail
$(DESTDIR
)${archlibdir}/movemail
${EXEEXT}; \
217 echo
as root
, to give movemail
${EXEEXT} appropriate permissions.
; \
218 echo Do that after running make
install.
; \
221 ## This is the target invoked by the top-level Makefile.
222 maybe-blessmail
: $(BLESSMAIL_TARGET
)
224 ## Install the internal utilities. Until they are installed, we can
225 ## just run them directly from lib-src.
226 ## If the chown/chmod commands fail, that is not a big deal.
227 ## update-game-score will detect at runtime that it is not setuid,
228 ## and handle things accordingly.
229 $(DESTDIR
)${archlibdir}: all
231 @echo
"Installing utilities run internally by Emacs."
232 umask
022; $(top_srcdir
)/build-aux
/install-sh
-d
$(DESTDIR
)${archlibdir}
233 if
[ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
234 for file in
${UTILITIES}; do \
235 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $$file $(DESTDIR
)${archlibdir}/$$file ; \
238 umask
022; $(top_srcdir
)/build-aux
/install-sh
-d
$(DESTDIR
)${gamedir}; \
239 touch
$(DESTDIR
)${gamedir}/snake-scores
; \
240 touch
$(DESTDIR
)${gamedir}/tetris-scores
241 -if chown
${gameuser} $(DESTDIR
)${archlibdir}/update-game-score
&& chmod u
+s
$(DESTDIR
)${archlibdir}/update-game-score
; then \
242 chown
${gameuser} $(DESTDIR
)${gamedir}; \
243 chmod u
=rwx
,g
=rwx
,o
=rx
$(DESTDIR
)${gamedir}; \
245 if
[ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
246 != `(cd ${srcdir} && /bin/pwd)` ]; then \
247 for file in
${SCRIPTS}; do \
248 $(INSTALL_SCRIPT
) ${srcdir}/$$file $(DESTDIR
)${archlibdir}/$$file; \
252 install: $(DESTDIR
)${archlibdir}
254 @echo
"Installing utilities for users to run."
255 for file in
${INSTALLABLES} ; do \
256 $(INSTALL_PROGRAM
) $(INSTALL_STRIP
) $${file} $(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
257 chmod a
+rx
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
259 for file in
${INSTALLABLE_SCRIPTS} ; do \
260 $(INSTALL_SCRIPT
) ${srcdir}/$${file} $(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
261 chmod a
+rx
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
265 (cd
$(DESTDIR
)${bindir}; \
266 for file in
${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \
267 rm -f
$(DESTDIR
)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
269 if
[ -d
$(DESTDIR
)${archlibdir} ]; then \
270 (cd
$(DESTDIR
)${archlibdir} && \
271 rm -f
${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
279 -rm -f
${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
283 -rm -f Makefile blessmail
285 maintainer-clean
: distclean
288 extraclean
: maintainer-clean
291 ## Test the contents of the directory.
293 @echo
"We don't have any tests for the lib-src/ directory yet."
299 ## This verifies that the non-ASCII characters in the file \`testfile\'
300 ## have not been clobbered by whatever means were used to copy and
301 ## distribute Emacs. If they were clobbered, all the .elc files were
303 test-distrib
${EXEEXT}: ${srcdir}/test-distrib.c
304 $(CC
) ${ALL_CFLAGS} -o test-distrib
${srcdir}/test-distrib.c
305 .
/test-distrib
${srcdir}/testfile
307 ..
/lib
/libgnu.a
: ..
/src
/config.h
308 cd ..
/lib
&& $(MAKE
) libgnu.a
310 regex.o
: $(srcdir)/..
/src
/regex.c
$(srcdir)/..
/src
/regex.h ..
/src
/config.h
311 ${CC} -c
${CPP_CFLAGS} -DCONFIG_BROKETS
-DINHIBIT_STRING_HEADER \
312 ${srcdir}/..
/src
/regex.c
314 etags
${EXEEXT}: ${srcdir}/etags.c regex.o ..
/src
/config.h
315 $(CC
) ${ALL_CFLAGS} -DEMACS_NAME
="\"GNU Emacs\"" \
316 -DVERSION
="\"${version}\"" ${srcdir}/etags.c \
317 regex.o
$(LOADLIBES
) -o etags
319 ebrowse
${EXEEXT}: ${srcdir}/ebrowse.c
${srcdir}/..
/lib
/min-max.h ..
/src
/config.h
320 $(CC
) ${ALL_CFLAGS} -DVERSION
="\"${version}\"" \
321 ${srcdir}/ebrowse.c
$(LOADLIBES
) -o ebrowse
323 ## We depend on etags to assure that parallel makes do not write two
324 ## etags.o files on top of each other.
325 ctags
${EXEEXT}: etags
${EXEEXT}
326 $(CC
) ${ALL_CFLAGS} -DCTAGS
-DEMACS_NAME
="\"GNU Emacs\"" \
327 -DVERSION
="\"${version}\"" ${srcdir}/etags.c \
328 regex.o
$(LOADLIBES
) -o ctags
330 profile
${EXEEXT}: ${srcdir}/profile.c ..
/src
/config.h
331 $(CC
) ${ALL_CFLAGS} ${srcdir}/profile.c
$(LOADLIBES
) -o profile
333 make-docfile
${EXEEXT}: ${srcdir}/make-docfile.c ..
/src
/config.h
334 $(CC
) ${ALL_CFLAGS} ${srcdir}/make-docfile.c
$(LOADLIBES
) \
337 movemail
${EXEEXT}: ${srcdir}/movemail.c pop.o ..
/src
/config.h
338 $(CC
) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
339 $(LOADLIBES
) $(LIBS_MOVE
) -o movemail
341 pop.o
: ${srcdir}/pop.c
${srcdir}/..
/lib
/min-max.h ..
/src
/config.h
342 $(CC
) -c
${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
344 emacsclient
${EXEEXT}: ${srcdir}/emacsclient.c ..
/src
/config.h
345 $(CC
) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
346 -DVERSION
="\"${version}\"" \
347 $(LOADLIBES
) -o emacsclient
349 hexl
${EXEEXT}: ${srcdir}/hexl.c ..
/src
/config.h
350 $(CC
) ${ALL_CFLAGS} ${srcdir}/hexl.c
$(LOADLIBES
) -o hexl
352 update-game-score
${EXEEXT}: ${srcdir}/update-game-score.c ..
/src
/config.h
353 $(CC
) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR
="\"$(gamedir)\"" \
354 ${srcdir}/update-game-score.c
$(LOADLIBES
) -o update-game-score
356 ## Makefile ends here.