cosmetics, include ent/ent.h (or one of its sub-includes) directly, take 2, ...
[sxemacs] / src / Makefile.am
1 ## SXEmacs Makefile.am
2
3 ## Copyright (C) 2007 Steve Youngs
4
5 ## This file is part of SXEmacs.
6
7 ## SXEmacs is free software: you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation, either version 3 of the License, or
10 ## (at your option) any later version.
11
12 ## SXEmacs is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ## GNU General Public License for more details.
16
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 ## Process this file with automake to produce Makefile.in
21
22 # Help the Developers and yourself. Just use the C locale and settings
23 # for the compilation. They can still be overriden by make LANG=<whatever>
24 # but that is general a not very good idea
25 LANG=C
26 LC_ALL=C
27
28 builddir = @builddir@
29 srcdir = @srcdir@
30 top_builddir = @top_builddir@
31 top_build_prefix = $(top_builddir)/
32 top_srcdir = @top_srcdir@
33 abs_builddir = @abs_builddir@
34 abs_top_builddir = @abs_top_builddir@
35 abs_top_srcdir = @abs_top_srcdir@
36
37 AM_CFLAGS = -Demacs $(OPENSSL_CFLAGS) -DUSE_SXEMACS_CONFIG_H -DXTSTRINGDEFINES
38 AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_builddir) $(c_switch_general) $(LTDLINCL)
39 AM_LDFLAGS = $(OPENSSL_LDFLAGS) $(ENT_LDFLAGS) $(LIBLTDL) $(XCCLDFLAGS)
40
41 headerdir = $(includedir)/$(instvarsepdir)
42 sheaderdir = $(headerdir)/s
43 mheaderdir = $(headerdir)/m
44 archlibdir = ${libdir}/${instvardir}/${configuration}
45
46 sxesrcdir = $(sxe_srcdir)/src
47 bldsrcdir = $(builddir)
48 sxelispdir = $(top_srcdir)/lisp
49 bldlispdir = $(top_builddir)/lisp
50 sxelwlibdir = $(top_srcdir)/src/ui/lwlib
51 bldlwlibdir = $(top_builddir)/src/ui/lwlib
52 sxeemoddir = $(top_srcdir)/modules
53 bldemoddir = $(top_builddir)/modules
54 sxelibsrcdir = $(abs_top_srcdir)/lib-src
55 bldlibsrcdir = $(abs_top_builddir)/lib-src
56
57 ETAGS = $(top_builddir)/lib-src/etags
58 TAGS_DEPENDENCIES = $(ETAGS)
59
60 bin_PROGRAMS = sxemacs
61 noinst_DATA = sxemacs.dmp
62 archlib_DATA = config.values DOC
63
64 pdumplibs =
65 noinst_pdumplibs=
66 nodumplibs=
67 noinst_nodumplibs=
68 pdump_ldadd =
69
70 SUBDIRS=
71 sxe_subdirs=
72
73 pdumplibs        += libsxecore.a
74 noinst_pdumplibs += libsxecore.a
75 pdump_ldadd      += $(libsxecore_a_ldflags)
76
77 # Inverse order of dependency for order dependendant
78 # linkers...
79
80 if NEED_LIBSXEUIX11
81 pdumplibs += $(builddir)/ui/X11/libsxeuiX11.a
82 # sxe_subdirs += ui
83 endif
84
85 if NEED_LIBSXEUITTY
86 pdumplibs += $(builddir)/ui/TTY/libsxeuiTTY.a
87 # sxe_subdirs += ui
88 endif
89
90 pdumplibs += $(builddir)/ui/libsxeui.a
91 # pdump_ldadd +=
92 sxe_subdirs += ui
93
94 pdumplibs += $(builddir)/events/libsxeevents.a
95 # pdump_ldadd +=
96 sxe_subdirs += events
97
98 # @FIXME@ Should probably be conditional on whether we really have ent
99 # things or not :-)
100 pdumplibs += $(builddir)/ent/libent.a
101 pdump_ldadd += $(ENT_LIBS)
102 sxe_subdirs += ent
103
104 # @FIXME@ Should probably be conditional on whether we really have media
105 # things or not :-)
106 pdumplibs += $(builddir)/media/libmm.a
107 pdump_ldadd += $(MM_LIBS)
108 sxe_subdirs += media
109
110
111 pdumplibs   += $(builddir)/mem/libsxemem.a
112 sxe_subdirs += mem
113 pdump_ldadd += $(libsxemem_a_ldflags)
114
115 if NEED_LIBMULE
116 pdumplibs += $(builddir)/mule/libmule.a
117 # pdump_ldadd +=
118 sxe_subdirs += mule
119 endif
120
121 if NEED_LIBSXEDB
122 pdumplibs += $(builddir)/database/libsxedb.a
123 pdump_ldadd += $(DB_LDFLAGS) $(DB_LIBS)
124 sxe_subdirs += database
125 endif
126
127 nodumplibs += libcruft.a
128 noinst_nodumplibs += libcruft.a
129 if USE_MEMALLOC
130 nodumplibs  += $(builddir)/mem/libmemalloc.a
131 # No need to add
132 # sxe_subdirs += mem
133 # because libsxemem already is there
134 endif
135 if DESCEND_LWLIB
136 nodumplibs += $(builddir)/ui/X11/libsxeX.a
137 endif
138
139 SUBDIRS += $(sxe_subdirs)
140
141 noinst_LIBRARIES = $(noinst_pdumplibs) $(noinst_nodumplibs)
142
143
144 acgen_headers = config.h sxe-paths.h
145 header_HEADERS = $(acgen_headers)               \
146         $(libsxecore_a_headers)                 \
147         emodules-ng.h                           \
148         sxe-utils.h
149
150 sheader_HEADERS = $(srcdir)/s/*.h
151 mheader_HEADERS = $(srcdir)/m/*.h
152
153 BUILT_SOURCES = dump-id.c
154 EXTRA_DIST =
155 CLEANFILES = core* stage1 stage2 *.stamp $(BUILT_SOURCES) \
156         sxemacs.dmp DOC config.values
157
158 ## binaries
159 sxemacs_SOURCES = $(header_HEADERS)
160 ##$(LOCK_OBJ) $(RTC_patch_objs)
161 EXTRA_sxemacs_SOURCES = lastfile.c profile.c pre-crt0.c ecrt0.c
162 sxemacs_CPPFLAGS = $(AM_CPPFLAGS)
163 sxemacs_lddep = $(start_files) $(pdumplibs) $(nodumplibs)
164 if WITH_PDUMP
165 sxemacs_lddep += dump-id.o
166 endif
167 if HAVE_SETITIMER
168 sxemacs_lddep += profile.o
169 endif
170 sxemacs_lddep += $(statmod_archives)
171 sxemacs_lddep += lastfile.o
172 if DESCEND_LWLIB
173 sxemacs_lddep += $(bldlwlibdir)/libsxelw-Xt.la
174 endif
175 sxemacs_LDFLAGS = $(AM_LDFLAGS) $(start_flags)
176 ## hm, rpath is gross, says njsf
177 #sxemacs_LDFLAGS += -Wl,-rpath,$(abs_top_builddir)/lwlib/$(LT_OBJDIR)
178 sxemacs_LDADD = $(sxemacs_lddep) $(OPENSSL_LIBS)
179 sxemacs_LDADD += $(sxemacs_ldadd)               \
180                  $(ld_switch_all) $(ld_libs_all)\
181                  $(lib_gcc) $(FFI_LIBS)         \
182                  $(LIBLTDL)
183 if WITH_BDWGC
184 sxemacs_CPPFLAGS += $(BDWGC_CPPFLAGS)
185 sxemacs_LDFLAGS += $(BDWGC_LDFLAGS) $(BDWGC_LIBS)
186 endif
187 sxemacs_DEPENDENCIES = $(sxemacs_lddep)
188
189 all_sources =
190
191 ## library stuff
192 libsxecore_a_headers =                                                  \
193         backtrace.h bloom.h broken-sun.h buffer.h dllist.h              \
194         bufslots.h bytecode.h casetab.h category.h                      \
195         chartab.h lisp-disunion.h                                       \
196         lisp.h lrecord.h lstream.h commands.h dict.h dumper.h elhash.h  \
197         dynacat.h extents.h general-slots.h hash.h iso-wide.h           \
198         line-number.h macros.h map.h mem-limits.h ndir.h opaque.h       \
199         process.h                                                       \
200         procimpl.h rangetab.h regex.h semaphore.h seq.h skiplist.h      \
201         specifier.h symeval.h symsinit.h syntax.h syscommctrl.h         \
202         sysdep.h sysdir.h sysfile.h sysproc.h syspwd.h                  \
203         syssignal.h systime.h syswait.h \
204         sxemacs.h
205 libsxecore_a_sources =                                                  \
206         abbrev.c alloc.c bloom.c buffer.c bytecode.c                    \
207         callint.c callproc.c casefiddle.c casetab.c category.c          \
208         chartab.c                                                       \
209         cmdloop.c cmds.c data.c dict.c dired.c dllist.c doc.c doprnt.c  \
210         dynarr.c editfns.c elhash.c emacs.c eval.c dynacat.c            \
211         extents.c fileio.c filemode.c fns.c general.c hash.c indent.c   \
212         intl.c line-number.c lread.c lstream.c macros.c map.c marker.c  \
213         md5.c opaque.c print.c process.c process-unix.c rangetab.c      \
214         regex.c search.c semaphore.c seq.c signal.c skiplist.c          \
215         strftime.c symbols.c syntax.c sysdep.c undo.c
216 libsxecore_a_SOURCES = $(libsxecore_a_headers) $(libsxecore_a_sources)
217 EXTRA_libsxecore_a_SOURCES = dumper.c realpath.c
218 libsxecore_a_CPPFLAGS = $(AM_CPPFLAGS) $(X_CFLAGS)
219 libsxecore_a_LIBADD = $(libsxecore_objs)
220 libsxecore_a_DEPENDENCIES = $(libsxecore_a_LIBADD)
221 all_sources += $(libsxecore_a_sources) $(libsxecore_objs:.o=.c)
222
223 libcruft_a_headers = debug.h effi.h emodules-ng.h openssl.h
224 libcruft_a_sources =
225 libcruft_a_SOURCES = $(libcruft_a_headers) $(libcruft_a_sources)
226 EXTRA_libcruft_a_SOURCES =                                              \
227         alloca.c debug.c effi.c emodules-ng.c                           \
228         filelock.c getloadavg.c inline.c openssl.c strcat.c tests.c
229 libcruft_a_CPPFLAGS =                                                   \
230         $(AM_CPPFLAGS) $(DB_CPPFLAGS) $(FFI_CPPFLAGS) $(X_CFLAGS)
231 libcruft_a_LIBADD = $(libcruft_objs)
232 libcruft_a_DEPENDENCIES = $(libcruft_a_LIBADD)
233 all_sources += $(libcruft_a_sources) $(extra_objs:.o=.c)
234
235
236 ### custom rules
237 SXEMACS = $(bldsrcdir)/sxemacs
238 AALFILE = $(bldlispdir)/auto-autoloads.el
239 AALCFILE = $(bldlispdir)/auto-autoloads.elc
240 BITCH = $(SXEMACS) -batch
241 SXE_DYLD_PATH = $(bldsrcdir):$(bldsrcdir)/$(LT_OBJDIR):$(bldlwlibdir):$(bldlwlibdir)/$(LT_OBJDIR):$(DESTDIR)$(libdir)
242 BATCHENV = $(EXTRA_BATCHENV) \
243         DYLD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$DYLD_LIBRARY_PATH:$(DYLD_LIBRARY_PATH) \
244         LD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$LD_LIBRARY_PATH:$(LD_LIBRARY_PATH) \
245         SHLIB_PATH=$(SXE_DYLD_PATH):$$SHLIB_PATH:$(SHLIB_PATH)
246 BITCHENV = $(BATCHENV) \
247         EMACSDEBUGPATHS=1 EMACSPACKAGEPATH= \
248         SOURCE_TREE_ROOT=$(sxe_srcdir) \
249         BUILD_TREE_ROOT=$(sxe_blddir)
250 BATCH = $(BITCHENV) $(BITCH)
251 BATCHGDB = $(BITCHENV) gdb --args $(BITCH)
252 RM = rm -f
253 CROSSMAKE = (cd $$(dirname $@) && $(MAKE) $(AM_MAKEFLAGS) $$(basename $@))
254
255
256 dump-id.c: $(bldlibsrcdir)/make-dump-id
257         $(bldlibsrcdir)/make-dump-id
258
259 #$(bldlispdir)/auto-autoloads.el \
260 #$(bldlispdir)/auto-autoloads.elc \
261 #$(bldlispdir)/update-elc.FORCE.stamp \
262 #$(bldlispdir)/update-elc.stamp: $(SXEMACS)
263 #       echo $(CROSSMAKE)
264 #
265 #$(emodblddir)/auto-autoloads.el:
266 #       echo $(CROSSMAKE)
267
268 DOC: $(SXEMACS) $(bldlispdir)/auto.stamp
269         if test -e $(bldlispdir)/auto.stamp; then \
270                 $(BATCH) -nd  -l $(sxelispdir)/make-docfile.el -- \
271                         -o $(bldsrcdir)/DOC -d $(sxesrcdir) \
272                         -i $(sxe_srcdir)/site-packages \
273                         $(sxesrcdir)/*.c \
274                         $(sxesrcdir)/*/*.c \
275                         $(sxesrcdir)/*/*/*.c \
276                     &nb