xref: /titanic_41/usr/src/uts/i86pc/Makefile.rules (revision c533a883a71cff9ff32df1c53c31201e1cbf371f)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29#	This Makefile defines the build rules for the directory uts/i86pc
30#	and its children. These are the source files which are i86pc
31#	"implementation architecture" dependent.
32#
33#	The following two-level ordering must be maintained in this file.
34#	  Lines are sorted first in order of decreasing specificity based on
35#	  the first directory component.  That is, sun4u rules come before
36#	  sparc rules come before common rules.
37#
38#	  Lines whose initial directory components are equal are sorted
39#	  alphabetically by the remaining components.
40
41#
42#	Section 1a: C object build rules
43#
44$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/conf/%.c
45	$(COMPILE.c) -o $@ $<
46	$(CTFCONVERT_O)
47
48$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/cpu/amd_opteron/%.c
49	$(COMPILE.c) -o $@ $<
50	$(CTFCONVERT_O)
51
52$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/cpu/authenticamd/%.c
53	$(COMPILE.c) -o $@ $<
54	$(CTFCONVERT_O)
55
56$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/cpu/generic_cpu/%.c
57	$(COMPILE.c) -o $@ $<
58	$(CTFCONVERT_O)
59
60$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/cpu/genuineintel/%.c
61	$(COMPILE.c) -o $@ $<
62	$(CTFCONVERT_O)
63
64$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/intel_nb5000/%.c
65	$(COMPILE.c) -o $@ $<
66	$(CTFCONVERT_O)
67
68$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/%.c
69	$(COMPILE.c) -o $@ $<
70	$(CTFCONVERT_O)
71
72$(OBJS_DIR)/%.o:                $(UTSBASE)/i86pc/io/battery/%.c
73	$(COMPILE.c) -o $@ $<
74	$(CTFCONVERT_O)
75
76$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/mc/%.c
77	$(COMPILE.c) -o $@ $<
78	$(CTFCONVERT_O)
79
80$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/pci/%.c
81	$(COMPILE.c) -o $@ $<
82	$(CTFCONVERT_O)
83
84$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/pciex/%.c
85	$(COMPILE.c) -o $@ $<
86	$(CTFCONVERT_O)
87
88$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/pcplusmp/%.c
89	$(COMPILE.c) -o $@ $<
90	$(CTFCONVERT_O)
91
92$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/pcplusmp/%.s
93	$(COMPILE.s) -o $@ $<
94
95$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/ppm/%.c
96	$(COMPILE.c) -o $@ $<
97	$(CTFCONVERT_O)
98
99$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/ppm/%.s
100	$(COMPILE.s) -o $@ $<
101
102$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/psm/%.c
103	$(COMPILE.c) -o $@ $<
104	$(CTFCONVERT_O)
105
106$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/psm/%.s
107	$(COMPILE.s) -o $@ $<
108
109$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/tzmon/%.c
110	$(COMPILE.c) -o $@ $<
111	$(CTFCONVERT_O)
112
113$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/xpv/%.c
114	$(COMPILE.c) -o $@ $<
115	$(CTFCONVERT_O)
116
117$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/xpv/%.s
118	$(COMPILE.s) -o $@ $<
119
120$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/ml/%.s
121	$(COMPILE.s) -o $@ $<
122
123$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/os/%.c
124	$(COMPILE.c) -o $@ $<
125	$(CTFCONVERT_O)
126
127$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/boot/%.c
128	$(COMPILE.c) -o $@ $<
129	$(CTFCONVERT_O)
130
131$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/vm/%.c
132	$(COMPILE.c) -o $@ $<
133	$(CTFCONVERT_O)
134
135$(OBJS_DIR)/%.o:		$(UTSBASE)/common/io/%.c
136	$(COMPILE.c) -o $@ $<
137	$(CTFCONVERT_O)
138
139$(OBJS_DIR)/%.o:		$(UTSBASE)/common/io/ppm/%.c
140	$(COMPILE.c) -o $@ $<
141	$(CTFCONVERT_O)
142
143$(OBJS_DIR)/%.o:		$(UTSBASE)/common/os/%.c
144	$(COMPILE.c) -o $@ $<
145	$(CTFCONVERT_O)
146
147$(OBJS_DIR)/%.o:		$(SRC)/common/dis/i386/%.c
148	$(COMPILE.c) -o $@ $<
149	$(CTFCONVERT_O)
150
151$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/gfx_private/%.c
152	$(COMPILE.c) -o $@ $<
153	$(CTFCONVERT_O)
154
155$(OBJS_DIR)/%.o:		$(UTSBASE)/common/xen/io/%.c
156	$(COMPILE.c) -o $@ $<
157	$(CTFCONVERT_O)
158
159$(OBJS_DIR)/%.o:		$(UTSBASE)/common/xen/os/%.c
160	$(COMPILE.c) -o $@ $<
161	$(CTFCONVERT_O)
162
163$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/xsvc/%.c
164	$(COMPILE.c) -o $@ $<
165	$(CTFCONVERT_O)
166
167#
168# dboot stuff is always 32 bit, linked to run with phys_addr == virt_addr
169#
170DBOOT_OBJS_DIR	= dboot/$(OBJS_DIR)
171DBOOT_MACH_32	= -D_BOOT_TARGET_i386
172DBOOT_MACH_64	= -D_BOOT_TARGET_amd64
173DBOOT_DEFS	= -D_BOOT $(DBOOT_MACH_$(CLASS))
174DBOOT_DEFS	+= -D_MACHDEP -D_KMEMUSER -U_KERNEL -D_I32LPx
175
176DBOOT_CC_INCL	= -I$(SRC)/common $(INCLUDE_PATH)
177DBOOT_AS_INCL	= $(AS_INC_PATH)
178
179DBOOT_AS	= $(ONBLD_TOOLS)/bin/$(MACH)/aw
180
181DBOOT_LINTS_DIR	= $(DBOOT_OBJS_DIR)
182DBOOT_LINTFLAGS_i86pc	= $(LINTFLAGS_i386_32) $(LINTTAGS_i386_32)
183
184DBOOT_LINTFLAGS = $(DBOOT_LINTFLAGS_$(PLATFORM)) $(LINTTAGS) $(C99LMODE) \
185	$(CPPFLAGS) $(DBOOT_DEFS)
186DBOOT_LOCAL_LINTFLAGS   = -c -dirout=$(DBOOT_LINTS_DIR) -I$(SRC)/common \
187	$(DBOOT_LINTFLAGS) $(DBOOT_LINTTAGS)
188
189$(DBOOT_OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/boot/%.c
190	$(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
191
192$(DBOOT_OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/dboot/%.c
193	$(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
194
195$(DBOOT_OBJS_DIR)/%.o:		$(UTSBASE)/intel/ia32/%.s
196	$(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
197
198$(DBOOT_OBJS_DIR)/%.o:		$(COMMONBASE)/util/%.c
199	$(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
200
201$(DBOOT_OBJS_DIR)/%.o:		$(COMMONBASE)/util/i386/%.s
202	$(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
203
204$(DBOOT_OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/dboot/%.s
205	$(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
206
207#
208# Stuff to build bios_call.o for the kernel.
209#
210MAPFILE_BIOS	= $(UTSBASE)/i86pc/conf/Mapfile.bios
211$(OBJS_DIR)/bios_call.o:    $(UTSBASE)/i86pc/ml/bios_call_src.s
212	$(COMPILE.s) -o $(OBJS_DIR)/bios_call_src.o \
213		$(UTSBASE)/i86pc/ml/bios_call_src.s
214	$(LD) -dn -M $(MAPFILE_BIOS)  \
215		-o $(OBJS_DIR)/bios_call_src $(OBJS_DIR)/bios_call_src.o
216	@echo "  .data"				> $(OBJS_DIR)/bios_call.s
217	@echo "  .globl bios_image"		>> $(OBJS_DIR)/bios_call.s
218	@echo "bios_image:"			>> $(OBJS_DIR)/bios_call.s
219	$(ELFEXTRACT) $(OBJS_DIR)/bios_call_src	>> $(OBJS_DIR)/bios_call.s
220	@echo "  .align 4"			>> $(OBJS_DIR)/bios_call.s
221	@echo "  .globl bios_size"		>> $(OBJS_DIR)/bios_call.s
222	@echo "bios_size:"			>> $(OBJS_DIR)/bios_call.s
223	@echo "  .long . - bios_image"		>> $(OBJS_DIR)/bios_call.s
224	$(COMPILE.s) -o $@ $(OBJS_DIR)/bios_call.s
225
226# ridiculous contortions ---
227ATOMIC_SUBDIR_32	= i386
228ATOMIC_SUBDIR_64	= amd64
229ATOMIC_SUBDIR		= $(ATOMIC_SUBDIR_$(CLASS))
230
231$(OBJS_DIR)/%.o:		$(SRC)/common/atomic/$(ATOMIC_SUBDIR)/%.s
232	$(COMPILE.s) -o $@ $<
233
234$(OBJS_DIR)/%.o:		$(SRC)/common/mc/mc-amd/%.c
235	$(COMPILE.c) -o $@ $<
236	$(CTFCONVERT_O)
237
238#
239# dtrace stubs
240#
241
242$(OBJS_DIR)/dtracestubs.s:	$(UNIX_O) $(LIBS)
243	nm -u $(UNIX_O) $(LIBS) | grep __dtrace_probe_ | sort | uniq | nawk '{ \
244	    printf("\t.globl %s\n\t.type %s,@function\n%s:\n", \
245	    $$1, $$1, $$1); }' > $(OBJS_DIR)/dtracestubs.s
246
247$(DTRACESTUBS):	$(DTRACESTUBS_O)
248	$(BUILD.SO) $(DTRACESTUBS_O)
249
250#
251#	Section 1b: Lint `object' build rules
252#
253$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/conf/%.c
254	@($(LHEAD) $(LINT.c) $< $(LTAIL))
255
256$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/cpu/amd_opteron/%.c
257	@($(LHEAD) $(LINT.c) $< $(LTAIL))
258
259$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/cpu/authenticamd/%.c
260	@($(LHEAD) $(LINT.c) $< $(LTAIL))
261
262$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/cpu/generic_cpu/%.c
263	@($(LHEAD) $(LINT.c) $< $(LTAIL))
264
265$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/cpu/genuineintel/%.c
266	@($(LHEAD) $(LINT.c) $< $(LTAIL))
267
268$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/intel_nb5000/%.c
269	@($(LHEAD) $(LINT.c) $< $(LTAIL))
270
271$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/%.c
272	@($(LHEAD) $(LINT.c) $< $(LTAIL))
273
274$(LINTS_DIR)/%.ln:              $(UTSBASE)/i86pc/io/battery/%.c
275	@($(LHEAD) $(LINT.c) $< $(LTAIL))
276
277$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/mc/%.c
278	@($(LHEAD) $(LINT.c) $< $(LTAIL))
279
280$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pci/%.c
281	@($(LHEAD) $(LINT.c) $< $(LTAIL))
282
283$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pciex/%.c
284	@($(LHEAD) $(LINT.c) $< $(LTAIL))
285
286$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pcplusmp/%.c
287	@($(LHEAD) $(LINT.c) $< $(LTAIL))
288
289$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pcplusmp/%.s
290	@($(LHEAD) $(LINT.s) $< $(LTAIL))
291
292$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/ppm/%.c
293	@($(LHEAD) $(LINT.c) $< $(LTAIL))
294
295$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/ppm/%.s
296	@($(LHEAD) $(LINT.s) $< $(LTAIL))
297
298$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/psm/%.c
299	@($(LHEAD) $(LINT.c) $< $(LTAIL))
300
301$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/psm/%.s
302	@($(LHEAD) $(LINT.s) $< $(LTAIL))
303
304$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/tzmon/%.c
305	@($(LHEAD) $(LINT.c) $< $(LTAIL))
306
307$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/xpv/%.c
308	@($(LHEAD) $(LINT.c) $< $(LTAIL))
309
310$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/xpv/%.s
311	@($(LHEAD) $(LINT.s) $< $(LTAIL))
312
313$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/ml/%.s
314	@($(LHEAD) $(LINT.s) $< $(LTAIL))
315
316$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/os/%.c
317	@($(LHEAD) $(LINT.c) $< $(LTAIL))
318
319$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/boot/%.c
320	@($(LHEAD) $(LINT.c) $< $(LTAIL))
321
322$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/vm/%.c
323	@($(LHEAD) $(LINT.c) $< $(LTAIL))
324
325$(LINTS_DIR)/%.ln:		$(UTSBASE)/common/io/%.c
326	@($(LHEAD) $(LINT.c) $< $(LTAIL))
327
328$(LINTS_DIR)/%.ln:		$(UTSBASE)/common/io/ppm/%.c
329	@($(LHEAD) $(LINT.c) $< $(LTAIL))
330
331$(LINTS_DIR)/%.ln:		$(UTSBASE)/common/os/%.c
332	@($(LHEAD) $(LINT.c) $< $(LTAIL))
333
334$(LINTS_DIR)/%.ln:		$(SRC)/common/dis/i386/%.c
335	@($(LHEAD) $(LINT.c) $< $(LTAIL))
336
337$(LINTS_DIR)/%.ln:		$(SRC)/common/atomic/%.c
338	@($(LHEAD) $(LINT.c) $< $(LTAIL))
339
340$(LINTS_DIR)/%.ln:		$(SRC)/common/mc/mc-amd/%.c
341	@($(LHEAD) $(LINT.c) $< $(LTAIL))
342
343$(LINTS_DIR)/%.ln:		$(UTSBASE)/common/xen/io/%.c
344	@($(LHEAD) $(LINT.c) $< $(LTAIL))
345
346$(LINTS_DIR)/%.ln:		$(UTSBASE)/common/xen/os/%.c
347	@($(LHEAD) $(LINT.c) $< $(LTAIL))
348
349$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/gfx_private/%.c
350	@($(LHEAD) $(LINT.c) $< $(LTAIL))
351
352$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/xsvc/%.c
353	@($(LHEAD) $(LINT.c) $< $(LTAIL))
354
355#
356# bios call has a funky name change while building
357#
358$(LINTS_DIR)/bios_call.ln:	$(UTSBASE)/i86pc/ml/bios_call_src.s
359	@($(LHEAD) $(LINT.s) $(UTSBASE)/i86pc/ml/bios_call_src.s  $(LTAIL))
360	@mv $(LINTS_DIR)/bios_call_src.ln $(LINTS_DIR)/bios_call.ln
361
362#
363# dboot always compiles in 32-bit mode, so force lint to be 32-bit mode too.
364#
365$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/dboot/%.c
366	@($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
367
368$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/dboot/%.s
369	@($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
370
371$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/boot/%.c
372	@($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
373
374$(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/util/%.c
375	@($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
376
377$(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/util/i386/%.s
378	@($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
379