File: Makefile.am

package info (click to toggle)
libtool 1.0h-5
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 1,156 kB
  • ctags: 41
  • sloc: sh: 3,619; makefile: 238; ansic: 114
file content (107 lines) | stat: -rw-r--r-- 3,959 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# A brief demonstration of using Automake with Libtool. -*-Makefile-*-
#
# NOTE: Don't forget that in the libtool distribution, files in this
# directory are distributed by the demo_distfiles variable in the top
# level Makefile.
AUTOMAKE_OPTIONS = foreign

EXTRA_DIST = $(TESTS) acinclude.m4

hardcode_tests = hc-direct hc-libflag hc-libpath hc-minusL
CLEANFILES = $(hardcode_tests)

# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
libhello_la_SOURCES = hello.c foo.c
libhello_la_LDFLAGS = -version-info 3:12:1

include_HEADERS = foo.h

bin_PROGRAMS = hell hell.debug helldl

# Build hell from main.c and libhello.la
hell_SOURCES = main.c
hell_LDADD = libhello.la

# Create an easier-to-debug version of hell.
hell_debug_SOURCES = main.c
hell_debug_LDADD = libhello.la
hell_debug_LDFLAGS = -static

# Create a version of hell that does a preloaded dlopen.
helldl_SOURCES = dlmain.c
helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la

# Unfortunately, in order to test libtool thoroughly, we need access
# to its private directory.
objdir = `sed -n -e 's/^objdir=\"\(.*\)\"$$/\1/p' ./libtool`

TESTS = run.test

# The following rules are only for the libtool demo and tests.
# Regenerate our acinclude.m4 only if it doesn't exist.
$(srcdir)/acinclude.m4:
	rm -f $(srcdir)/acinclude.m4
	cd $(srcdir) && $(LN_S) ../libtool.m4 acinclude.m4

# Don't build helldl on unsupported platforms.
helldl: $(helldl_OBJECTS) $(helldl_DEPENDENCIES)
	@rm -f helldl helldlT
	@eval "`egrep '^global_symbol_pipe=' libtool`"; \
	if test -z "$$global_symbol_pipe"; then \
	  echo 'creating helldl (-dlopen is unsupported)'; \
	  echo "#! /bin/sh" > helldlT; \
	  echo "echo '-dlopen is unsupported'" >> helldlT; \
	  chmod +x helldlT; \
	  mv -f helldlT helldl; \
	else \
	  echo '$(LINK) $(helldl_LDFLAGS) $(helldl_OBJECTS) $(helldl_LDADD) $(LIBS)'; \
	  $(LINK) $(helldl_LDFLAGS) $(helldl_OBJECTS) $(helldl_LDADD) $(LIBS); \
	fi

# Test programs to see what gets hardcoded.
.PHONY: hardcode
hardcode: $(hardcode_tests)
hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES)
	@rm -f hc-direct
	@echo "You may ignore any linking errors from the following command:"
	@shlib=./$(objdir)/libhello.a; \
	  eval "`egrep '^library_names' libhello.la`"; \
	  for lib in $$library_names; do \
	    shlib="./$(objdir)/$$lib"; \
	  done; \
	  echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) || echo unsupported > $@"; \
	  eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) || echo unsupported > $@"

# 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
	objdir=$(objdir); cd _hclibs && for lib in ../$$objdir/libhello*; do \
	  $(LN_S) $$lib `echo "$$lib" | sed 's%^.*/%%'` || exit 1; \
	done
	@eval `egrep -e '^(hardcode_.*|wl)=' ./libtool`; \
	  libdir=`pwd`/$(objdir); \
	  flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
	  if test -z "$$flag"; then \
	    echo "echo unsupported > $@"; \
	    echo unsupported > $@ || status="$$?"; \
	  else \
	    echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L./_hclibs -lhello $(LIBS)"; \
	    $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L./_hclibs -lhello $(LIBS) || status="$$?"; \
	  fi; \
	  echo "rm -rf _hclibs"; \
	  rm -rf _hclibs; \
	  exit $$status

hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES)
	@rm -f hc-libpath
	@echo "You may ignore any linking errors from the following command:"
	@eval `egrep -e '^shlibpath_var=' ./libtool`; \
	  echo "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) || echo unsupported > $@"; \
	  eval "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) || echo unsupported > $@"

hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
	@rm -f hc-minusL
	$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS)