Set linker-related things with configure.
[bpt/emacs.git] / src / Makefile.in
index b6a0e15..bab812e 100644 (file)
@@ -124,6 +124,8 @@ LIBS_SYSTEM=@LIBS_SYSTEM@
 ## Where to find libgcc.a, if using gcc and necessary.
 LIB_GCC=@LIB_GCC@
 
+LD=@LINKER@
+
 ## May use $CRT_DIR.
 LIB_STANDARD=@LIB_STANDARD@
 
@@ -180,6 +182,12 @@ OLDXMENU_TARGET=@OLDXMENU_TARGET@
 ## Else ${oldXMenudir}libXMenu11.a.
 OLDXMENU=@OLDXMENU@
 
+## If HAVE_X11 && !USE_GTK, ${OLDXMENU} ../src/${OLDXMENU}; else empty.
+## We use stamp-xmenu with these two deps to both ensure that lwlib
+## gets remade based on its dependencies in its own makefile,
+## and remake temacs if lwlib gets changed by this. 
+OLDXMENU_DEPS=@OLDXMENU_DEPS@
+
 ## If !HAVE_X11 && HAVE_X_WINDOWS, -lXMenu (this case no longer possible).
 ## Else if !HAVE_X11 || USE_GTK, empty.
 ## Else $(OLDXMENU).
@@ -323,52 +331,6 @@ ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
        $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $<
 
 
-/* A macro which other sections of Makefile can redefine to munge the
-   flags before they are passed to LD.  This is helpful if you have
-   redefined LD to something odd, like "gcc".
-   (The YMF prefix is a holdover from the old name "ymakefile".)  */
-#define YMF_PASS_LDFLAGS(flags) flags
-
-
-#ifdef ORDINARY_LINK
-LD = $(CC)
-
-#else /* not ORDINARY_LINK */
-GNULIB_VAR = $(LIB_GCC)
-
-/* Fix linking if compiled with GCC.  */
-#if defined (__GNUC__) && ! defined (LINKER)
-/* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
-   places that are difficult to figure out at make time.  Fortunately,
-   these same versions allow you to pass arbitrary flags on to the
-   linker, so there is no reason not to use it as a linker.
-
-   Well, it is not quite perfect.  The "-nostdlib" keeps GCC from
-   searching for libraries in its internal directories, so we have to
-   ask GCC explicitly where to find libgcc.a.  */
-#define LINKER $(CC) -nostdlib
-/* GCC passes any argument prefixed with -Xlinker directly to the linker.
-   See prefix-args.c for an explanation of why we do not do this with the
-   shell''s ``for'' construct.  Note that sane people do not have '.' in
-   their paths, so we must use ./prefix-args.  */
-#undef YMF_PASS_LDFLAGS
-#define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags`
-#endif /* defined (__GNUC__) && ! defined (LINKER) */
-
-#ifdef LINKER
-LD=LINKER
-#else /* not LINKER */
-LD=ld
-#endif /* not LINKER */
-
-#endif /* not ORDINARY_LINK */
-
-
-#ifdef NS_IMPL_GNUSTEP
-LD=$(CC) -rdynamic
-#endif
-
-
 /* lastfile must follow all files whose initialized data areas should
    be dumped as pure by dump-emacs.  */
 obj=    dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
@@ -395,29 +357,23 @@ SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
   w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
   w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_OBJ)
 
-gmallocobj =
-rallocobj =
-vmlimitobj =
-#ifndef SYSTEM_MALLOC
-#ifndef DOUG_LEA_MALLOC
-gmallocobj = gmalloc.o
-#endif
+/* gmalloc.o if !SYSTEM_MALLOC && !DOUG_LEA_MALLOC, else empty.  */
+GMALLOC_OBJ=@GMALLOC_OBJ@
 
-#ifdef REL_ALLOC
-rallocobj = ralloc.o
-#endif
+/* vm-limit.o if !SYSTEM_MALLOC, else empty.  */
+VMLIMIT_OBJ=@VMLIMIT_OBJ@
 
-vmlimitobj = vm-limit.o
-#endif /* !SYSTEM_MALLOC */
+/* ralloc.o if !SYSTEM_MALLOC && REL_ALLOC, else empty.  */
+RALLOC_OBJ=@RALLOC_OBJ@
 
 /* Empty on Cygwin, lastfile.o elsewhere.  */
 PRE_ALLOC_OBJ=@PRE_ALLOC_OBJ@
-/* lastfile.o vm-limit.o on Cygwin, $vmlimitobj elsewhere.  */
+/* lastfile.o on Cygwin, empty elsewhere.  */
 POST_ALLOC_OBJ=@POST_ALLOC_OBJ@
 
 /* List of object files that make-docfile should not be told about.  */
-otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(gmallocobj) $(rallocobj) \
-  $(POST_ALLOC_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
+otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
+  $(POST_ALLOC_OBJ) $(VMLIMIT_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
 
 /* This is the platform-specific list of Lisp files loaded into the
    dumped Emacs.  It is arranged like this because it is easier to generate
@@ -634,13 +590,13 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \
 /* Construct full set of libraries to be linked.
    Note that SunOS needs -lm to come before -lc; otherwise, you get
    duplicated symbols.  If the standard libraries were compiled
-   with GCC, we might need gnulib again after them.  */
+   with GCC, we might need LIB_GCC again after them.  */
 
 LIBES = $(LOADLIBES) $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
    $(RSVG_LIBS) $(DBUS_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
    $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \
    $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
-   $(GNULIB_VAR) $(LIB_MATH) $(LIB_STANDARD) $(GNULIB_VAR)
+   $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
 
 all: emacs${EXEEXT} $(OTHER_FILES)
 
@@ -682,6 +638,8 @@ ${libsrc}make-docfile${EXEEXT}:
 buildobj.h: Makefile
        echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h
 
+#define YMF_PASS_LDFLAGS(flags) @YMF_PASS_LDFLAGS@
+
 temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT}
        $(LD) YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \
          ${NS_IMPL_GNUSTEP_TEMACS_LDFLAGS} ) \
@@ -706,23 +664,18 @@ really-oldXMenu:
        @true  /* make -t should not create really-oldXMenu.  */
 .PHONY: really-oldXMenu
 
+/* We don''t really need this when OLDXMENU_DEPS is empty, but as
+   things stand we need something to satisfy the temacs dependency.  */
+stamp-oldxmenu: ${OLDXMENU_DEPS}
+       touch stamp-oldxmenu
+
 /* HAVE_X11 implies HAVE_X_WINDOWS and HAVE_MENUS.  */
 #if defined (HAVE_X11) && ! defined (USE_GTK)
-/* We use stamp-xmenu with these two deps to both ensure that lwlib
-   gets remade based on its dependencies in its own makefile,
-   and remake temacs if lwlib gets changed by this.  */
-stamp-oldxmenu: ${OLDXMENU} ../src/$(OLDXMENU)
-       touch stamp-oldxmenu
 /* Supply an ordering for parallel make.  */
 ../src/$(OLDXMENU): ${OLDXMENU}
 
 $(OLDXMENU): $(OLDXMENU_TARGET)
-
-#else /* !HAVE_X11 || USE_GTK */ 
-/* We don''t really need this, but satisfy the dependency.  */
-stamp-oldxmenu:
-       touch stamp-oldxmenu
-#endif /* HAVE_X11 && !USE_GTK */
+#endif /* HAVE_X11 && !USE_GTK */ 
 
 ../config.status:: epaths.in
        @echo "The file epaths.h needs to be set up from epaths.in."
@@ -999,13 +952,14 @@ ${ns_appdir}: ${ns_appsrc}
        rm -fr ${ns_appdir}
        mkdir -p ${ns_appdir}
        ( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; umask 022; tar xf - )
+#endif /* HAVE_NS */
 
+/* These are only used if HAVE_NS, but no harm in always defining them.  */
 ${ns_appbindir}Emacs: emacs${EXEEXT}
        mkdir -p ${ns_appbindir}
        cp -f emacs${EXEEXT} ${ns_appbindir}Emacs
 
 ns-app: ${ns_appdir} ${ns_appbindir}Emacs
-#endif /* HAVE_NS */
 
 mostlyclean:
        rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
@@ -1015,9 +969,8 @@ mostlyclean:
 clean: mostlyclean
        rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT}
        -rm -rf deps
-#ifdef HAVE_NS
-       rm -fr ${ns_appdir}
-#endif
+       test "X${ns_appdir}" = "X" || rm -rf ${ns_appdir}
+
 /* bootstrap-clean is used to clean up just before a bootstrap.
    It should remove all files generated during a compilation/bootstrap,
    but not things like config.status or TAGS.  */
@@ -1097,7 +1050,9 @@ tags: TAGS TAGS-LISP $(lwlibdir)TAGS
 /* Since the .el.elc rule cannot specify an extra dependency, we do it here.  */
 ${lisp} ${SOME_MACHINE_LISP}: $(BOOTSTRAPEMACS)
 
-${lispsource}loaddefs.el: $(BOOTSTRAPEMACS)
+/* VCSWITNESS points to the file that holds info about the current checkout.
+   We use it as a heuristic to decide when to rebuild loaddefs.el.  */
+${lispsource}loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS)
        cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=${bootstrap_exe}
 
 /* Dump an Emacs executable named bootstrap-emacs containing the