abs_top_srcdir=@abs_top_srcdir@
VPATH = $(srcdir)
CC = @CC@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ -fPIC
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
EXEEXT = @EXEEXT@
ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj)
# Must be first, before dep inclusion!
-all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES)
+all: $(pdmp) $(OTHER_FILES)
.PHONY: all
dmpstruct_headers=$(srcdir)/lisp.h $(srcdir)/buffer.h \
MAKE_PDUMPER_FINGERPRINT =
endif
-## We have to create $(etc) here because init_cmdargs tests its
-## existence when setting Vinstallation_directory (FIXME?).
-## This goes on to affect various things, and the emacs binary fails
-## to start if Vinstallation_directory has the wrong value.
-temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) \
- $(charsets) $(charscript) $(MAKE_PDUMPER_FINGERPRINT)
- $(AM_V_CCLD)$(CC) -o $@.tmp \
- $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
- $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES)
-ifeq ($(HAVE_PDUMPER),yes)
- $(AM_V_at)$(MAKE_PDUMPER_FINGERPRINT) $@.tmp
-endif
- $(AM_V_at)mv $@.tmp $@
- $(MKDIR_P) $(etc)
-ifeq ($(DUMPING),unexec)
- ifneq ($(PAXCTL_notdumped),)
- $(PAXCTL_notdumped) $@
- endif
-endif
+## FIXME: dumper support totally missing here
+libemacs.so: $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) \
+ $(charsets) $(charscript) $(MAKE_PDUMPER_FINGERPRINT) main.o
+ $(CC) --shared -o $@ $(ALLOBJS) -Wl,-Bstatic $(LIBEGNU_ARCHIVE) -Wl,-Bdynamic $(LIBES)
+
+temacs$(EXEEXT): libemacs.so main.o
+ $(CC) -L. main.o -o $@ $(TEMACS_LDFLAGS) $(LDFLAGS) \
+ $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES) -lemacs -Wl,-rpath -Wl,$(shell pwd)
+
+# ## We have to create $(etc) here because init_cmdargs tests its
+# ## existence when setting Vinstallation_directory (FIXME?).
+# ## This goes on to affect various things, and the emacs binary fails
+# ## to start if Vinstallation_directory has the wrong value.
+# temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) \
+# $(charsets) $(charscript) $(MAKE_PDUMPER_FINGERPRINT)
+# $(AM_V_CCLD)$(CC) -o $@.tmp \
+# $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
+# $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES)
+# ifeq ($(HAVE_PDUMPER),yes)
+# $(AM_V_at)$(MAKE_PDUMPER_FINGERPRINT) $@.tmp
+# endif
+# $(AM_V_at)mv $@.tmp $@
+# $(MKDIR_P) $(etc)
+# ifeq ($(DUMPING),unexec)
+# ifneq ($(PAXCTL_notdumped),)
+# $(PAXCTL_notdumped) $@
+# endif
## The following oldxmenu-related rules are only (possibly) used if
## HAVE_X11 && !USE_GTK, but there is no harm in always defining them.
--- /dev/null
+/* Trampoline for GNU Emacs.
+ Copyright (C) 2019 Free Software
+ Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
+
+extern int main1 (int argc, char **argv);
+
+int
+main (int argc, char **argv)
+{
+ return main1(argc, argv);
+}