1 ## Makefile.am -- Process this file with automake to produce Makefile.in
3 ## Copyright (C) 2003, 2004, 2005, 2010 Free Software Foundation
4 ## Written by Gary V. Vaughan, 2003
6 ## This file is part of GNU Libtool.
8 ## GNU Libtool is free software; you can redistribute it and/or
9 ## modify it under the terms of the GNU General Public License as
10 ## published by the Free Software Foundation; either version 2 of
11 ## the License, or (at your option) any later version.
13 ## GNU Libtool is distributed in the hope that it will be useful,
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ## GNU General Public License for more details.
18 ## You should have received a copy of the GNU General Public License
19 ## along with GNU Libtool; see the file COPYING. If not, a copy
20 ## can be downloaded from http://www.gnu.org/licenses/gpl.html,
21 ## or obtained by writing to the Free Software Foundation, Inc.,
22 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 AUTOMAKE_OPTIONS = no-dependencies foreign
26 ACLOCAL_AMFLAGS = -I ../../libltdl/m4
27 AM_CPPFLAGS = -I$(top_srcdir)/../..
29 # Build a libtool library, libhello.la for installation in libdir.
30 lib_LTLIBRARIES = libhello.la
31 libhello_la_SOURCES = longer_file_name_hello.c longer_file_name_foo.c longer_file_name_foo2.c
32 libhello_la_LIBADD = $(LIBM)
33 libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
34 libhello_la_AM_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO
36 include_HEADERS = foo.h
44 bin_PROGRAMS = hell hell_static $(BUILD_helldl)
46 # Build hell from longer_file_name_main.c and libhello.la
47 hell_SOURCES = longer_file_name_main.c
48 hell_LDADD = libhello.la
50 # Create a statically linked version of hell.
51 hell_static_SOURCES = longer_file_name_main.c
52 hell_static_LDADD = libhello.la
53 hell_static_LDFLAGS = $(STATIC)
57 # Create a version of hell that does a preloaded dlopen.
58 helldl_SOURCES = longer_file_name_dlmain.c
59 helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
60 helldl_DEPENDENCIES = libhello.la
65 # create a script that says that -dlopen is not supported
66 helldl helldl$(EXEEXT):
68 echo '#! /bin/sh' > $@
69 echo '-dlopen is unsupported' >> $@
73 libtool: $(LIBTOOL_DEPS)
74 $(SHELL) ./config.status --recheck
76 #----------------------------------------------------------------------
77 # The following declarations are only used in the testsuite:
78 #----------------------------------------------------------------------
80 hardcode_tests = hc-direct hc-libflag hc-libpath hc-minusL
81 CLEANFILES = $(hardcode_tests)
83 # Unfortunately, in order to test libtool thoroughly, we need access
84 # to its private directory.
85 objdir = `$(LIBTOOL) --config | sed -n -e 's/^objdir=\(.*\)$$/\1/p'`
87 # Test programs to see what gets hardcoded.
89 hardcode: $(hardcode_tests)
90 SET_HARDCODE_FLAGS = \
91 eval `$(LIBTOOL) --config | sed -n -e '/^hardcode_.*=/p; /^wl=/p'`
92 hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
94 @echo "You may ignore any linking errors from the following command:"
95 @shlib=./$(objdir)/libhello.a; \
96 eval "`grep '^library_names' libhello.la`"; \
97 for lib in $$library_names; do \
98 shlib="./$(objdir)/$$lib"; \
100 $(SET_HARDCODE_FLAGS); \
102 flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
103 echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
104 eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
106 hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
107 @$(SET_HARDCODE_FLAGS); \
108 libdir=`pwd`/$(objdir); \
109 flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
110 if test -z "$$flag"; then \
111 echo "echo unsupported > $@"; \
112 echo unsupported > $@ || status="$$?"; \
114 echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM)"; \
115 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM) || status="$$?"; \
119 hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
121 @echo "You may ignore any linking errors from the following command:"
122 @$(SET_HARDCODE_FLAGS); \
123 eval `$(LIBTOOL) --config | grep '^shlibpath_var='`; \
125 flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
126 echo "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
127 eval "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
129 hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
131 @$(SET_HARDCODE_FLAGS); \
133 flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
134 echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
135 eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
137 # This is one of the essential tests for deplibs_check_method=pass_all.
138 # If this one passes with pass_all, it is likely that pass_all works
139 EXTRA_LIBRARIES = libhell0.a
141 libhell0_a_LIBADD = longer_file_name_hello.$(OBJEXT) longer_file_name_foo.$(OBJEXT)
142 EXTRA_LTLIBRARIES = libhell1.la libhell2.la
143 libhell1_la_SOURCES = longer_file_name_hell1.c
144 libhell1_la_LIBADD = -L. -lhell0
145 libhell1_la_LDFLAGS = -no-undefined -rpath $(libdir)
146 libhell1_la_DEPENDENCIES = libhell0.a
147 libhell2_la_SOURCES = longer_file_name_hell2.c
148 libhell2_la_LIBADD = -L. -lhell0
149 libhell2_la_LDFLAGS = -no-undefined -rpath $(libdir)
150 libhell2_la_DEPENDENCIES = libhell0.a
151 EXTRA_PROGRAMS = hell0
152 hell0_SOURCES = longer_file_name_main.c
153 hell0_LDADD = libhell1.la libhell2.la $(LIBM)
155 # 'hell0' in EXTRA_PROGRAMS gets translated to 'hell0.exe'; but we
156 # must explicitly list the wrapper script 'hell0'. (bin_PROGRAMS
157 # are handled seamlessly by automake rules; the extra step is only
158 # necessary for EXTRA_PROGRAMS)
159 CLEANFILES += $(EXTRA_LIBRARIES) $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) hell0
163 # Workaround a bug in Autoconf-2.61 and earlier that don't clean up
164 # file droppings left by many compilers:
166 ac_files="a.out.* a.exe.* a_out.exe.* b.out.* conftest.*"; \
167 for ac_file in $$ac_files; do \
169 *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) rm -rf $$ac_file ;; \