Update copyright year to 2014 by running admin/update-copyright.
[emacs.git] / lib-src / Makefile.in
blob91a8e74819faf563d595906ca5b393460ad766c2
1 ### @configure_input@
3 # Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2014 Free Software
4 # Foundation, Inc.
6 # This file is part of GNU Emacs.
8 # GNU Emacs is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # GNU Emacs is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21 SHELL = @SHELL@
23 # Following ../lisp/Makefile.in.
24 EMACS = ../src/emacs
25 EMACSOPT = -batch --no-site-file --no-site-lisp
27 # ==================== Things `configure' will edit ====================
29 CC=@CC@
30 CFLAGS=@CFLAGS@
31 version=@version@
32 ## Used in $archlibdir.
33 configuration=@configuration@
34 EXEEXT=@EXEEXT@
35 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
36 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
37 PROFILING_CFLAGS = @PROFILING_CFLAGS@
38 WARN_CFLAGS = @WARN_CFLAGS@
39 WERROR_CFLAGS = @WERROR_CFLAGS@
40 UPDATE_MANIFEST = @UPDATE_MANIFEST@
42 # Program name transformation.
43 TRANSFORM = @program_transform_name@
45 # ==================== Where To Install Things ====================
47 # Location to install Emacs.app under GNUstep / Mac OS X.
48 # Later values may use this.
49 ns_appbindir=@ns_appbindir@
51 # The default location for installation. Everything is placed in
52 # subdirectories of this directory. The default values for many of
53 # the variables below are expressed in terms of this one, so you may
54 # not need to change them. This is set with the --prefix option to
55 # `../configure'.
56 prefix=@prefix@
58 # Like `prefix', but used for architecture-specific files. This is
59 # set with the --exec-prefix option to `../configure'.
60 exec_prefix=@exec_prefix@
62 # Where to install Emacs and other binaries that people will want to
63 # run directly (like etags). This is set with the --bindir option
64 # to `../configure'.
65 bindir=@bindir@
67 # Where to install and expect executable files to be run by Emacs
68 # rather than directly by users, and other architecture-dependent
69 # data. ${archlibdir} is usually below this. This is set with the
70 # --libexecdir option to `../configure'.
71 libexecdir=@libexecdir@
73 # Directory for local state files for all programs.
74 localstatedir=@localstatedir@
76 # Where to find the source code. This is set by the configure
77 # script's `--srcdir' option. However, the value of ${srcdir} in
78 # this makefile is not identical to what was specified with --srcdir,
79 # since the variable here has `/lib-src' added at the end.
81 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
82 srcdir=@srcdir@
83 VPATH=@srcdir@
85 # The top-level source directory, also set by configure.
86 top_srcdir=@top_srcdir@
87 # MinGW CPPFLAGS may use this.
88 abs_top_srcdir=@abs_top_srcdir@
90 # ==================== Emacs-specific directories ====================
92 # These variables hold the values Emacs will actually use. They are
93 # based on the values of the standard Make variables above.
95 # Where to put executables to be run by Emacs rather than the user.
96 # This path usually includes the Emacs version and configuration name,
97 # so that multiple configurations for multiple versions of Emacs may
98 # be installed at once. This can be set with the --archlibdir option
99 # to `../configure'.
100 archlibdir=@archlibdir@
102 gamedir=@gamedir@
103 gameuser=@gameuser@
105 # ==================== Utility Programs for the Build =================
107 # ../configure figures out the correct values for these.
108 INSTALL = @INSTALL@
109 INSTALL_PROGRAM = @INSTALL_PROGRAM@
110 INSTALL_SCRIPT = @INSTALL_SCRIPT@
111 # By default, we uphold the dignity of our programs.
112 INSTALL_STRIP =
113 MKDIR_P = @MKDIR_P@
115 # ========================== Lists of Files ===========================
117 # emacsclientw.exe for MinGW, empty otherwise
118 CLIENTW = @CLIENTW@
120 # Things that a user might actually run, which should be installed in bindir.
121 INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
122 ebrowse${EXEEXT}
124 INSTALLABLE_SCRIPTS = grep-changelog
126 # Things that Emacs runs internally, or during the build process,
127 # which should not be installed in bindir.
128 UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
129 update-game-score${EXEEXT}
131 DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
133 # Like UTILITIES, but they're not system-dependent, and should not be
134 # deleted by the distclean target.
135 SCRIPTS= rcs2log $(UPDATE_MANIFEST)
137 # All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
138 EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
140 # Specify additional -D flags for movemail. Options:
141 # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
142 # See the comments about locking in movemail.c. Normally the values
143 # set by configure should be correct and you should not need to do anything.
144 # If neither flag is set, you need to use blessmail.
145 MOVE_FLAGS=
147 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
148 BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
150 ## -lkrb or -lkrb4 if needed
151 KRB4LIB=@KRB4LIB@
152 ## -ldes or -ldes425 if needed
153 DESLIB=@DESLIB@
154 ## -lkrb5 if needed
155 KRB5LIB=@KRB5LIB@
156 ## -lk5crypto or -lcrypto if needed
157 CRYPTOLIB=@CRYPTOLIB@
158 ## -lcom_err if needed
159 COM_ERRLIB=@COM_ERRLIB@
160 ## -lhesiod if needed
161 LIBHESIOD=@LIBHESIOD@
162 ## -lresolv if HAVE_LIBRESOLV
163 LIBRESOLV=@LIBRESOLV@
164 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
165 LIBS_MAIL=@LIBS_MAIL@
166 ## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
167 LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
168 ## empty or -lrt or -lposix4 if HAVE_FDATASYNC
169 LIB_FDATASYNC = @LIB_FDATASYNC@
170 ## empty or -lwsock2 for MinGW
171 LIB_WSOCK32=@LIB_WSOCK32@
173 ## Extra libraries to use when linking movemail.
174 LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
175 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
177 ## Extra libraries when linking emacsclient
178 ## (empty or -lcomctl32 for MinGW)
179 LIBS_ECLIENT = @LIBS_ECLIENT@
181 ## Extra object files for linking for MinGW
182 NTLIB = @NTLIB@
183 CLIENTRES = @CLIENTRES@
184 WINDRES = @WINDRES@
186 ## Some systems define this to request special libraries.
187 LIBS_SYSTEM = @LIBS_SYSTEM@
189 BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
190 $(WARN_CFLAGS) $(WERROR_CFLAGS) \
191 -I. -I../src -I../lib \
192 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
194 ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
195 LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
196 CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
198 # Configuration files for .o files to depend on.
199 config_h = ../src/config.h $(srcdir)/../src/conf_post.h
201 all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
203 .PHONY: all need-blessmail maybe-blessmail
205 LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
206 $(EXE_FILES): ../lib/libgnu.a
208 ## Only used if we need blessmail, but no harm in always defining.
209 ## This makes the actual blessmail executable.
210 blessmail:
211 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
212 chmod +x blessmail
214 ## This checks if we need to run blessmail.
215 ## Do not charge ahead and do it! Let the installer decide.
216 need-blessmail: blessmail
217 @if [ `wc -l <blessmail` != 2 ] ; then \
218 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
219 echo "Assuming $$dir is really the mail spool directory, you should"; \
220 echo "run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}"; \
221 echo "as root, to give movemail${EXEEXT} appropriate permissions."; \
222 echo "Do that after running make install."; \
225 ## This is the target invoked by the top-level Makefile.
226 maybe-blessmail: $(BLESSMAIL_TARGET)
228 ## Install the internal utilities. Until they are installed, we can
229 ## just run them directly from lib-src.
230 ## If the chown/chmod commands fail, that is not a big deal.
231 ## update-game-score will detect at runtime that it is not setuid,
232 ## and handle things accordingly.
233 $(DESTDIR)${archlibdir}: all
234 @echo
235 @echo "Installing utilities run internally by Emacs."
236 umask 022; ${MKDIR_P} "$(DESTDIR)${archlibdir}"
237 exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
238 if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
239 for file in ${UTILITIES}; do \
240 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file "$(DESTDIR)${archlibdir}/$$file" ; \
241 done ; \
243 umask 022; ${MKDIR_P} "$(DESTDIR)${gamedir}"; \
244 touch "$(DESTDIR)${gamedir}/snake-scores"; \
245 touch "$(DESTDIR)${gamedir}/tetris-scores"
246 -if chown ${gameuser} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && chmod u+s "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"; then \
247 chown ${gameuser} "$(DESTDIR)${gamedir}"; \
248 chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"; \
250 if [ "`cd \"$(DESTDIR)${archlibdir}\" && /bin/pwd`" \
251 != "`cd ${srcdir} && /bin/pwd`" ]; then \
252 for file in ${SCRIPTS}; do \
253 $(INSTALL_SCRIPT) ${srcdir}/$$file "$(DESTDIR)${archlibdir}/$$file"; \
254 done ; \
257 .PHONY: install uninstall mostlyclean clean distclean maintainer-clean
258 .PHONY: extraclean check tags
260 install: $(DESTDIR)${archlibdir}
261 @echo
262 @echo "Installing utilities for users to run."
263 umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
264 for file in ${INSTALLABLES} ; do \
265 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
266 done
267 for file in ${INSTALLABLE_SCRIPTS} ; do \
268 $(INSTALL_SCRIPT) ${srcdir}/$${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
269 done
271 uninstall:
272 for file in ${INSTALLABLES}; do \
273 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
274 done
275 for file in ${INSTALLABLE_SCRIPTS}; do \
276 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
277 done
278 if [ -d "$(DESTDIR)${archlibdir}" ]; then \
279 (cd "$(DESTDIR)${archlibdir}" && rm -f ${UTILITIES} ${SCRIPTS}) \
282 mostlyclean:
283 -rm -f core *.o *.res
285 clean: mostlyclean
286 -rm -f ${EXE_FILES}
288 distclean: clean
289 -rm -f TAGS
290 -rm -f Makefile blessmail
292 maintainer-clean: distclean
293 true
295 extraclean: maintainer-clean
296 -rm -f *~ \#*
298 ## Test the contents of the directory.
299 check:
300 @echo "We don't have any tests for the lib-src/ directory yet."
302 tags: TAGS
303 TAGS: etags${EXEEXT}
304 etags *.[ch]
306 ## This verifies that the non-ASCII characters in the file \`testfile\'
307 ## have not been clobbered by whatever means were used to copy and
308 ## distribute Emacs. If they were clobbered, all the .elc files were
309 ## clobbered too.
310 test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
311 $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c
312 ./test-distrib ${srcdir}/testfile
314 ../lib/libgnu.a: $(config_h)
315 cd ../lib && $(MAKE) libgnu.a
317 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
318 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
319 ${srcdir}/../src/regex.c
321 etags${EXEEXT}: ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
322 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
323 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
324 regex.o $(LOADLIBES) $(NTLIB) -o etags${EXEEXT}
326 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
327 $(config_h)
328 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
329 ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o ebrowse${EXEEXT}
331 ## We depend on etags to assure that parallel makes do not write two
332 ## etags.o files on top of each other.
333 ctags${EXEEXT}: etags${EXEEXT}
334 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
335 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
336 regex.o $(LOADLIBES) $(NTLIB) -o ctags${EXEEXT}
338 profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
339 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
340 $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT}
342 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
343 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \
344 -o make-docfile${EXEEXT}
346 movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
347 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
348 $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o movemail${EXEEXT}
350 pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
351 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
353 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
354 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
355 -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
356 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclient${EXEEXT}
358 emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
359 $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \
360 -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
361 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclientw${EXEEXT}
363 NTINC = ${srcdir}/../nt/inc
364 NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
365 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
366 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
368 # The dependency on $(NTDEPS) is a trick intended to cause recompile of
369 # programs on MinGW whenever some private header in nt/inc is modified.
370 ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
371 $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
373 hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
374 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT}
376 update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
377 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
378 ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \
379 -o update-game-score${EXEEXT}
381 emacsclient.res: $(NTINC)/../emacsclient.rc
382 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o emacsclient.res \
383 $(NTINC)/../emacsclient.rc
385 ## Makefile ends here.