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