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 = hello.c foo.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 main.c and libhello.la
48 hell_LDADD = libhello.la
50 # Create a statically linked version of hell.
51 hell_static_SOURCES = 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 = 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 # The following rules are only for the libtool demo and tests.
88 # Regenerate our acinclude.m4 only if it doesn't exist.
89 $(srcdir)/acinclude.m4:
90 rm -f $(srcdir)/acinclude.m4
91 cd $(srcdir) && $(LN_S) ../libtool.m4 acinclude.m4
94 # Test programs to see what gets hardcoded.
96 hardcode: $(hardcode_tests)
97 SET_HARDCODE_FLAGS = \
98 eval `$(LIBTOOL) --config | sed -n -e '/^hardcode_.*=/p; /^wl=/p'`
99 hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
101 @echo "You may ignore any linking errors from the following command:"
102 @shlib=./$(objdir)/libhello.a; \
103 eval "`grep '^library_names' libhello.la`"; \
104 for lib in $$library_names; do \
105 shlib="./$(objdir)/$$lib"; \
107 $(SET_HARDCODE_FLAGS); \
109 flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
110 echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
111 eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
113 hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
114 @$(SET_HARDCODE_FLAGS); \
115 libdir=`pwd`/$(objdir); \
116 flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
117 if test -z "$$flag"; then \
118 echo "echo unsupported > $@"; \
119 echo unsupported > $@ || status="$$?"; \
121 echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM)"; \
122 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM) || status="$$?"; \
126 hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
128 @echo "You may ignore any linking errors from the following command:"
129 @$(SET_HARDCODE_FLAGS); \
130 eval `$(LIBTOOL) --config | grep '^shlibpath_var='`; \
132 flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
133 echo "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
134 eval "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
136 hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
138 @$(SET_HARDCODE_FLAGS); \
140 flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
141 echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
142 eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
144 # This is one of the essential tests for deplibs_check_method=pass_all.
145 # If this one passes with pass_all, it is likely that pass_all works
146 EXTRA_LIBRARIES = libhell0.a
148 libhell0_a_LIBADD = hello.$(OBJEXT) foo.$(OBJEXT)
149 EXTRA_LTLIBRARIES = libhell1.la libhell2.la
150 libhell1_la_SOURCES = hell1.c
151 libhell1_la_LIBADD = -L. -lhell0
152 libhell1_la_LDFLAGS = -no-undefined -rpath $(libdir)
153 libhell1_la_DEPENDENCIES = libhell0.a
154 libhell2_la_SOURCES = hell2.c
155 libhell2_la_LIBADD = -L. -lhell0
156 libhell2_la_LDFLAGS = -no-undefined -rpath $(libdir)
157 libhell2_la_DEPENDENCIES = libhell0.a
158 EXTRA_PROGRAMS = hell0
159 hell0_SOURCES = main.c
160 hell0_LDADD = libhell1.la libhell2.la $(LIBM)
162 # 'hell0' in EXTRA_PROGRAMS gets translated to 'hell0.exe'; but we
163 # must explicitly list the wrapper script 'hell0'. (bin_PROGRAMS
164 # are handled seamlessly by automake rules; the extra step is only
165 # necessary for EXTRA_PROGRAMS)
166 CLEANFILES += $(EXTRA_LIBRARIES) $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) hell0
168 deplibs-check: hell0$(EXEEXT)
170 # Workaround a bug in Autoconf-2.61 and earlier that don't clean up
171 # file droppings left by many compilers:
173 ac_files="a.out.* a.exe.* a_out.exe.* b.out.* conftest.*"; \
174 for ac_file in $$ac_files; do \
176 *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) rm -rf $$ac_file ;; \