2.3.3-65
[glibc.git] / dlfcn / Makefile
blob8ac1c20648bd24be39ee04591291b6d03dfa2bf1
1 # Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
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.
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
12 # Lesser General Public License for more details.
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.
19 subdir := dlfcn
20 headers := bits/dlfcn.h dlfcn.h
21 extra-libs := libdl
22 libdl-routines := dlopen dlclose dlsym dlvsym dlerror dladdr dladdr1 dlinfo
23 distribute := dlopenold.c glreflib1.c glreflib2.c failtestmod.c \
24 defaultmod1.c defaultmod2.c errmsg1mod.c modatexit.c \
25 modcxaatexit.c modstatic.c \
26 bug-dlsym1-lib1.c bug-dlsym1-lib2.c
28 extra-libs-others := libdl
30 include ../Makeconfig
32 ifeq ($(versioning),yes)
33 libdl-routines += dlopenold
34 libdl-shared-only-routines := dlopenold
35 endif
37 ifeq (yes,$(build-shared))
38 tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
39 bug-dlopen1 bug-dlsym1 tst-dlinfo
40 ifeq (yes,$(have-protected))
41 tests += tstatexit
42 endif
43 endif
44 modules-names = glreflib1 glreflib2 failtestmod defaultmod1 defaultmod2 \
45 errmsg1mod modatexit modcxaatexit \
46 bug-dlsym1-lib1 bug-dlsym1-lib2
48 failtestmod.so-no-z-defs = yes
49 glreflib2.so-no-z-defs = yes
50 errmsg1mod.so-no-z-defs = yes
52 ifeq (yesyesyes,$(build-static)$(build-shared)$(elf))
53 tests += tststatic
54 tests-static += tststatic
55 modules-names += modstatic
56 tststatic-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
57 endif
59 extra-objs += $(modules-names:=.os)
60 generated := $(modules-names:=.so)
62 include ../Rules
64 LDFLAGS-dl.so = -Wl,-dynamic-linker,$(slibdir)/$(rtld-installed-name)
66 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
67 $(test-modules): $(objpfx)%.so: $(objpfx)%.os $(common-objpfx)shlib.lds
68 $(build-module)
70 ifeq ($(build-shared),yes)
71 # Build all the modules even when not actually running test programs.
72 tests: $(test-modules)
73 endif
75 $(objpfx)glrefmain: $(libdl)
76 $(objpfx)glrefmain.out: $(objpfx)glrefmain \
77 $(objpfx)glreflib1.so $(objpfx)glreflib2.so
79 $(objpfx)failtest: $(libdl)
80 $(objpfx)failtest.out: $(objpfx)failtestmod.so
82 $(objpfx)tst-dladdr: $(libdl)
83 $(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so
85 $(objpfx)tst-dlinfo: $(libdl)
86 $(objpfx)tst-dlinfo.out: $(objpfx)glreflib1.so
88 LDFLAGS-default = $(LDFLAGS-rdynamic)
89 $(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
90 $(objpfx)defaultmod1.so: $(libdl) $(common-objpfx)libc_nonshared.a
91 LDFLAGS-defaultmod2.so = $(LDFLAGS-Bsymbolic)
92 $(objpfx)defaultmod2.so: $(libdl) $(common-objpfx)libc_nonshared.a
94 $(objpfx)errmsg1: $(libdl)
95 $(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so
97 $(objpfx)tstatexit: $(libdl)
98 $(objpfx)tstatexit.out: $(objpfx)tstatexit $(objpfx)modatexit.so
100 $(objpfx)tstcxaatexit: $(libdl)
101 $(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so
103 $(objpfx)modatexit.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
105 $(objpfx)tststatic: $(objpfx)libdl.a
106 $(objpfx)tststatic.out: $(objpfx)tststatic $(objpfx)modstatic.so
108 $(objpfx)modstatic.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
110 $(objpfx)bug-dlopen1: $(libdl)
112 $(objpfx)bug-dlsym1: $(libdl) $(objpfx)bug-dlsym1-lib2.so
113 $(objpfx)bug-dlsym1.out: $(objpfx)bug-dlsym1-lib1.so \
114 $(objpfx)bug-dlsym1-lib2.so
115 $(objpfx)bug-dlsym1-lib1.so: $(objpfx)bug-dlsym1-lib2.so \
116 $(common-objpfx)libc.so \
117 $(common-objpfx)libc_nonshared.a
118 $(objpfx)bug-dlsym1-lib2.so: $(common-objpfx)libc.so \
119 $(common-objpfx)libc_nonshared.a
123 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
124 # This ensures they will load libc.so for needed symbols if loaded by
125 # a statically-linked program that hasn't already loaded it.
126 $(objpfx)libdl.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a \
127 $(if $(filter yes,$(elf)), $(elfobjdir)/ld.so)