]> git.ipfire.org Git - thirdparty/glibc.git/blame - dlfcn/Makefile
.
[thirdparty/glibc.git] / dlfcn / Makefile
CommitLineData
6de1f625 1# Copyright (C) 1995-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
94e365c6
UD
2# This file is part of the GNU C Library.
3
4# The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
94e365c6
UD
8
9# The GNU C Library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12# Lesser General Public License for more details.
94e365c6 13
41bdb6e2
AJ
14# You should have received a copy of the GNU Lesser General Public
15# License along with the GNU C Library; if not, write to the Free
16# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17# 02111-1307 USA.
94e365c6
UD
18
19subdir := dlfcn
019e7a64 20headers := bits/dlfcn.h dlfcn.h
94e365c6 21extra-libs := libdl
c0f62c56 22libdl-routines := dlopen dlclose dlsym dlvsym dlerror dladdr dladdr1 dlinfo \
9dcafc55
UD
23 dlmopen dlfcn
24routines := $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines)))
5f21997b 25elide-routines.os := $(routines)
8f8452b7 26distribute := dlopenold.c glreflib1.c glreflib2.c failtestmod.c \
c08bc50a 27 defaultmod1.c defaultmod2.c errmsg1mod.c modatexit.c \
5f21997b 28 modcxaatexit.c modstatic.c modstatic2.c \
7237d704
UD
29 bug-dlsym1-lib1.c bug-dlsym1-lib2.c bug-atexit1-lib.c \
30 bug-atexit2-lib.c
94e365c6
UD
31
32extra-libs-others := libdl
33
34include ../Makeconfig
35
36ifeq ($(versioning),yes)
37libdl-routines += dlopenold
9dcafc55 38libdl-shared-only-routines := dlopenold dlfcn
94e365c6
UD
39endif
40
4380ef5e 41ifeq (yes,$(build-shared))
c3fd12a2 42tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
6de1f625 43 bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
32c075e1
JJ
44 bug-atexit3
45ifeq (yes,$(have-protected))
46tests += tstatexit
47endif
4380ef5e 48endif
f116c77f 49modules-names = glreflib1 glreflib2 failtestmod defaultmod1 defaultmod2 \
c3fd12a2 50 errmsg1mod modatexit modcxaatexit \
7237d704 51 bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
6de1f625 52 bug-atexit2-lib bug-atexit3-lib
be1152ca 53
1a379ea0
UD
54failtestmod.so-no-z-defs = yes
55glreflib2.so-no-z-defs = yes
56errmsg1mod.so-no-z-defs = yes
57
be1152ca 58ifeq (yesyesyes,$(build-static)$(build-shared)$(elf))
5f21997b
UD
59tests += tststatic tststatic2
60tests-static += tststatic tststatic2
61modules-names += modstatic modstatic2
5b643faf 62tststatic-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
5f21997b 63tststatic2-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
be1152ca
UD
64endif
65
376e973a 66extra-test-objs += $(modules-names:=.os)
68eefde7 67generated := $(modules-names:=.so)
4380ef5e 68
94e365c6 69include ../Rules
4380ef5e
UD
70
71test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
4380ef5e 72
5181d776
RM
73ifeq ($(build-shared),yes)
74# Build all the modules even when not actually running test programs.
75tests: $(test-modules)
76endif
77
00213fe4 78$(objpfx)glrefmain: $(libdl)
4380ef5e
UD
79$(objpfx)glrefmain.out: $(objpfx)glrefmain \
80 $(objpfx)glreflib1.so $(objpfx)glreflib2.so
d743ba1e
UD
81
82$(objpfx)failtest: $(libdl)
83$(objpfx)failtest.out: $(objpfx)failtestmod.so
00213fe4
AJ
84
85$(objpfx)tst-dladdr: $(libdl)
86$(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so
3fe40015 87
45e4762c
RM
88$(objpfx)tst-dlinfo: $(libdl)
89$(objpfx)tst-dlinfo.out: $(objpfx)glreflib1.so
90
ad10cac8 91LDFLAGS-default = $(LDFLAGS-rdynamic)
3fe40015 92$(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
ad10cac8
UD
93$(objpfx)defaultmod1.so: $(libdl) $(common-objpfx)libc_nonshared.a
94LDFLAGS-defaultmod2.so = $(LDFLAGS-Bsymbolic)
95$(objpfx)defaultmod2.so: $(libdl) $(common-objpfx)libc_nonshared.a
f116c77f
UD
96
97$(objpfx)errmsg1: $(libdl)
98$(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so
c08bc50a
UD
99
100$(objpfx)tstatexit: $(libdl)
101$(objpfx)tstatexit.out: $(objpfx)tstatexit $(objpfx)modatexit.so
102
103$(objpfx)tstcxaatexit: $(libdl)
104$(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so
105
106$(objpfx)modatexit.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
639c3248 107
be1152ca
UD
108$(objpfx)tststatic: $(objpfx)libdl.a
109$(objpfx)tststatic.out: $(objpfx)tststatic $(objpfx)modstatic.so
110
5f21997b
UD
111$(objpfx)tststatic2: $(objpfx)libdl.a
112$(objpfx)tststatic2.out: $(objpfx)tststatic2 $(objpfx)modstatic.so \
113 $(objpfx)modstatic2.so
114
115$(objpfx)modstatic2.so: $(libdl) $(common-objpfx)libc.so \
116 $(common-objpfx)libc_nonshared.a
be1152ca 117
472d82fc
UD
118$(objpfx)bug-dlopen1: $(libdl)
119
c3fd12a2
RM
120$(objpfx)bug-dlsym1: $(libdl) $(objpfx)bug-dlsym1-lib2.so
121$(objpfx)bug-dlsym1.out: $(objpfx)bug-dlsym1-lib1.so \
122 $(objpfx)bug-dlsym1-lib2.so
123$(objpfx)bug-dlsym1-lib1.so: $(objpfx)bug-dlsym1-lib2.so \
124 $(common-objpfx)libc.so \
125 $(common-objpfx)libc_nonshared.a
126$(objpfx)bug-dlsym1-lib2.so: $(common-objpfx)libc.so \
127 $(common-objpfx)libc_nonshared.a
128
7237d704
UD
129$(objpfx)bug-atexit1: $(libdl)
130$(objpfx)bug-atexit1.out: $(objpfx)bug-atexit1-lib.so
131$(objpfx)bug-atexit1-lib.so: $(common-objpfx)libc.so \
132 $(common-objpfx)libc_nonshared.a
133
134$(objpfx)bug-atexit2: $(libdl)
135$(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so
136$(objpfx)bug-atexit2-lib.so: $(common-objpfx)libc.so \
137 $(common-objpfx)libc_nonshared.a
c3fd12a2 138
b80770b2
UD
139LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh $(common-objpfx)elf/ld.so \
140 $(common-objpfx)libc_nonshared.a
6de1f625
UD
141$(objpfx)bug-atexit3: $(libdl)
142$(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
143$(objpfx)bug-atexit3-lib.so: $(common-objpfx)libc.so \
144 $(common-objpfx)libc_nonshared.a
145
c3fd12a2 146
639c3248
UD
147# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
148# This ensures they will load libc.so for needed symbols if loaded by
149# a statically-linked program that hasn't already loaded it.
a7f7b879
UD
150$(objpfx)libdl.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a \
151 $(if $(filter yes,$(elf)), $(elfobjdir)/ld.so)