Fix error path so mutex is unlocked before returning
[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 if BUILD_DOCS
9 ## This hack is needed because it doesn't seem possible to make a
10 ## conditional info_TEXINFOS in Automake.  At least Automake 1.14
11 ## either gives errors -- if this attempted in the most
12 ## straightforward way -- or simply unconditionally tries to build the
13 ## info file.
14 SUBDIRS += doc
15 endif
16
17 EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj                      \
18         ChangeLog.libffi ChangeLog.libffi-3.1                           \
19         m4/libtool.m4 m4/lt~obsolete.m4                                 \
20          m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4                  \
21          m4/ltversion.m4 src/debug.c msvcc.sh                           \
22         generate-darwin-source-and-headers.py                           \
23         libffi.xcodeproj/project.pbxproj                                \
24         libtool-ldflags
25
26
27 ## ################################################################
28
29 ##
30 ## This section is for make and multilib madness.
31 ##
32
33 # Work around what appears to be a GNU make bug handling MAKEFLAGS
34 # values defined in terms of make variables, as is the case for CC and
35 # friends when we are called from the top level Makefile.
36 AM_MAKEFLAGS = \
37         'AR_FLAGS=$(AR_FLAGS)' \
38         'CC_FOR_BUILD=$(CC_FOR_BUILD)' \
39         'CFLAGS=$(CFLAGS)' \
40         'CXXFLAGS=$(CXXFLAGS)' \
41         'CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)' \
42         'CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)' \
43         'INSTALL=$(INSTALL)' \
44         'INSTALL_DATA=$(INSTALL_DATA)' \
45         'INSTALL_PROGRAM=$(INSTALL_PROGRAM)' \
46         'INSTALL_SCRIPT=$(INSTALL_SCRIPT)' \
47         'JC1FLAGS=$(JC1FLAGS)' \
48         'LDFLAGS=$(LDFLAGS)' \
49         'LIBCFLAGS=$(LIBCFLAGS)' \
50         'LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)' \
51         'MAKE=$(MAKE)' \
52         'MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)' \
53         'PICFLAG=$(PICFLAG)' \
54         'PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)' \
55         'RUNTESTFLAGS=$(RUNTESTFLAGS)' \
56         'SHELL=$(SHELL)' \
57         'exec_prefix=$(exec_prefix)' \
58         'infodir=$(infodir)' \
59         'libdir=$(libdir)' \
60         'mandir=$(mandir)' \
61         'prefix=$(prefix)' \
62         'AR=$(AR)' \
63         'AS=$(AS)' \
64         'CC=$(CC)' \
65         'CXX=$(CXX)' \
66         'LD=$(LD)' \
67         'NM=$(NM)' \
68         'RANLIB=$(RANLIB)' \
69         'DESTDIR=$(DESTDIR)'
70
71 # Subdir rules rely on $(FLAGS_TO_PASS)
72 FLAGS_TO_PASS = $(AM_MAKEFLAGS)
73
74 MAKEOVERRIDES=
75
76 pkgconfigdir = $(libdir)/pkgconfig
77 pkgconfig_DATA = libffi.pc
78
79 toolexeclib_LTLIBRARIES = libffi.la
80 noinst_LTLIBRARIES = libffi_convenience.la
81
82 libffi_la_SOURCES = src/prep_cif.c src/types.c \
83                 src/raw_api.c src/java_raw_api.c src/closures.c
84
85 if FFI_DEBUG
86 libffi_la_SOURCES += src/debug.c
87 endif
88
89 noinst_HEADERS = \
90         src/aarch64/ffitarget.h src/aarch64/internal.h                  \
91         src/alpha/ffitarget.h src/alpha/internal.h                      \
92         src/arc/ffitarget.h                                             \
93         src/arm/ffitarget.h src/arm/internal.h                          \
94         src/avr32/ffitarget.h                                           \
95         src/bfin/ffitarget.h                                            \
96         src/cris/ffitarget.h                                            \
97         src/frv/ffitarget.h                                             \
98         src/ia64/ffitarget.h src/ia64/ia64_flags.h                      \
99         src/m32r/ffitarget.h                                            \
100         src/m68k/ffitarget.h                                            \
101         src/m88k/ffitarget.h                                            \
102         src/metag/ffitarget.h                                           \
103         src/microblaze/ffitarget.h                                      \
104         src/mips/ffitarget.h                                            \
105         src/moxie/ffitarget.h                                           \
106         src/nios2/ffitarget.h                                           \
107         src/or1k/ffitarget.h                                            \
108         src/pa/ffitarget.h                                              \
109         src/powerpc/ffitarget.h src/powerpc/asm.h src/powerpc/ffi_powerpc.h \
110         src/s390/ffitarget.h                                            \
111         src/sh/ffitarget.h                                              \
112         src/sh64/ffitarget.h                                            \
113         src/sparc/ffitarget.h src/sparc/internal.h                      \
114         src/tile/ffitarget.h                                            \
115         src/vax/ffitarget.h                                             \
116         src/x86/ffitarget.h src/x86/internal.h src/x86/internal64.h     \
117         src/xtensa/ffitarget.h                                          \
118         src/dlmalloc.c
119
120 EXTRA_libffi_la_SOURCES = \
121         src/aarch64/ffi.c src/aarch64/sysv.S                            \
122         src/alpha/ffi.c src/alpha/osf.S                                 \
123         src/arc/ffi.c src/arc/arcompact.S                               \
124         src/arm/ffi.c src/arm/sysv.S                                    \
125         src/avr32/ffi.c src/avr32/sysv.S                                \
126         src/bfin/ffi.c src/bfin/sysv.S                                  \
127         src/cris/ffi.c src/cris/sysv.S                                  \
128         src/frv/ffi.c src/frv/eabi.S                                    \
129         src/ia64/ffi.c src/ia64/unix.S                                  \
130         src/m32r/ffi.c src/m32r/sysv.S                                  \
131         src/m68k/ffi.c src/m68k/sysv.S                                  \
132         src/m88k/ffi.c src/m88k/obsd.S                                  \
133         src/metag/ffi.c src/metag/sysv.S                                \
134         src/microblaze/ffi.c src/microblaze/sysv.S                      \
135         src/mips/ffi.c src/mips/o32.S src/mips/n32.S                    \
136         src/moxie/ffi.c src/moxie/eabi.S                                \
137         src/nios2/ffi.c src/nios2/sysv.S                                \
138         src/or1k/ffi.c src/or1k/sysv.S                                  \
139         src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S                     \
140         src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c \
141          src/powerpc/sysv.S src/powerpc/linux64.S                       \
142          src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S        \
143          src/powerpc/aix.S src/powerpc/darwin.S src/powerpc/aix_closure.S \
144          src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c          \
145         src/s390/ffi.c src/s390/sysv.S                                  \
146         src/sh/ffi.c src/sh/sysv.S                                      \
147         src/sh64/ffi.c src/sh64/sysv.S                                  \
148         src/sparc/ffi.c src/sparc/ffi64.c src/sparc/v8.S src/sparc/v9.S \
149         src/tile/ffi.c src/tile/tile.S                                  \
150         src/vax/ffi.c src/vax/elfbsd.S                                  \
151         src/x86/ffi.c src/x86/sysv.S                                    \
152          src/x86/ffiw64.c src/x86/win64.S                               \
153          src/x86/ffi64.c src/x86/unix64.S                               \
154         src/xtensa/ffi.c src/xtensa/sysv.S
155
156 TARGET_OBJ = @TARGET_OBJ@
157 libffi_la_LIBADD = $(TARGET_OBJ)
158
159 libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
160 EXTRA_libffi_convenience_la_SOURCES = $(EXTRA_libffi_la_SOURCES)
161 libffi_convenience_la_LIBADD = $(libffi_la_LIBADD)
162 libffi_convenience_la_DEPENDENCIES = $(libffi_la_DEPENDENCIES)
163 nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
164
165 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS))
166
167 AM_CFLAGS =
168 if FFI_DEBUG
169 # Build debug. Define FFI_DEBUG on the commandline so that, when building with
170 # MSVC, it can link against the debug CRT.
171 AM_CFLAGS += -DFFI_DEBUG
172 endif
173
174 if LIBFFI_BUILD_VERSIONED_SHLIB
175 if LIBFFI_BUILD_VERSIONED_SHLIB_GNU
176 libffi_version_script = -Wl,--version-script,libffi.map
177 libffi_version_dep = libffi.map
178 endif
179 if LIBFFI_BUILD_VERSIONED_SHLIB_SUN
180 libffi_version_script = -Wl,-M,libffi.map-sun
181 libffi_version_dep = libffi.map-sun
182 libffi.map-sun : libffi.map $(top_srcdir)/../contrib/make_sunver.pl \
183                  $(libffi_la_OBJECTS) $(libffi_la_LIBADD)
184         perl $(top_srcdir)/../contrib/make_sunver.pl libffi.map \
185          `echo $(libffi_la_OBJECTS) $(libffi_la_LIBADD) | \
186             sed 's,\([^/        ]*\)\.l\([ao]\),.libs/\1.\2,g'` \
187          > $@ || (rm -f $@ ; exit 1)
188 endif
189 else
190 libffi_version_script =
191 libffi_version_dep =
192 endif
193 libffi_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
194
195 libffi.map: $(top_srcdir)/libffi.map.in
196         $(COMPILE) -D$(TARGET) -E -x assembler-with-cpp -o $@ $<
197
198 libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
199 libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
200
201 AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
202 AM_CCASFLAGS = $(AM_CPPFLAGS)
203
204 dist-hook:
205         if [ -d $(top_srcdir)/.git ] ; then (cd $(top_srcdir); git log --no-decorate) ; else echo 'See git log for history.' ; fi > $(distdir)/ChangeLog