1## Process this file with automake to produce Makefile.in
2
3AUTOMAKE_OPTIONS = no-dependencies foreign
4
5EXTRA_DIST = acinclude.m4
6
7# Build a libtool library, libhello.la for installation in libdir.
8lib_LTLIBRARIES = libhello.la
9libhello_la_SOURCES = longer_file_name_hello.c longer_file_name_foo.c longer_file_name_foo2.c
10libhello_la_CFLAGS = $(AM_CFLAGS)
11libhello_la_LIBADD = $(LIBM)
12libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
13
14include_HEADERS = foo.h
15
16if BINARY_HELLDL
17BUILD_helldl = helldl
18else
19BUILD_helldl =
20endif
21
22bin_PROGRAMS = hell hell_static $(BUILD_helldl)
23
24# Build hell from longer_file_name_main.c and libhello.la
25hell_SOURCES = longer_file_name_main.c
26hell_LDADD = libhello.la
27
28# Create a statically linked version of hell.
29hell_static_SOURCES = longer_file_name_main.c
30hell_static_LDADD = libhello.la
31hell_static_LDFLAGS = $(STATIC)
32
33if BINARY_HELLDL
34
35# Create a version of hell that does a preloaded dlopen.
36helldl_SOURCES = longer_file_name_dlmain.c
37helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
38helldl_DEPENDENCIES = libhello.la
39
40else
41
42bin_SCRIPTS = helldl
43# create a script that says that -dlopen is not supported
44helldl helldl$(EXEEXT):
45	rm -f $@
46	echo '#! /bin/sh' > $@
47	echo '-dlopen is unsupported' >> $@
48	chmod +x $@
49endif
50
51$(OBJECTS): libtool
52libtool: $(LIBTOOL_DEPS)
53	$(SHELL) ./config.status --recheck
54
55#----------------------------------------------------------------------
56# The following declarations are only used in the testsuite:
57#----------------------------------------------------------------------
58
59hardcode_tests = hc-direct hc-libflag hc-libpath hc-minusL
60CLEANFILES = $(hardcode_tests)
61
62# Unfortunately, in order to test libtool thoroughly, we need access
63# to its private directory.
64objdir = `$(LIBTOOL) --config | sed -n -e 's/^objdir=\(.*\)$$/\1/p'`
65
66# The following rules are only for the libtool demo and tests.
67# Regenerate our acinclude.m4 only if it doesn't exist.
68$(srcdir)/acinclude.m4:
69	rm -f $(srcdir)/acinclude.m4
70	cd $(srcdir) && $(LN_S) ../libtool.m4 acinclude.m4
71
72
73# Test programs to see what gets hardcoded.
74.PHONY: hardcode
75hardcode: $(hardcode_tests)
76SET_HARDCODE_FLAGS = \
77  eval `$(LIBTOOL) --config | sed -n -e '/^hardcode_.*=/p; /^wl=/p'`
78hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
79	@rm -f hc-direct
80	@echo "You may ignore any linking errors from the following command:"
81	@shlib=./$(objdir)/libhello.a; \
82	  eval "`grep '^library_names' libhello.la`"; \
83	  for lib in $$library_names; do \
84	    shlib="./$(objdir)/$$lib"; \
85	  done; \
86	  $(SET_HARDCODE_FLAGS); \
87	  libdir=$(libdir); \
88	  flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
89	  echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
90	  eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
91
92hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
93	@$(SET_HARDCODE_FLAGS); \
94	  libdir=`pwd`/$(objdir); \
95	  flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
96	  if test -z "$$flag"; then \
97	    echo "echo unsupported > $@"; \
98	    echo unsupported > $@ || status="$$?"; \
99	  else \
100	    echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM)"; \
101	    $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM) || status="$$?"; \
102	  fi; \
103	  exit $$status
104
105hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
106	@rm -f hc-libpath
107	@echo "You may ignore any linking errors from the following command:"
108	@$(SET_HARDCODE_FLAGS); \
109	  eval `$(LIBTOOL) --config | grep '^shlibpath_var='`; \
110	  libdir=$(libdir); \
111	  flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
112	  echo "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
113	  eval "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
114
115hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
116	@rm -f hc-minusL
117	@$(SET_HARDCODE_FLAGS); \
118	  libdir=$(libdir); \
119	  flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
120	  echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
121	  eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
122
123# This is one of the essential tests for deplibs_check_method=pass_all.
124# If this one passes with pass_all, it is likely that pass_all works
125EXTRA_LIBRARIES = libhell0.a
126libhell0_a_SOURCES = longer_file_name_hello.c longer_file_name_foo.c
127EXTRA_LTLIBRARIES = libhell1.la libhell2.la
128libhell1_la_SOURCES = longer_file_name_hell1.c
129libhell1_la_LIBADD = -L. -lhell0
130libhell1_la_LDFLAGS = -no-undefined -rpath $(libdir)
131libhell1_la_DEPENDENCIES = libhell0.a
132libhell2_la_SOURCES = longer_file_name_hell2.c
133libhell2_la_LIBADD = -L. -lhell0
134libhell2_la_LDFLAGS = -no-undefined -rpath $(libdir)
135libhell2_la_DEPENDENCIES = libhell0.a
136EXTRA_PROGRAMS = hell0
137hell0_SOURCES = longer_file_name_main.c
138hell0_LDADD = libhell1.la libhell2.la $(LIBM)
139
140# 'hell0' in EXTRA_PROGRAMS gets translated to 'hell0.exe'; but we
141# must explicitly list the wrapper script 'hell0'.  (bin_PROGRAMS
142# are handled seamlessly by automake rules; the extra step is only
143# necessary for EXTRA_PROGRAMS)
144CLEANFILES += $(EXTRA_LIBRARIES) $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) hell0
145
146deplibs-check: hell0
147