]> git.ipfire.org Git - thirdparty/glibc.git/blob - dlfcn/Makefile
Avoid C++ tests when the C++ cannot be linked.
[thirdparty/glibc.git] / dlfcn / Makefile
1 # Copyright (C) 1995-2015 Free Software Foundation, Inc.
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
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.
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
12 # Lesser General Public License for more details.
13
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
17
18 subdir := dlfcn
19
20 include ../Makeconfig
21
22 headers := bits/dlfcn.h dlfcn.h
23 extra-libs := libdl
24 libdl-routines := dlopen dlclose dlsym dlvsym dlerror dladdr dladdr1 dlinfo \
25 dlmopen dlfcn
26 routines := $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines)))
27 elide-routines.os := $(routines)
28
29 extra-libs-others := libdl
30
31 ifeq ($(build-shared),yes)
32 libdl-routines += dlopenold
33 libdl-shared-only-routines := dlopenold dlfcn
34 endif
35
36 ifeq (yes,$(build-shared))
37 tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
38 bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
39 tstatexit bug-dl-leaf tst-rec-dlopen
40 endif
41 modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
42 defaultmod2 errmsg1mod modatexit modcxaatexit \
43 bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
44 bug-atexit2-lib bug-dl-leaf-lib \
45 bug-dl-leaf-lib-cb moddummy1 moddummy2
46
47 failtestmod.so-no-z-defs = yes
48 glreflib2.so-no-z-defs = yes
49 errmsg1mod.so-no-z-defs = yes
50
51 ifeq (yes,$(build-shared))
52 tests += tststatic tststatic2 tststatic3 tststatic4 tststatic5
53 tests-static += tststatic tststatic2 tststatic3 tststatic4 tststatic5
54 modules-names += modstatic modstatic2 modstatic3 modstatic5
55 tststatic-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf
56 tststatic2-ENV = $(tststatic-ENV)
57 tststatic3-ENV = $(tststatic-ENV)
58 tststatic4-ENV = $(tststatic-ENV)
59 tststatic5-ENV = $(tststatic-ENV)
60
61 ifneq (,$(CXX))
62 tests += bug-atexit3
63 modules-names += bug-atexit3-lib
64 endif
65 endif
66
67 extra-test-objs += $(modules-names:=.os)
68 generated += $(modules-names:=.so)
69
70 include ../Rules
71
72 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
73
74 ifeq ($(build-shared),yes)
75 # Build all the modules even when not actually running test programs.
76 tests: $(test-modules)
77 endif
78
79 $(objpfx)glrefmain: $(libdl)
80 $(objpfx)glrefmain.out: $(objpfx)glrefmain \
81 $(objpfx)glreflib1.so $(objpfx)glreflib2.so
82
83 $(objpfx)failtest: $(libdl)
84 $(objpfx)failtest.out: $(objpfx)failtestmod.so
85
86 $(objpfx)tst-dladdr: $(libdl)
87 $(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so
88
89 $(objpfx)tst-dlinfo: $(libdl)
90 $(objpfx)tst-dlinfo.out: $(objpfx)glreflib3.so
91 LDFLAGS-glreflib3.so = -Wl,-rpath,:
92
93 LDFLAGS-default = $(LDFLAGS-rdynamic)
94 $(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
95 $(objpfx)defaultmod1.so: $(libdl)
96 LDFLAGS-defaultmod2.so = $(LDFLAGS-Bsymbolic)
97 $(objpfx)defaultmod2.so: $(libdl)
98
99 $(objpfx)errmsg1: $(libdl)
100 $(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so
101
102 $(objpfx)tstatexit: $(libdl)
103 $(objpfx)tstatexit.out: $(objpfx)tstatexit $(objpfx)modatexit.so
104
105 $(objpfx)tstcxaatexit: $(libdl)
106 $(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so
107
108 $(objpfx)tststatic: $(objpfx)libdl.a
109 $(objpfx)tststatic.out: $(objpfx)tststatic $(objpfx)modstatic.so
110
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)
116
117 $(objpfx)tststatic3: $(objpfx)libdl.a
118 $(objpfx)tststatic3.out: $(objpfx)tststatic3 $(objpfx)modstatic3.so
119
120 $(objpfx)tststatic4: $(objpfx)libdl.a
121 $(objpfx)tststatic4.out: $(objpfx)tststatic4 $(objpfx)modstatic3.so
122
123 $(objpfx)tststatic5: $(objpfx)libdl.a
124 $(objpfx)tststatic5.out: $(objpfx)tststatic5 $(objpfx)modstatic5.so
125
126 $(objpfx)bug-dlopen1: $(libdl)
127
128 $(objpfx)bug-dlsym1: $(libdl) $(objpfx)bug-dlsym1-lib2.so
129 $(objpfx)bug-dlsym1.out: $(objpfx)bug-dlsym1-lib1.so \
130 $(objpfx)bug-dlsym1-lib2.so
131 $(objpfx)bug-dlsym1-lib1.so: $(objpfx)bug-dlsym1-lib2.so
132
133 $(objpfx)bug-atexit1: $(libdl)
134 $(objpfx)bug-atexit1.out: $(objpfx)bug-atexit1-lib.so
135
136 $(objpfx)bug-atexit2: $(libdl)
137 $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so
138
139 LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh
140 $(objpfx)bug-atexit3: $(libdl)
141 $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
142
143 $(objpfx)bug-dl-leaf: $(objpfx)bug-dl-leaf-lib.so
144 $(objpfx)bug-dl-leaf.out: $(objpfx)bug-dl-leaf-lib-cb.so
145 $(objpfx)bug-dl-leaf-lib.so: $(libdl)
146 $(objpfx)bug-dl-leaf-lib-cb.so: $(objpfx)bug-dl-leaf-lib.so
147
148 $(objpfx)tst-rec-dlopen: $(libdl)
149 $(objpfx)tst-rec-dlopen.out: $(objpfx)moddummy1.so $(objpfx)moddummy2.so