Print this page
5324 .comment section on kmdb kmods is not set properly
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/mdb/Makefile.module
+++ new/usr/src/cmd/mdb/Makefile.module
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21 #
22 22 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 # Use is subject to license terms.
24 24 #
25 25 # Copyright (c) 2013 by Delphix. All rights reserved.
26 26 #
27 27
28 28 .KEEP_STATE:
29 29 .SUFFIXES:
30 30
31 31 include $(SRC)/cmd/mdb/Makefile.tools
32 32
33 33 $(KMOD_SOURCES_DIFFERENT)KMODSRCS = $(MODSRCS)
34 34
35 35 MODOBJS = $(MODSRCS:%.c=dmod/%.o)
36 36 KMODOBJS = $(KMODSRCS:%.c=kmod/%.o)
37 37
38 38 MODNAME = $(MODULE:%.so=%)
39 39 KMODULE = $(MODNAME)
40 40
41 41 MODFILE = dmod/$(MODULE)
42 42 KMODFILE = kmod/$(KMODULE)
43 43
44 44 #
45 45 # The mess below is designed to pick the right set of objects to build and/or
46 46 # lint. We have three flavors:
47 47 #
48 48 # 1. proc and raw modules. Only $(MODOBJS) are built.
49 49 # 2. kvm modules for systems without kmdb. Only $(MODOBJS) are built.
50 50 # 3. kvm modules for systems with kmdb. $(MODOBJS) and $(KMODOBJS) are built.
51 51 #
52 52 # Complicating matters, we'd like to make the distinction between 2 and 3 before
53 53 # this Makefile is loaded. By default, we'll assume that all kvm modules should
54 54 # be built for kmdb. If, however, the user sets $(MODULE_BUILD_TYPE) to `mdb',
55 55 # the kmdb variant of the module won't be built.
56 56 #
57 57
58 58 # Which flavors are to be built?
59 59 TARGETS_kvm_type_ = both # Build both if $(MODULE_BUILD_TYPE) is unset
60 60 TARGETS_kvm_type_kmdb = both
61 61 TARGETS_kvm_type_mdb = mdb
62 62 TARGETS_kvm_type = $(TARGETS_kvm_type_$(MODULE_BUILD_TYPE))
63 63
64 64 # What should we build?
65 65 TARGETS_kvm_kmdb = $(KMODFILE)
66 66 TARGETS_kvm_mdb = $(MODFILE)
67 67 TARGETS_kvm_both = $(TARGETS_kvm_mdb) $(TARGETS_kvm_kmdb)
68 68 TARGETS_kvm = $(TARGETS_kvm_$(TARGETS_kvm_type))
69 69 TARGETS_proc = $(MODFILE)
70 70 TARGETS_raw = $(MODFILE)
71 71 TARGETS = $(TARGETS_$(MDBTGT))
72 72
73 73 # Where should we install that which we've built?
74 74 ROOTTGTS_kvm_type = $(TARGETS_kvm_type) # overridden by mdb_ks
75 75 ROOTTGTS_kvm_kmdb = $(ROOTKMOD)/$(KMODULE)
76 76 ROOTTGTS_kvm_mdb = $(ROOTMOD)/$(MODULE)
77 77 ROOTTGTS_kvm_both = $(ROOTTGTS_kvm_mdb) $(ROOTTGTS_kvm_kmdb)
78 78 ROOTTGTS_kvm = $(ROOTTGTS_kvm_$(ROOTTGTS_kvm_type))
79 79 ROOTTGTS_proc = $(ROOTMOD)/$(MODULE)
80 80 ROOTTGTS_raw = $(ROOTMOD)/$(MODULE)
81 81 ROOTTGTS = $(ROOTTGTS_$(MDBTGT))
82 82
83 83 # What should we lint?
84 84 KLINTOBJS = $(KMODOBJS:%.o=%.ln)
85 85 LINTOBJS = $(MODOBJS:%.o=%.ln)
86 86
87 87 LINTFILES_kvm_type = $(TARGETS_kvm_type)
88 88 LINTFILES_kvm_both = $(KLINTOBJS) $(LINTOBJS)
89 89 LINTFILES_kvm_mdb = $(LINTOBJS)
90 90 LINTFILES_kvm = $(LINTFILES_kvm_$(LINTFILES_kvm_type))
91 91 LINTFILES_proc = $(LINTOBJS)
92 92 LINTFILES_raw = $(LINTOBJS)
93 93 LINTFILES = $(LINTFILES_$(MDBTGT))
94 94
95 95 kvm_TGTFLAGS = -D_KERNEL
96 96 proc_TGTFLAGS = -D_USER
97 97
98 98 C99MODE = $(C99_ENABLE)
99 99
100 100 CFLAGS += $(CCVERBOSE)
101 101 CFLAGS64 += $(CCVERBOSE)
102 102 CPPFLAGS += $($(MDBTGT)_TGTFLAGS) -I../../../common
103 103 LDFLAGS += $(ZTEXT)
104 104 LDFLAGS64 += $(ZTEXT)
105 105
106 106 # Module type-specific compiler flags
107 107 $(MODOBJS) := CFLAGS += $(C_BIGPICFLAGS) $(XREGSFLAG)
108 108 $(MODOBJS) := CFLAGS64 += $(C_BIGPICFLAGS) $(XREGSFLAG)
109 109 $(KMODOBJS) $(KLINTOBJS) := CPPFLAGS += -D_KMDB
110 110 $(KMODOBJS) := V9CODESIZE = $(CCABS32)
111 111 $(KMODOBJS) := DTS_ERRNO =
112 112
113 113 # Modules aren't allowed to export symbols
114 114 MAPFILE = $(SRC)/cmd/mdb/common/modules/conf/mapfile
115 115
116 116 # Modules typically make external references. To provide for -zdefs use
117 117 # and clean ldd(1) processing, explicitly define all external references.
118 118 MAPFILE-EXT = $(SRC)/cmd/mdb/common/modules/conf/mapfile-extern
119 119
120 120 #
121 121 # kmdb is a kernel module, so we'll use the kernel's build flags.
122 122 $(KMODOBJS) := CFLAGS += $(STAND_FLAGS_32)
123 123 $(KMODOBJS) := CFLAGS64 += $(STAND_FLAGS_64)
124 124
125 125 #
126 126 # Override this to pull source files from another directory
127 127 #
128 128 MODSRCS_DIR = ../../../common/modules/genunix
129 129
130 130 all: $$(TARGETS)
131 131
132 132 install: all $$(ROOTTGTS)
133 133
134 134 dmods: install
135 135
136 136 clean.lint:
137 137 $(RM) $(LINTFILES) $(MODSRCS:.c=.ln)
138 138
139 139 clean:
140 140 $(RM) $(MODOBJS) $(KMODOBJS) $(CLEANFILES)
141 141
142 142 clobber: clean clean.lint
143 143 $(RM) $(MODFILE) $(KMODFILE) $(CLOBBERFILES)
144 144
145 145 lint: $$(LINTFILES)
146 146
147 147 .NO_PARALLEL:
148 148 .PARALLEL: $(MODOBJS) $(KMODOBJS) mdb_tgt kmdb_tgt dmod kmod \
149 149 $(TARGETS) $(LINTFILES)
150 150
151 151 $(MODFILE): dmod .WAIT $(MODOBJS) $$(MAPFILE-EXT)
152 152 $(LINK.c) $(ZDEFS) $(ZIGNORE) $(MAPFILE-EXT:%=-M%) $(GSHARED) \
153 153 $(MODOBJS) -o $@ $(LDLIBS) -lc
154 154 $(CTFMERGE) -L VERSION -o $@ $(MODOBJS)
155 155 $(POST_PROCESS_SO)
156 156
157 157 #
158 158 # kmdb dmods must *not* stray from the module API. To ensure that they don't,
159 159 # we try to link them, at build time, against an object that exports the symbols
160 160 # that they can legally use. The link test object is, however, only built when
161 161 # kmdb itself is built. Requiring module developers to build kmdb first would
162 162 # be painful, so by default, module-level builds don't do the link test (the
163 163 # $(POUND_SIGN) assignment below takes care of that). Builds of the entire
164 164 # tree can, however, guarantee the construction of kmdb first, and as such can
165 165 # override the setting of $(KMDB_LINKTEST_ENABLE). This override causes the
166 166 # link test to be run.
167 167 #
168 168 # Developers wanting to force a link test for a single module can use the
169 169 # `linktest' target from within a module directory.
170 170 #
171 171 LINKTESTOBJ = $(KMDBDIR)/kmdb_modlinktest.o
172 172
173 173 KMDB_LINKTEST = \
174 174 $(LD) $(ZDEFS) -dy -r -o $@.linktest $(KMODOBJS) \
175 175 $(STANDOBJS) $(LINKTESTOBJ) && \
176 176 $(RM) $@.linktest
177 177
178 178 KMDB_LINKTEST_ENABLE=$(POUND_SIGN)
179 179 $(KMDB_LINKTEST_ENABLE)KMDB_LINKTEST_CMD = $(KMDB_LINKTEST)
180 180
181 181 #
↓ open down ↓ |
181 lines elided |
↑ open up ↑ |
182 182 # Ensure that dmods don't use floating point
183 183 #
184 184 KMDB_FPTEST_CMD = $(KMDB_FPTEST)
185 185
186 186 $(KMODFILE): kmod .WAIT $(KMODOBJS) $(MAPFILE)
187 187 $(LD) -dy -r $(MAPFILE:%=-M%) -Nmisc/kmdbmod -o $@ $(KMODOBJS) \
188 188 $(STANDOBJS)
189 189 $(KMDB_LINKTEST_CMD)
190 190 $(KMDB_FPTEST_CMD)
191 191 $(CTFMERGE) -f -L VERSION -o $@ $(KMODOBJS)
192 + $(POST_PROCESS)
192 193 $(SETDYNFLAG) -f DF_1_NOKSYMS $@
193 194
194 195 linktest: linktest_check .WAIT kmod .WAIT $(KMODOBJS)
195 196 $(KMDB_LINKTEST)
196 197
197 198 linktest_check:
198 199 @if [ "$(MDBTGT)" != "kvm" ] ; then \
199 200 echo "ERROR: linktest is not supported non-kvm/disasm dmods" \
200 201 >&2 ; \
201 202 exit 1 ; \
202 203 fi
203 204
204 205 #
205 206 # Dynamic rules for object construction
206 207 #
207 208 dmod/%.o kmod/%.o: %.c
208 209 $(COMPILE.c) -o $@ $<
209 210 $(CTFCONVERT_O)
210 211
211 212 dmod/%.o kmod/%.o: ../%.c
212 213 $(COMPILE.c) -o $@ $<
213 214 $(CTFCONVERT_O)
214 215
215 216 dmod/%.o kmod/%.o: ../../../common/modules/$(MODNAME)/%.c
216 217 $(COMPILE.c) -o $@ $<
217 218 $(CTFCONVERT_O)
218 219
219 220 dmod/%.o kmod/%.o: $$(MODSRCS_DIR)/%.c
220 221 $(COMPILE.c) -o $@ $<
221 222 $(CTFCONVERT_O)
222 223
223 224 #
224 225 # Lint
225 226 #
226 227 dmod/%.ln kmod/%.ln: %.c
227 228 $(LINT.c) -dirout=$(@D) -c $<
228 229
229 230 dmod/%.ln kmod/%.ln: ../%.c
230 231 $(LINT.c) -dirout=$(@D) -c $<
231 232
232 233 dmod/%.ln kmod/%.ln: ../../../common/modules/$(MODNAME)/%.c
233 234 $(LINT.c) -dirout=$(@D) -c $<
234 235
235 236 dmod/%.ln kmod/%.ln: $$(MODSRCS_DIR)/%.c
236 237 $(LINT.c) -dirout=$(@D) -c $<
237 238
238 239 #
239 240 # Installation targets
240 241 #
241 242
242 243 $(ROOT)/usr/lib/mdb/$(MDBTGT): $(ROOT)/usr/lib/mdb
243 244 $(INS.dir)
244 245
245 246 $(ROOT)/usr/lib/mdb:
246 247 $(INS.dir)
247 248
248 249 $(ROOT)/kernel/kmdb:
249 250 $(INS.dir)
250 251
251 252 $(ROOTMOD)/$(MODULE): $(ROOTMOD)
252 253
253 254 $(ROOTKMOD)/$(KMODULE): $(ROOTKMOD)
254 255
255 256 kmod dmod:
256 257 -@mkdir -p $@
↓ open down ↓ |
55 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX