Attempt at a fix for mingw CPPFLAGS
[bpt/emacs.git] / lib-src / Makefile.in
CommitLineData
bbece175
GM
1### @configure_input@
2
3# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2013
4# Free Software Foundation, Inc.
29ed0542 5
eb4252f7 6# This file is part of GNU Emacs.
29ed0542 7
294981c7 8# GNU Emacs is free software: you can redistribute it and/or modify
eb4252f7 9# it under the terms of the GNU General Public License as published by
294981c7
GM
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
29ed0542 12
eb4252f7
RS
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.
29ed0542 17
eb4252f7 18# You should have received a copy of the GNU General Public License
294981c7
GM
19# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20
50b13cde 21SHELL = @SHELL@
f7dbcf3c 22
70e48c86
GM
23# Following ../lisp/Makefile.in.
24EMACS = ../src/emacs
e7a42417 25EMACSOPT = -batch --no-site-file --no-site-lisp
70e48c86 26
eb4252f7 27# ==================== Things `configure' will edit ====================
c71beb75 28
b93f2493
BF
29CC=@CC@
30CFLAGS=@CFLAGS@
b93f2493 31version=@version@
d3b23034 32## Used in $archlibdir.
cf770692 33configuration=@configuration@
108c7c97 34EXEEXT=@EXEEXT@
49628785
GM
35C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
36C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
e6cfa7c3 37PROFILING_CFLAGS = @PROFILING_CFLAGS@
b8df54ff
PE
38WARN_CFLAGS = @WARN_CFLAGS@
39WERROR_CFLAGS = @WERROR_CFLAGS@
d4166523 40UPDATE_MANIFEST = @UPDATE_MANIFEST@
c71beb75 41
a4663fed
PJ
42# Program name transformation.
43TRANSFORM = @program_transform_name@
44
eb4252f7 45# ==================== Where To Install Things ====================
c71beb75 46
3a4155de
GM
47# Location to install Emacs.app under GNUstep / Mac OS X.
48# Later values may use this.
49ns_appbindir=@ns_appbindir@
50
eb4252f7
RS
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'.
b93f2493 56prefix=@prefix@
c71beb75 57
eb4252f7
RS
58# Like `prefix', but used for architecture-specific files. This is
59# set with the --exec-prefix option to `../configure'.
b93f2493 60exec_prefix=@exec_prefix@
c71beb75 61
eb4252f7
RS
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'.
b93f2493 65bindir=@bindir@
c71beb75 66
eb4252f7
RS
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
424b6d2b
RS
70# --libexecdir option to `../configure'.
71libexecdir=@libexecdir@
c71beb75 72
712eaee0
AS
73# Directory for local state files for all programs.
74localstatedir=@localstatedir@
75
eb4252f7
RS
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.
5126d3b7
RS
80
81# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
b93f2493
BF
82srcdir=@srcdir@
83VPATH=@srcdir@
c71beb75 84
2d521ee6
DM
85# The top-level source directory, also set by configure.
86top_srcdir=@top_srcdir@
eb9a3661 87abs_top_srcdir=@abs_top_srcdir@ # MinGW CPPFLAGS may use this
2d521ee6 88
eb4252f7 89# ==================== Emacs-specific directories ====================
c71beb75 90
eb4252f7
RS
91# These variables hold the values Emacs will actually use. They are
92# based on the values of the standard Make variables above.
c71beb75 93
eb4252f7
RS
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
98# to `../configure'.
b93f2493 99archlibdir=@archlibdir@
41f86d5a 100
1ba1fb11
CW
101gamedir=@gamedir@
102gameuser=@gameuser@
103
eb4252f7 104# ==================== Utility Programs for the Build =================
c71beb75 105
eb4252f7 106# ../configure figures out the correct values for these.
b93f2493 107INSTALL = @INSTALL@
b93f2493 108INSTALL_PROGRAM = @INSTALL_PROGRAM@
01c7d383 109INSTALL_SCRIPT = @INSTALL_SCRIPT@
ae6ed0ac
RS
110# By default, we uphold the dignity of our programs.
111INSTALL_STRIP =
005ad204 112MKDIR_P = @MKDIR_P@
c71beb75 113
eb4252f7 114# ========================== Lists of Files ===========================
f7dbcf3c 115
f540ee86
EZ
116# emacsclientw.exe for MinGW, empty otherwise
117CLIENTW = @CLIENTW@
118
2f8d5db9 119# Things that a user might actually run, which should be installed in bindir.
f540ee86 120INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
3fb78d1f 121 ebrowse${EXEEXT}
2f8d5db9 122
418cd726 123INSTALLABLE_SCRIPTS = grep-changelog
f7dbcf3c 124
eb4252f7
RS
125# Things that Emacs runs internally, or during the build process,
126# which should not be installed in bindir.
c136e5cd
GM
127UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
128 update-game-score${EXEEXT}
f7dbcf3c 129
108c7c97 130DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
5aae6601 131
eb4252f7
RS
132# Like UTILITIES, but they're not system-dependent, and should not be
133# deleted by the distclean target.
d4166523 134SCRIPTS= rcs2log $(UPDATE_MANIFEST)
b7cceaf1 135
9a514d4a
PE
136# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
137EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
138
aded53ff
GM
139# Specify additional -D flags for movemail. Options:
140# -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
141# See the comments about locking in movemail.c. Normally the values
d3b23034
GM
142# set by configure should be correct and you should not need to do anything.
143# If neither flag is set, you need to use blessmail.
81f94052
RS
144MOVE_FLAGS=
145
7490175b
GM
146## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
147BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
f6c0ee20 148
57f8c490 149## -lkrb or -lkrb4 if needed
5e58e3a4 150KRB4LIB=@KRB4LIB@
57f8c490 151## -ldes or -ldes425 if needed
5e58e3a4 152DESLIB=@DESLIB@
57f8c490 153## -lkrb5 if needed
5e58e3a4 154KRB5LIB=@KRB5LIB@
57f8c490 155## -lk5crypto or -lcrypto if needed
5e58e3a4 156CRYPTOLIB=@CRYPTOLIB@
57f8c490 157## -lcom_err if needed
5e58e3a4 158COM_ERRLIB=@COM_ERRLIB@
57f8c490 159## -lhesiod if needed
5e58e3a4
GM
160LIBHESIOD=@LIBHESIOD@
161## -lresolv if HAVE_LIBRESOLV
162LIBRESOLV=@LIBRESOLV@
163## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
164LIBS_MAIL=@LIBS_MAIL@
d35af63c
PE
165## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
166LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
47d7532e
PE
167## empty or -lrt or -lposix4 if HAVE_FDATASYNC
168LIB_FDATASYNC = @LIB_FDATASYNC@
d6db9fd6
EZ
169## empty or -lwsock2 for MinGW
170LIB_WSOCK32=@LIB_WSOCK32@
5e58e3a4
GM
171
172## Extra libraries to use when linking movemail.
2f8d5db9 173LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
d6db9fd6 174 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
5e58e3a4 175
d6db9fd6
EZ
176## Extra libraries when linking emacsclient
177## (empty or -lcomctl32 for MinGW)
178LIBS_ECLIENT = @LIBS_ECLIENT@
179
180## Extra object files for linking for MinGW
a74b0e1b 181NTLIB = @NTLIB@
095bf253
EZ
182CLIENTRES = @CLIENTRES@
183WINDRES = @WINDRES@
7c4026b6 184
97efb629
GM
185## Some systems define this to request special libraries.
186LIBS_SYSTEM = @LIBS_SYSTEM@
187
b8df54ff
PE
188BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
189 $(WARN_CFLAGS) $(WERROR_CFLAGS) \
cf38a720 190 -I. -I../src -I../lib \
9a514d4a 191 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
c88b05a9 192
e6cfa7c3 193ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
a4daeecf 194LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
e6cfa7c3 195CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
5e58e3a4 196
de7de872
GM
197# Configuration files for .o files to depend on.
198config_h = ../src/config.h $(srcdir)/../src/conf_post.h
199
67163749 200all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
5ef215d8 201
0aee6912
PE
202.PHONY: all need-blessmail maybe-blessmail
203
9a514d4a
PE
204LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
205$(EXE_FILES): ../lib/libgnu.a
eb4252f7 206
d3b23034
GM
207## Only used if we need blessmail, but no harm in always defining.
208## This makes the actual blessmail executable.
f675ecb5 209blessmail:
70e48c86 210 $(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
c6207d0d 211 chmod +x blessmail
c6207d0d 212
d3b23034
GM
213## This checks if we need to run blessmail.
214## Do not charge ahead and do it! Let the installer decide.
f6c0ee20 215need-blessmail: blessmail
d19f95fe
RS
216 @if [ `wc -l <blessmail` != 2 ] ; then \
217 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
48f73cfb
GM
218 echo "Assuming $$dir is really the mail spool directory, you should"; \
219 echo "run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}"; \
220 echo "as root, to give movemail${EXEEXT} appropriate permissions."; \
221 echo "Do that after running make install."; \
d19f95fe 222 fi
f6c0ee20 223
d3b23034 224## This is the target invoked by the top-level Makefile.
f6c0ee20 225maybe-blessmail: $(BLESSMAIL_TARGET)
d19f95fe 226
d3b23034
GM
227## Install the internal utilities. Until they are installed, we can
228## just run them directly from lib-src.
229## If the chown/chmod commands fail, that is not a big deal.
230## update-game-score will detect at runtime that it is not setuid,
231## and handle things accordingly.
81af9060 232$(DESTDIR)${archlibdir}: all
c71beb75
JB
233 @echo
234 @echo "Installing utilities run internally by Emacs."
48f73cfb
GM
235 umask 022; ${MKDIR_P} "$(DESTDIR)${archlibdir}"
236 if [ "`cd \"$(DESTDIR)${archlibdir}\" && /bin/pwd`" != "`/bin/pwd`" ]; then \
544d556f 237 for file in ${UTILITIES}; do \
48f73cfb 238 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file "$(DESTDIR)${archlibdir}/$$file" ; \
544d556f 239 done ; \
ad600343 240 fi
48f73cfb
GM
241 umask 022; ${MKDIR_P} "$(DESTDIR)${gamedir}"; \
242 touch "$(DESTDIR)${gamedir}/snake-scores"; \
243 touch "$(DESTDIR)${gamedir}/tetris-scores"
244 -if chown ${gameuser} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && chmod u+s "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"; then \
245 chown ${gameuser} "$(DESTDIR)${gamedir}"; \
246 chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"; \
7451222f 247 fi
48f73cfb 248 if [ "`cd \"$(DESTDIR)${archlibdir}\" && /bin/pwd`" \
b8e3b0a9 249 != "`cd ${srcdir} && /bin/pwd`" ]; then \
544d556f 250 for file in ${SCRIPTS}; do \
48f73cfb 251 $(INSTALL_SCRIPT) ${srcdir}/$$file "$(DESTDIR)${archlibdir}/$$file"; \
c71beb75 252 done ; \
0268f19b 253 fi
f7dbcf3c 254
0aee6912
PE
255.PHONY: install uninstall mostlyclean clean distclean maintainer-clean
256.PHONY: extraclean check tags
257
81af9060 258install: $(DESTDIR)${archlibdir}
c71beb75
JB
259 @echo
260 @echo "Installing utilities for users to run."
48f73cfb 261 umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
b70cff71 262 for file in ${INSTALLABLES} ; do \
48f73cfb 263 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
0268f19b 264 done
b70cff71 265 for file in ${INSTALLABLE_SCRIPTS} ; do \
48f73cfb 266 $(INSTALL_SCRIPT) ${srcdir}/$${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
0268f19b 267 done
f7dbcf3c 268
39b649dd 269uninstall:
eeced60b 270 for file in ${INSTALLABLES}; do \
48f73cfb 271 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
eeced60b
GM
272 done
273 for file in ${INSTALLABLE_SCRIPTS}; do \
48f73cfb 274 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
eeced60b 275 done
48f73cfb
GM
276 if [ -d "$(DESTDIR)${archlibdir}" ]; then \
277 (cd "$(DESTDIR)${archlibdir}" && rm -f ${UTILITIES} ${SCRIPTS}) \
f8388570 278 fi
39b649dd 279
a17d2c25 280mostlyclean:
38b787fa 281 -rm -f core *.o *.res
a17d2c25
RS
282
283clean: mostlyclean
497c74cd 284 -rm -f ${EXE_FILES}
f7dbcf3c 285
39b649dd 286distclean: clean
5c579a75 287 -rm -f TAGS
81ac4f35 288 -rm -f Makefile blessmail
f7dbcf3c 289
26873b72 290maintainer-clean: distclean
39b649dd 291 true
c71beb75 292
a01c76d7 293extraclean: maintainer-clean
c71beb75 294 -rm -f *~ \#*
f7dbcf3c 295
d3b23034 296## Test the contents of the directory.
f7dbcf3c 297check:
c88b05a9 298 @echo "We don't have any tests for the lib-src/ directory yet."
f7dbcf3c 299
93548af1 300tags: TAGS
108c7c97 301TAGS: etags${EXEEXT}
f7dbcf3c
JB
302 etags *.[ch]
303
d3b23034
GM
304## This verifies that the non-ASCII characters in the file \`testfile\'
305## have not been clobbered by whatever means were used to copy and
306## distribute Emacs. If they were clobbered, all the .elc files were
307## clobbered too.
108c7c97 308test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
7c4026b6 309 $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c
0d73e8e3 310 ./test-distrib ${srcdir}/testfile
f7dbcf3c 311
de7de872 312../lib/libgnu.a: $(config_h)
9a514d4a
PE
313 cd ../lib && $(MAKE) libgnu.a
314
de7de872 315regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
2f8d5db9
GM
316 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
317 ${srcdir}/../src/regex.c
66ab94d9 318
d6db9fd6 319etags${EXEEXT}: ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
2f8d5db9 320 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
84bbb1ad 321 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
d6db9fd6 322 regex.o $(LOADLIBES) $(NTLIB) -o etags${EXEEXT}
f7dbcf3c 323
d6db9fd6
EZ
324ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
325 $(config_h)
2f8d5db9 326 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
d6db9fd6 327 ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o ebrowse${EXEEXT}
adb0a8d3 328
d3b23034
GM
329## We depend on etags to assure that parallel makes do not write two
330## etags.o files on top of each other.
108c7c97 331ctags${EXEEXT}: etags${EXEEXT}
2f8d5db9 332 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
84bbb1ad 333 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
d6db9fd6 334 regex.o $(LOADLIBES) $(NTLIB) -o ctags${EXEEXT}
f7dbcf3c 335
d6db9fd6 336profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
d35af63c 337 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
d6db9fd6 338 $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT}
379fb9c8 339
d6db9fd6
EZ
340make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
341 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \
7c4026b6 342 -o make-docfile${EXEEXT}
f7dbcf3c 343
a74b0e1b 344movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
d114d4f3 345 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
d6db9fd6 346 $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o movemail${EXEEXT}
81f94052 347
d6db9fd6 348pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
81f94052 349 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
f7dbcf3c 350
f540ee86 351emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
84bbb1ad 352 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
d6db9fd6
EZ
353 -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
354 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclient${EXEEXT}
7c4026b6 355
f540ee86
EZ
356emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
357 $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \
d6db9fd6
EZ
358 -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
359 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclientw${EXEEXT}
360
2b57bbc0 361NTINC = ${srcdir}/../nt/inc
d6db9fd6
EZ
362NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
363 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
364 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
f540ee86 365
d6db9fd6
EZ
366# The dependency on $(NTDEPS) is a trick intended to cause recompile of
367# programs on MinGW whenever some private header in nt/inc is modified.
368ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
7c4026b6 369 $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
f7dbcf3c 370
d6db9fd6 371hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
7c4026b6 372 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT}
f7dbcf3c 373
a74b0e1b 374update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
1c728a9d 375 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
d6db9fd6 376 ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \
7c4026b6 377 -o update-game-score${EXEEXT}
d3b23034 378
2b57bbc0
EZ
379emacsclient.res: $(NTINC)/../emacsclient.rc
380 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o emacsclient.res \
381 $(NTINC)/../emacsclient.rc
095bf253 382
d3b23034 383## Makefile ends here.