]> git.ipfire.org Git - thirdparty/glibc.git/blame - dlfcn/Makefile
Static linking is always needed
[thirdparty/glibc.git] / dlfcn / Makefile
CommitLineData
0269750c 1# Copyright (C) 1995-2006, 2010, 2012 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)
1c298d08
UD
26distribute := dlopenold.c glreflib1.c glreflib2.c glreflib3.c \
27 failtestmod.c \
c08bc50a 28 defaultmod1.c defaultmod2.c errmsg1mod.c modatexit.c \
5f21997b 29 modcxaatexit.c modstatic.c modstatic2.c \
7237d704
UD
30 bug-dlsym1-lib1.c bug-dlsym1-lib2.c bug-atexit1-lib.c \
31 bug-atexit2-lib.c
94e365c6
UD
32
33extra-libs-others := libdl
34
35include ../Makeconfig
36
37ifeq ($(versioning),yes)
38libdl-routines += dlopenold
9dcafc55 39libdl-shared-only-routines := dlopenold dlfcn
94e365c6
UD
40endif
41
4380ef5e 42ifeq (yes,$(build-shared))
c3fd12a2 43tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
6de1f625 44 bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
11bf311e 45 bug-atexit3 tstatexit
4380ef5e 46endif
1c298d08
UD
47modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
48 defaultmod2 errmsg1mod modatexit modcxaatexit \
7237d704 49 bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
6de1f625 50 bug-atexit2-lib bug-atexit3-lib
be1152ca 51
1a379ea0
UD
52failtestmod.so-no-z-defs = yes
53glreflib2.so-no-z-defs = yes
54errmsg1mod.so-no-z-defs = yes
55
2119dcfa 56ifeq (yes,$(build-shared))
5f21997b
UD
57tests += tststatic tststatic2
58tests-static += tststatic tststatic2
59modules-names += modstatic modstatic2
5b643faf 60tststatic-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
5f21997b 61tststatic2-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
be1152ca
UD
62endif
63
376e973a 64extra-test-objs += $(modules-names:=.os)
68eefde7 65generated := $(modules-names:=.so)
4380ef5e 66
94e365c6 67include ../Rules
4380ef5e
UD
68
69test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
4380ef5e 70
5181d776
RM
71ifeq ($(build-shared),yes)
72# Build all the modules even when not actually running test programs.
73tests: $(test-modules)
74endif
75
00213fe4 76$(objpfx)glrefmain: $(libdl)
4380ef5e
UD
77$(objpfx)glrefmain.out: $(objpfx)glrefmain \
78 $(objpfx)glreflib1.so $(objpfx)glreflib2.so
d743ba1e
UD
79
80$(objpfx)failtest: $(libdl)
81$(objpfx)failtest.out: $(objpfx)failtestmod.so
00213fe4
AJ
82
83$(objpfx)tst-dladdr: $(libdl)
84$(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so
3fe40015 85
45e4762c 86$(objpfx)tst-dlinfo: $(libdl)
1c298d08
UD
87$(objpfx)tst-dlinfo.out: $(objpfx)glreflib3.so
88LDFLAGS-glreflib3.so = -Wl,-rpath,:
45e4762c 89
ad10cac8 90LDFLAGS-default = $(LDFLAGS-rdynamic)
3fe40015 91$(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
765ade4b 92$(objpfx)defaultmod1.so: $(libdl)
ad10cac8 93LDFLAGS-defaultmod2.so = $(LDFLAGS-Bsymbolic)
765ade4b 94$(objpfx)defaultmod2.so: $(libdl)
f116c77f
UD
95
96$(objpfx)errmsg1: $(libdl)
97$(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so
c08bc50a
UD
98
99$(objpfx)tstatexit: $(libdl)
100$(objpfx)tstatexit.out: $(objpfx)tstatexit $(objpfx)modatexit.so
101
102$(objpfx)tstcxaatexit: $(libdl)
103$(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so
104
be1152ca
UD
105$(objpfx)tststatic: $(objpfx)libdl.a
106$(objpfx)tststatic.out: $(objpfx)tststatic $(objpfx)modstatic.so
107
5f21997b
UD
108$(objpfx)tststatic2: $(objpfx)libdl.a
109$(objpfx)tststatic2.out: $(objpfx)tststatic2 $(objpfx)modstatic.so \
110 $(objpfx)modstatic2.so
111
765ade4b 112$(objpfx)modstatic2.so: $(libdl)
be1152ca 113
472d82fc
UD
114$(objpfx)bug-dlopen1: $(libdl)
115
c3fd12a2
RM
116$(objpfx)bug-dlsym1: $(libdl) $(objpfx)bug-dlsym1-lib2.so
117$(objpfx)bug-dlsym1.out: $(objpfx)bug-dlsym1-lib1.so \
118 $(objpfx)bug-dlsym1-lib2.so
765ade4b 119$(objpfx)bug-dlsym1-lib1.so: $(objpfx)bug-dlsym1-lib2.so
c3fd12a2 120
7237d704
UD
121$(objpfx)bug-atexit1: $(libdl)
122$(objpfx)bug-atexit1.out: $(objpfx)bug-atexit1-lib.so
7237d704
UD
123
124$(objpfx)bug-atexit2: $(libdl)
125$(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so
c3fd12a2 126
87162f46
AS
127LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh $(elfobjdir)/ld.so \
128 $(common-objpfx)libc_nonshared.a
6de1f625
UD
129$(objpfx)bug-atexit3: $(libdl)
130$(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
6de1f625 131
c3fd12a2 132
639c3248
UD
133# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
134# This ensures they will load libc.so for needed symbols if loaded by
135# a statically-linked program that hasn't already loaded it.
a7f7b879 136$(objpfx)libdl.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a \
0269750c 137 $(elfobjdir)/ld.so