Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / tests / pdemo / Makefile.am
1 ## Makefile.am -- Process this file with automake to produce Makefile.in
2 ##
3 ##   Copyright (C) 2003, 2004, 2005, 2010 Free Software Foundation
4 ##   Written by Gary V. Vaughan, 2003
5 ##
6 ##   This file is part of GNU Libtool.
7 ##
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.
12 ##
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.
17 ##
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.
23 #####
24
25 AUTOMAKE_OPTIONS = no-dependencies foreign
26 ACLOCAL_AMFLAGS  = -I ../../libltdl/m4
27 AM_CPPFLAGS      = -I$(top_srcdir)/../..
28
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
35
36 include_HEADERS = foo.h
37
38 if BINARY_HELLDL
39 BUILD_helldl = helldl
40 else
41 BUILD_helldl =
42 endif
43
44 bin_PROGRAMS = hell hell_static $(BUILD_helldl)
45
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
49
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)
54
55 if BINARY_HELLDL
56
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
61
62 else
63
64 bin_SCRIPTS = helldl
65 # create a script that says that -dlopen is not supported
66 helldl helldl$(EXEEXT):
67         rm -f $@
68         echo '#! /bin/sh' > $@
69         echo '-dlopen is unsupported' >> $@
70         chmod +x $@
71 endif
72
73 libtool: $(LIBTOOL_DEPS)
74         $(SHELL) ./config.status --recheck
75
76 #----------------------------------------------------------------------
77 # The following declarations are only used in the testsuite:
78 #----------------------------------------------------------------------
79
80 hardcode_tests = hc-direct hc-libflag hc-libpath hc-minusL
81 CLEANFILES = $(hardcode_tests)
82
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'`
86
87 # Test programs to see what gets hardcoded.
88 .PHONY: hardcode
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
93         @rm -f hc-direct
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"; \
99           done; \
100           $(SET_HARDCODE_FLAGS); \
101           libdir=$(libdir); \
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 > $@"
105
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="$$?"; \
113           else \
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="$$?"; \
116           fi; \
117           exit $$status
118
119 hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
120         @rm -f hc-libpath
121         @echo "You may ignore any linking errors from the following command:"
122         @$(SET_HARDCODE_FLAGS); \
123           eval `$(LIBTOOL) --config | grep '^shlibpath_var='`; \
124           libdir=$(libdir); \
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 > $@"
128
129 hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
130         @rm -f hc-minusL
131         @$(SET_HARDCODE_FLAGS); \
132           libdir=$(libdir); \
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 > $@"
136
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
140 libhell0_a_SOURCES =
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)
154
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
160
161 deplibs-check: hell0
162
163 # Workaround a bug in Autoconf-2.61 and earlier that don't clean up
164 # file droppings left by many compilers:
165 distclean-local:
166         ac_files="a.out.* a.exe.* a_out.exe.* b.out.* conftest.*"; \
167         for ac_file in $$ac_files; do \
168           case $$ac_file in \
169             *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) rm -rf $$ac_file ;; \
170           esac; \
171         done