libtool/demo/Makefile.am

111 lines
3.5 KiB
Makefile
Raw Normal View History

1997-04-02 03:53:01 +08:00
# A brief demonstration of using Automake with Libtool. -*-Makefile-*-
1997-07-20 13:03:16 +08:00
#
AUTOMAKE_OPTIONS = no-dependencies foreign
1997-04-02 02:29:23 +08:00
1997-04-02 02:59:30 +08:00
EXTRA_DIST = $(TESTS) acinclude.m4
1997-04-02 02:29:23 +08:00
1997-10-15 02:33:24 +08:00
hardcode_tests = hc-direct hc-libflag hc-libpath hc-minusL
1997-04-02 03:04:40 +08:00
CLEANFILES = $(hardcode_tests)
1997-04-02 03:00:38 +08:00
# Build a libtool library, libhello.la for installation in libdir.
1997-04-02 03:21:43 +08:00
lib_LTLIBRARIES = libhello.la
1997-04-02 03:00:38 +08:00
libhello_la_SOURCES = hello.c foo.c
libhello_la_LDFLAGS = -version-info 3:12:1
1997-04-02 02:29:23 +08:00
include_HEADERS = foo.h
if BINARY_HELLDL
BUILD_helldl = helldl
else
BUILD_helldl =
endif
bin_PROGRAMS = hell hell.static $(BUILD_helldl)
1997-04-02 02:59:30 +08:00
1997-04-02 03:00:38 +08:00
# Build hell from main.c and libhello.la
1997-04-02 02:29:23 +08:00
hell_SOURCES = main.c
1997-04-02 03:00:38 +08:00
hell_LDADD = libhello.la
1997-04-02 02:29:23 +08:00
# Create a statically linked version of hell.
hell_static_SOURCES = main.c
hell_static_LDADD = libhello.la
hell_static_LDFLAGS = $(STATIC)
1997-04-02 02:59:30 +08:00
if BINARY_HELLDL
1997-07-22 01:31:05 +08:00
# Create a version of hell that does a preloaded dlopen.
1997-07-13 05:39:00 +08:00
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
helldl_DEPENDENCIES = libhello.la
else
bin_SCRIPTS = helldl
# create a script that says that -dlopen is not supported
helldl:
rm -f $@
echo '#! /bin/sh' > $@
echo '-dlopen is unsupported' >> $@
chmod +x $@
endif
1997-07-13 05:39:00 +08:00
1997-09-15 22:12:49 +08:00
# Unfortunately, in order to test libtool thoroughly, we need access
# to its private directory.
objdir = `sed -n -e 's/^objdir=\(.*\)$$/\1/p' ../libtool`
1997-09-15 22:12:49 +08:00
1997-04-02 02:57:49 +08:00
TESTS = run.test
1997-04-02 03:04:40 +08:00
# The following rules are only for the libtool demo and tests.
# Regenerate our acinclude.m4 only if it doesn't exist.
1997-04-02 02:59:30 +08:00
$(srcdir)/acinclude.m4:
rm -f $(srcdir)/acinclude.m4
1997-11-07 00:59:31 +08:00
cd $(srcdir) && $(LN_S) ../libtool.m4 acinclude.m4
1997-04-02 03:04:40 +08:00
1997-07-20 13:03:16 +08:00
1997-04-02 03:04:40 +08:00
# Test programs to see what gets hardcoded.
.PHONY: hardcode
hardcode: $(hardcode_tests)
hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES)
1997-07-20 13:03:16 +08:00
@rm -f hc-direct
1997-07-26 01:11:35 +08:00
@echo "You may ignore any linking errors from the following command:"
1997-09-15 22:12:49 +08:00
@shlib=./$(objdir)/libhello.a; \
1997-04-02 03:18:28 +08:00
eval "`egrep '^library_names' libhello.la`"; \
for lib in $$library_names; do \
1997-09-15 22:12:49 +08:00
shlib="./$(objdir)/$$lib"; \
1997-04-02 03:04:40 +08:00
done; \
1998-01-26 03:35:11 +08:00
echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib -lm || echo unsupported > $@"; \
eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib -lm || echo unsupported > $@"
1997-04-02 03:04:40 +08:00
1997-10-15 02:33:24 +08:00
# We need to create an alias for $(objdir) so that this test works regardless
# of $hardcode_minus_L
hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES)
rm -rf hc-libflag _hclibs
mkdir _hclibs
1997-10-20 02:53:23 +08:00
objdir=$(objdir); cd _hclibs && for lib in ../$$objdir/libhello*; do \
1997-10-15 02:33:24 +08:00
$(LN_S) $$lib `echo "$$lib" | sed 's%^.*/%%'` || exit 1; \
done
@eval `egrep -e '^(hardcode_.*|wl)=' ../libtool`; \
1997-10-15 02:33:24 +08:00
libdir=`pwd`/$(objdir); \
flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
if test -z "$$flag"; then \
echo "echo unsupported > $@"; \
echo unsupported > $@ || status="$$?"; \
else \
1998-01-26 03:35:11 +08:00
echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L./_hclibs -lhello -lm"; \
$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L./_hclibs -lhello -lm || status="$$?"; \
1997-10-15 02:33:24 +08:00
fi; \
echo "rm -rf _hclibs"; \
rm -rf _hclibs; \
exit $$status
1997-04-02 03:04:40 +08:00
hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES)
1997-07-20 13:03:16 +08:00
@rm -f hc-libpath
1997-04-02 03:19:30 +08:00
@echo "You may ignore any linking errors from the following command:"
@eval `egrep -e '^shlibpath_var=' ../libtool`; \
1998-01-26 03:35:11 +08:00
echo "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello -lm || echo unsupported > $@"; \
eval "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello -lm || echo unsupported > $@"
1997-10-15 02:33:24 +08:00
hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
@rm -f hc-minusL
1998-01-26 03:35:11 +08:00
$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello -lm