Enable disabling of libtool on platforms where it does not work (e.g. LLVM).
[libffi.git] / Makefile.am
1 ## Process this with automake to create Makefile.in
2
3 AUTOMAKE_OPTIONS = foreign subdir-objects
4
5 ACLOCAL_AMFLAGS = -I m4
6
7 SUBDIRS = include testsuite man
8
9 EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host       \
10          src/aarch64/ffi.c src/aarch64/ffitarget.h src/aarch64/sysv.S   \
11          build-ios.sh src/alpha/ffi.c src/alpha/osf.S                   \
12          src/alpha/ffitarget.h src/arm/ffi.c src/arm/sysv.S             \
13          src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S           \
14          src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S           \
15          src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h       \
16          src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c           \
17          src/mips/n32.S src/mips/o32.S src/metag/ffi.c                  \
18          src/metag/ffitarget.h src/metag/sysv.S src/moxie/ffi.c         \
19          src/moxie/ffitarget.h src/moxie/eabi.S src/mips/ffitarget.h    \
20          src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h            \
21          src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h            \
22          src/microblaze/ffi.c src/microblaze/sysv.S                     \
23          src/microblaze/ffitarget.h src/powerpc/ffi.c                   \
24          src/powerpc/sysv.S src/powerpc/linux64.S                       \
25          src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S        \
26          src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S       \
27          src/powerpc/aix_closure.S src/powerpc/darwin_closure.S         \
28          src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h               \
29          src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h            \
30          src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c   \
31          src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S            \
32          src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c           \
33          src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S                \
34          src/x86/win32.S src/x86/darwin.S src/x86/win64.S               \
35          src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S             \
36          src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c            \
37          src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c    \
38          src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S            \
39          src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c              \
40          src/tile/ffitarget.h src/tile/tile.S libtool-version           \
41          src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S      \
42          ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4               \
43          m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4                  \
44          m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh       \
45          generate-ios-source-and-headers.py                             \
46          generate-osx-source-and-headers.py                             \
47          libffi.xcodeproj/project.pbxproj src/arm/trampoline.S          \
48          libtool-ldflags
49
50 info_TEXINFOS = doc/libffi.texi
51
52 ## ################################################################
53
54 ##
55 ## This section is for make and multilib madness.
56 ##
57
58 # Work around what appears to be a GNU make bug handling MAKEFLAGS
59 # values defined in terms of make variables, as is the case for CC and
60 # friends when we are called from the top level Makefile.
61 AM_MAKEFLAGS = \
62         "AR_FLAGS=$(AR_FLAGS)" \
63         "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
64         "CFLAGS=$(CFLAGS)" \
65         "CXXFLAGS=$(CXXFLAGS)" \
66         "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
67         "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
68         "INSTALL=$(INSTALL)" \
69         "INSTALL_DATA=$(INSTALL_DATA)" \
70         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
71         "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
72         "JC1FLAGS=$(JC1FLAGS)" \
73         "LDFLAGS=$(LDFLAGS)" \
74         "LIBCFLAGS=$(LIBCFLAGS)" \
75         "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
76         "MAKE=$(MAKE)" \
77         "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
78         "PICFLAG=$(PICFLAG)" \
79         "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
80         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
81         "SHELL=$(SHELL)" \
82         "exec_prefix=$(exec_prefix)" \
83         "infodir=$(infodir)" \
84         "libdir=$(libdir)" \
85         "mandir=$(mandir)" \
86         "prefix=$(prefix)" \
87         "AR=$(AR)" \
88         "AS=$(AS)" \
89         "CC=$(CC)" \
90         "CXX=$(CXX)" \
91         "LD=$(LD)" \
92         "NM=$(NM)" \
93         "RANLIB=$(RANLIB)" \
94         "DESTDIR=$(DESTDIR)"
95
96 # Subdir rules rely on $(FLAGS_TO_PASS)
97 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
98
99 MAKEOVERRIDES=
100
101 librarySOURCES = src/prep_cif.c src/types.c \
102                 src/raw_api.c src/java_raw_api.c src/closures.c
103
104 if USE_LIBTOOL
105 toolexeclib_LTLIBRARIES = libffi.la
106 noinst_LTLIBRARIES = libffi_convenience.la
107 libffi_la_SOURCES = librarySOURCES
108 else
109 lib_LIBRARIES = libffi.a
110 noinst_LIBRARIES = libffi_convenience.a
111 libffi_a_SOURCES = librarySOURCES
112 endif
113
114 pkgconfigdir = $(libdir)/pkgconfig
115 pkgconfig_DATA = libffi.pc
116
117 additionalSOURCES =
118
119 if FFI_DEBUG
120 additionalSOURCES += src/debug.c
121 endif
122
123 if MIPS
124 additionalSOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S
125 endif
126 if BFIN
127 additionalSOURCES += src/bfin/ffi.c src/bfin/sysv.S
128 endif
129 if X86
130 additionalSOURCES += src/x86/ffi.c src/x86/sysv.S
131 endif
132 if X86_FREEBSD
133 additionalSOURCES += src/x86/ffi.c src/x86/freebsd.S
134 endif
135 if X86_WIN32
136 additionalSOURCES += src/x86/ffi.c src/x86/win32.S
137 endif
138 if X86_WIN64
139 additionalSOURCES += src/x86/ffi.c src/x86/win64.S
140 endif
141 if X86_DARWIN
142 additionalSOURCES += src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
143 endif
144 if SPARC
145 additionalSOURCES += src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
146 endif
147 if ALPHA
148 additionalSOURCES += src/alpha/ffi.c src/alpha/osf.S
149 endif
150 if IA64
151 additionalSOURCES += src/ia64/ffi.c src/ia64/unix.S
152 endif
153 if M32R
154 additionalSOURCES += src/m32r/sysv.S src/m32r/ffi.c
155 endif
156 if M68K
157 additionalSOURCES += src/m68k/ffi.c src/m68k/sysv.S
158 endif
159 if MOXIE
160 additionalSOURCES += src/moxie/ffi.c src/moxie/eabi.S
161 endif
162 if MICROBLAZE
163 additionalSOURCES += src/microblaze/ffi.c src/microblaze/sysv.S
164 endif
165 if POWERPC
166 additionalSOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
167 endif
168 if POWERPC_AIX
169 additionalSOURCES += src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
170 endif
171 if POWERPC_DARWIN
172 additionalSOURCES += src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
173 endif
174 if POWERPC_FREEBSD
175 additionalSOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
176 endif
177 if AARCH64
178 additionalSOURCES += src/aarch64/sysv.S src/aarch64/ffi.c
179 endif
180 if ARM
181 additionalSOURCES += src/arm/sysv.S src/arm/ffi.c
182 if FFI_EXEC_TRAMPOLINE_TABLE
183 additionalSOURCES += src/arm/trampoline.S
184 endif
185 endif
186 if AVR32
187 additionalSOURCES += src/avr32/sysv.S src/avr32/ffi.c
188 endif
189 if LIBFFI_CRIS
190 additionalSOURCES += src/cris/sysv.S src/cris/ffi.c
191 endif
192 if FRV
193 additionalSOURCES += src/frv/eabi.S src/frv/ffi.c
194 endif
195 if S390
196 additionalSOURCES += src/s390/sysv.S src/s390/ffi.c
197 endif
198 if X86_64
199 additionalSOURCES += src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
200 endif
201 if SH
202 additionalSOURCES += src/sh/sysv.S src/sh/ffi.c
203 endif
204 if SH64
205 additionalSOURCES += src/sh64/sysv.S src/sh64/ffi.c
206 endif
207 if PA_LINUX
208 additionalSOURCES += src/pa/linux.S src/pa/ffi.c
209 endif
210 if PA_HPUX
211 additionalSOURCES += src/pa/hpux32.S src/pa/ffi.c
212 endif
213 if TILE
214 additionalSOURCES += src/tile/tile.S src/tile/ffi.c
215 endif
216 if XTENSA
217 additionalSOURCES += src/xtensa/sysv.S src/xtensa/ffi.c
218 endif
219 if METAG
220 additionalSOURCES += src/metag/sysv.S src/metag/ffi.c
221 endif
222
223 if USE_LIBTOOL
224 nodist_libffi_la_SOURCES = additionalSOURCES
225 libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
226 nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
227
228 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS))
229
230 libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS)
231 else
232 nodist_libffi_a_SOURCES = additionalSOURCES
233 libffi_convenience_a_SOURCES = $(libffi_a_SOURCES)
234 nodist_libffi_convenience_a_SOURCES = $(nodist_libffi_a_SOURCES)
235 endif
236
237 AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
238 AM_CCASFLAGS = $(AM_CPPFLAGS)
239