Merge pull request #3591 from directhex/mono_libdir_fallback
[mono.git] / mono / metadata / Makefile.am
1 if HOST_WIN32
2 win32_sources = \
3         console-win32.c \
4         console-win32-internals.h \
5         file-io-windows.c \
6         file-io-windows-internals.h \
7         icall-windows.c \
8         icall-windows-internals.h \
9         marshal-windows.c \
10         marshal-windows-internals.h \
11         mono-security-windows.c \
12         mono-security-windows-internals.h \
13         process-windows.c \
14         process-windows-internals.h \
15         w32mutex-win32.c \
16         w32semaphore-win32.c \
17         w32event-win32.c \
18         socket-io-windows.c
19
20 platform_sources = $(win32_sources)
21
22 # Use -m here. This will use / as directory separator (C:/WINNT).
23 # The files that use MONO_ASSEMBLIES and/or MONO_CFG_DIR replace the
24 # / by \ if running under WIN32.
25 if CROSS_COMPILING
26 assembliesdir = ${libdir}
27 confdir = ${sysconfdir}
28 else
29 assembliesdir = `cygpath -m "${libdir}"`
30 confdir = `cygpath -m "${sysconfdir}"`
31 endif
32 export HOST_CC
33 # The mingw math.h has "extern inline" functions that dont appear in libs, so
34 # optimisation is required to actually inline them
35 AM_CFLAGS = -O
36 else
37
38 assembliesdir = $(exec_prefix)/lib
39 confdir = $(sysconfdir)
40 unix_sources = \
41         console-unix.c \
42         w32mutex-unix.c \
43         w32semaphore-unix.c \
44         w32event-unix.c
45
46 platform_sources = $(unix_sources)
47 endif
48
49 if PLATFORM_ANDROID
50 platform_sources += ../../support/libm/complex.c
51 endif
52
53 if BTLS
54 btls_file_list := $(shell cat ../btls/build-shared/mono-btls-shared-lo.txt)
55 btls_static_file_list := $(shell cat ../btls/build-static/mono-btls-static-lo.txt)
56 btls_libs = $(btls_file_list)
57 btls_static_libs = $(btls_static_file_list)
58 btls_cflags = -I$(top_srcdir)/external/boringssl/include -I$(top_srcdir)/mono/btls
59 endif
60
61 #
62 # libtool is not capable of creating static/shared versions of the same
63 # convenience lib, so we have to do it ourselves
64 #
65 if SUPPORT_SGEN
66 if DISABLE_EXECUTABLES
67 shared_sgen_libraries = libmonoruntimesgen.la 
68 else
69 if SHARED_MONO
70 shared_sgen_libraries = libmonoruntimesgen.la 
71 endif
72 endif
73 sgen_libraries = $(shared_sgen_libraries) libmonoruntimesgen-static.la 
74 endif
75
76 if SUPPORT_BOEHM
77 if DISABLE_EXECUTABLES
78 shared_boehm_libraries = libmonoruntime.la
79 else
80 if SHARED_MONO
81 shared_boehm_libraries = libmonoruntime.la
82 endif
83 endif
84 boehm_libraries = $(shared_boehm_libraries) libmonoruntime-static.la
85 endif
86
87 if DISABLE_EXECUTABLES
88 noinst_LTLIBRARIES = libmonoruntime-config.la $(shared_sgen_libraries) $(shared_boehm_libraries)
89 else
90 noinst_LTLIBRARIES = libmonoruntime-config.la $(boehm_libraries) $(sgen_libraries)
91 endif
92
93 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) $(SHARED_CFLAGS) $(btls_cflags)
94
95 #
96 # Make sure any prefix changes are updated in the binaries too.
97 #
98 # This won't result in many more false positives than AC_DEFINEing them
99 # in configure.ac.
100 #
101 mono-config-dirs.lo: Makefile
102
103 #
104 # This library is used to localize the usage of MONO_BINDIR etc. to just one source file, thus enabling
105 # ccache to work even if the value of these defines change. We need to use a convenience library since automake
106 # doesn't support per file cflags.
107 #
108 libmonoruntime_config_la_SOURCES = \
109         mono-config-dirs.h              \
110         mono-config-dirs.c
111 libmonoruntime_config_la_CPPFLAGS = $(AM_CPPFLAGS) -DMONO_BINDIR=\"$(bindir)/\" -DMONO_ASSEMBLIES=\"$(assembliesdir)\" -DMONO_CFG_DIR=\"$(confdir)\" -DMONO_RELOC_LIBDIR=\"../$(reloc_libdir)\"
112
113 CLEANFILES = mono-bundle.stamp
114
115 null_sources = \
116         console-null.c
117
118 null_gc_sources = \
119         null-gc.c
120
121 common_sources = \
122         $(platform_sources)     \
123         assembly.c              \
124         assembly-internals.h    \
125         attach.h                \
126         attach.c                \
127         cil-coff.h              \
128         class.c                 \
129         class-internals.h       \
130         cominterop.c            \
131         cominterop.h            \
132         console-io.h            \
133         coree.c                 \
134         coree.h                 \
135         coree-internals.h \
136         culture-info.h          \
137         culture-info-tables.h   \
138         debug-helpers.c         \
139         debug-mono-symfile.h    \
140         debug-mono-symfile.c    \
141         debug-mono-ppdb.h       \
142         debug-mono-ppdb.c       \
143         decimal-ms.c            \
144         decimal-ms.h            \
145         domain-internals.h      \
146         environment.c           \
147         environment.h           \
148         exception.c             \
149         exception.h             \
150         exception-internals.h   \
151         file-io.c               \
152         file-io.h               \
153         file-io-internals.h \
154         filewatcher.c           \
155         filewatcher.h           \
156         gc-internals.h          \
157         icall.c                 \
158         icall-internals.h \
159         icall-def.h             \
160         image.c                 \
161         image-internals.h       \
162         jit-info.c              \
163         loader.c                \
164         locales.c               \
165         locales.h               \
166         lock-tracer.c           \
167         lock-tracer.h           \
168         marshal.c               \
169         marshal.h               \
170         marshal-internals.h \
171         mempool.c               \
172         mempool.h               \
173         mempool-internals.h     \
174         metadata.c              \
175         metadata-verify.c       \
176         metadata-internals.h    \
177         method-builder.h        \
178         method-builder.c        \
179         mono-basic-block.c      \
180         mono-basic-block.h      \
181         mono-config.c           \
182         mono-debug.h            \
183         mono-debug.c            \
184         mono-debug-debugger.h   \
185         mono-endian.c           \
186         mono-endian.h           \
187         mono-hash.h             \
188         mono-mlist.c            \
189         mono-mlist.h            \
190         mono-perfcounters.c     \
191         mono-perfcounters.h     \
192         mono-perfcounters-def.h \
193         mono-ptr-array.h        \
194         mono-route.c            \
195         mono-route.h            \
196         monitor.h               \
197         nacl-stub.c             \
198         normalization-tables.h  \
199         number-formatter.h      \
200         number-ms.c             \
201         number-ms.h             \
202         object-internals.h      \
203         opcodes.c               \
204         socket-io.c             \
205         socket-io.h             \
206         process.c               \
207         process.h               \
208         process-internals.h \
209         profiler.c              \
210         profiler-private.h      \
211         rand.h                  \
212         rand.c                  \
213         remoting.h              \
214         remoting.c              \
215         runtime.c               \
216         mono-security.c         \
217         security.h              \
218         security-core-clr.c     \
219         security-core-clr.h     \
220         security-manager.c      \
221         security-manager.h      \
222         string-icalls.c         \
223         string-icalls.h         \
224         sysmath.h               \
225         sysmath.c               \
226         tabledefs.h             \
227         threads.c               \
228         threads-types.h         \
229         threadpool-ms.c \
230         threadpool-ms.h \
231         threadpool-ms-io.c      \
232         threadpool-ms-io.h      \
233         verify.c                \
234         verify-internals.h      \
235         wrapper-types.h \
236         dynamic-image-internals.h       \
237         dynamic-stream.c        \
238         dynamic-stream-internals.h      \
239         reflection-cache.h      \
240         custom-attrs-internals.h        \
241         sre-internals.h \
242         reflection-internals.h  \
243         file-mmap-posix.c       \
244         file-mmap-windows.c     \
245         file-mmap.h     \
246         object-offsets.h        \
247         abi-details.h   \
248         metadata-cross-helpers.c        \
249         seq-points-data.h       \
250         seq-points-data.c       \
251         handle.c        \
252         handle.h        \
253         w32mutex.h      \
254         w32semaphore.h  \
255         w32event.h      \
256         w32handle-namespace.h   \
257         w32handle-namespace.c
258
259 # These source files have compile time dependencies on GC code
260 gc_dependent_sources = \
261         appdomain.c     \
262         domain.c        \
263         gc-stats.c      \
264         gc.c            \
265         monitor.c       \
266         mono-hash.c     \
267         object.c        \
268         dynamic-image.c \
269         sre.c   \
270         sre-encode.c    \
271         sre-save.c      \
272         custom-attrs.c  \
273         reflection.c
274
275
276 boehm_sources = \
277         boehm-gc.c
278
279 sgen_sources = \
280         sgen-os-posix.c         \
281         sgen-os-mach.c          \
282         sgen-os-win32.c         \
283         sgen-os-coop.c          \
284         sgen-bridge.c           \
285         sgen-bridge.h           \
286         sgen-bridge-internals.h \
287         sgen-old-bridge.c               \
288         sgen-new-bridge.c               \
289         sgen-tarjan-bridge.c            \
290         sgen-toggleref.c                \
291         sgen-toggleref.h                \
292         sgen-stw.c                              \
293         sgen-mono.c             \
294         sgen-client-mono.h
295
296 libmonoruntime_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(null_gc_sources) $(boehm_sources)
297 libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES)
298 libmonoruntime_la_LIBADD = libmonoruntime-config.la $(btls_libs)
299
300 libmonoruntimesgen_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(sgen_sources)
301 libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES)
302 libmonoruntimesgen_la_LIBADD = libmonoruntime-config.la $(btls_libs)
303
304 libmonoruntime_static_la_SOURCES = $(libmonoruntime_la_SOURCES)
305 libmonoruntime_static_la_LDFLAGS = -static
306 libmonoruntime_static_la_CFLAGS = $(BOEHM_DEFINES)
307 libmonoruntime_static_la_LIBADD = $(bundle_obj) libmonoruntime-config.la $(btls_static_libs)
308
309 libmonoruntimesgen_static_la_SOURCES = $(libmonoruntimesgen_la_SOURCES)
310 libmonoruntimesgen_static_la_LDFLAGS = -static
311 libmonoruntimesgen_static_la_CFLAGS = $(SGEN_DEFINES)
312 libmonoruntimesgen_static_la_LIBADD = libmonoruntime-config.la $(btls_static_libs)
313
314 libmonoruntimeincludedir = $(includedir)/mono-$(API_VER)/mono/metadata
315
316 libmonoruntimeinclude_HEADERS = \
317         assembly.h              \
318         attrdefs.h              \
319         appdomain.h             \
320         blob.h                  \
321         class.h                 \
322         debug-helpers.h         \
323         debug-mono-symfile.h    \
324         threads.h               \
325         environment.h           \
326         exception.h             \
327         image.h                 \
328         loader.h                \
329         metadata.h              \
330         mono-config.h           \
331         mono-debug.h            \
332         mono-gc.h               \
333         sgen-bridge.h           \
334         object.h                \
335         opcodes.h               \
336         profiler.h              \
337         reflection.h            \
338         row-indexes.h           \
339         tokentype.h             \
340         verify.h                
341
342 EXTRA_DIST = $(win32_sources) $(unix_sources) $(null_sources) runtime.h \
343                 threadpool-ms-io-poll.c threadpool-ms-io-epoll.c threadpool-ms-io-kqueue.c sgen-dynarray.h