xref: /titanic_50/usr/src/uts/i86pc/Makefile.rules (revision ab4a9beb2e4d596be0b3288c7d92919e27781b57)
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/ml/%.s
114	$(COMPILE.s) -o $@ $<
115
116$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/os/%.c
117	$(COMPILE.c) -o $@ $<
118	$(CTFCONVERT_O)
119
120$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/boot/%.c
121	$(COMPILE.c) -o $@ $<
122	$(CTFCONVERT_O)
123
124$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/vm/%.c
125	$(COMPILE.c) -o $@ $<
126	$(CTFCONVERT_O)
127
128$(OBJS_DIR)/%.o:		$(UTSBASE)/common/io/%.c
129	$(COMPILE.c) -o $@ $<
130	$(CTFCONVERT_O)
131
132$(OBJS_DIR)/%.o:		$(UTSBASE)/common/io/ppm/%.c
133	$(COMPILE.c) -o $@ $<
134	$(CTFCONVERT_O)
135
136$(OBJS_DIR)/%.o:		$(UTSBASE)/common/os/%.c
137	$(COMPILE.c) -o $@ $<
138	$(CTFCONVERT_O)
139
140$(OBJS_DIR)/%.o:		$(SRC)/common/dis/i386/%.c
141	$(COMPILE.c) -o $@ $<
142	$(CTFCONVERT_O)
143
144$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/gfx_private/%.c
145	$(COMPILE.c) -o $@ $<
146	$(CTFCONVERT_O)
147
148$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/xsvc/%.c
149	$(COMPILE.c) -o $@ $<
150	$(CTFCONVERT_O)
151
152#
153# dboot stuff is always 32 bit, linked to run with phys_addr == virt_addr
154#
155DBOOT_OBJS_DIR	= dboot/$(OBJS_DIR)
156DBOOT_MACH_32	= -D_BOOT_TARGET_i386
157DBOOT_MACH_64	= -D_BOOT_TARGET_amd64
158DBOOT_DEFS	= -D_BOOT $(DBOOT_MACH_$(CLASS))
159DBOOT_DEFS	+= -D_MACHDEP -D_KMEMUSER -U_KERNEL -D_I32LPx
160
161DBOOT_CC_INCL	= -I$(SRC)/common $(INCLUDE_PATH)
162DBOOT_AS_INCL	= $(AS_INC_PATH)
163
164DBOOT_AS	= $(ONBLD_TOOLS)/bin/$(MACH)/aw
165
166DBOOT_LINTS_DIR	= $(DBOOT_OBJS_DIR)
167DBOOT_LINTFLAGS_i86pc	= $(LINTFLAGS_i386_32) $(LINTTAGS_i386_32)
168
169DBOOT_LINTFLAGS = $(DBOOT_LINTFLAGS_$(PLATFORM)) $(LINTTAGS) $(C99LMODE) \
170	$(CPPFLAGS) $(DBOOT_DEFS)
171DBOOT_LOCAL_LINTFLAGS   = -c -dirout=$(DBOOT_LINTS_DIR) -I$(SRC)/common \
172	$(DBOOT_LINTFLAGS) $(DBOOT_LINTTAGS)
173
174$(DBOOT_OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/boot/%.c
175	$(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
176
177$(DBOOT_OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/dboot/%.c
178	$(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
179
180$(DBOOT_OBJS_DIR)/%.o:		$(COMMONBASE)/util/%.c
181	$(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
182
183$(DBOOT_OBJS_DIR)/%.o:		$(COMMONBASE)/util/i386/%.s
184	$(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
185
186$(DBOOT_OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/dboot/%.s
187	$(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
188
189#
190# Stuff to build bios_call.o for the kernel.
191#
192MAPFILE_BIOS	= $(UTSBASE)/i86pc/conf/Mapfile.bios
193$(OBJS_DIR)/bios_call.o:    $(UTSBASE)/i86pc/ml/bios_call_src.s
194	$(COMPILE.s) -o $(OBJS_DIR)/bios_call_src.o \
195		$(UTSBASE)/i86pc/ml/bios_call_src.s
196	$(LD) -dn -M $(MAPFILE_BIOS)  \
197		-o $(OBJS_DIR)/bios_call_src $(OBJS_DIR)/bios_call_src.o
198	@echo "  .data"				> $(OBJS_DIR)/bios_call.s
199	@echo "  .globl bios_image"		>> $(OBJS_DIR)/bios_call.s
200	@echo "bios_image:"			>> $(OBJS_DIR)/bios_call.s
201	$(ELFEXTRACT) $(OBJS_DIR)/bios_call_src	>> $(OBJS_DIR)/bios_call.s
202	@echo "  .align 4"			>> $(OBJS_DIR)/bios_call.s
203	@echo "  .globl bios_size"		>> $(OBJS_DIR)/bios_call.s
204	@echo "bios_size:"			>> $(OBJS_DIR)/bios_call.s
205	@echo "  .long . - bios_image"		>> $(OBJS_DIR)/bios_call.s
206	$(COMPILE.s) -o $@ $(OBJS_DIR)/bios_call.s
207
208# ridiculous contortions ---
209ATOMIC_SUBDIR_32	= i386
210ATOMIC_SUBDIR_64	= amd64
211ATOMIC_SUBDIR		= $(ATOMIC_SUBDIR_$(CLASS))
212
213$(OBJS_DIR)/%.o:		$(SRC)/common/atomic/$(ATOMIC_SUBDIR)/%.s
214	$(COMPILE.s) -o $@ $<
215
216$(OBJS_DIR)/%.o:		$(SRC)/common/mc/mc-amd/%.c
217	$(COMPILE.c) -o $@ $<
218	$(CTFCONVERT_O)
219
220#
221# dtrace stubs
222#
223
224$(OBJS_DIR)/dtracestubs.s:	$(UNIX_O) $(LIBS)
225	nm -u $(UNIX_O) $(LIBS) | grep __dtrace_probe_ | sort | uniq | nawk '{ \
226	    printf("\t.globl %s\n\t.type %s,@function\n%s:\n", \
227	    $$1, $$1, $$1); }' > $(OBJS_DIR)/dtracestubs.s
228
229$(DTRACESTUBS):	$(DTRACESTUBS_O)
230	$(BUILD.SO) $(DTRACESTUBS_O)
231
232#
233#	Section 1b: Lint `object' build rules
234#
235$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/conf/%.c
236	@($(LHEAD) $(LINT.c) $< $(LTAIL))
237
238$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/cpu/amd_opteron/%.c
239	@($(LHEAD) $(LINT.c) $< $(LTAIL))
240
241$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/cpu/authenticamd/%.c
242	@($(LHEAD) $(LINT.c) $< $(LTAIL))
243
244$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/cpu/generic_cpu/%.c
245	@($(LHEAD) $(LINT.c) $< $(LTAIL))
246
247$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/cpu/genuineintel/%.c
248	@($(LHEAD) $(LINT.c) $< $(LTAIL))
249
250$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/intel_nb5000/%.c
251	@($(LHEAD) $(LINT.c) $< $(LTAIL))
252
253$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/%.c
254	@($(LHEAD) $(LINT.c) $< $(LTAIL))
255
256$(LINTS_DIR)/%.ln:              $(UTSBASE)/i86pc/io/battery/%.c
257	@($(LHEAD) $(LINT.c) $< $(LTAIL))
258
259$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/mc/%.c
260	@($(LHEAD) $(LINT.c) $< $(LTAIL))
261
262$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pci/%.c
263	@($(LHEAD) $(LINT.c) $< $(LTAIL))
264
265$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pciex/%.c
266	@($(LHEAD) $(LINT.c) $< $(LTAIL))
267
268$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pcplusmp/%.c
269	@($(LHEAD) $(LINT.c) $< $(LTAIL))
270
271$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pcplusmp/%.s
272	@($(LHEAD) $(LINT.s) $< $(LTAIL))
273
274$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/ppm/%.c
275	@($(LHEAD) $(LINT.c) $< $(LTAIL))
276
277$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/ppm/%.s
278	@($(LHEAD) $(LINT.s) $< $(LTAIL))
279
280$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/psm/%.c
281	@($(LHEAD) $(LINT.c) $< $(LTAIL))
282
283$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/psm/%.s
284	@($(LHEAD) $(LINT.s) $< $(LTAIL))
285
286$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/tzmon/%.c
287	@($(LHEAD) $(LINT.c) $< $(LTAIL))
288
289$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/ml/%.s
290	@($(LHEAD) $(LINT.s) $< $(LTAIL))
291
292$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/os/%.c
293	@($(LHEAD) $(LINT.c) $< $(LTAIL))
294
295$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/boot/%.c
296	@($(LHEAD) $(LINT.c) $< $(LTAIL))
297
298$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/vm/%.c
299	@($(LHEAD) $(LINT.c) $< $(LTAIL))
300
301$(LINTS_DIR)/%.ln:		$(UTSBASE)/common/io/%.c
302	@($(LHEAD) $(LINT.c) $< $(LTAIL))
303
304$(LINTS_DIR)/%.ln:		$(UTSBASE)/common/io/ppm/%.c
305	@($(LHEAD) $(LINT.c) $< $(LTAIL))
306
307$(LINTS_DIR)/%.ln:		$(UTSBASE)/common/os/%.c
308	@($(LHEAD) $(LINT.c) $< $(LTAIL))
309
310$(LINTS_DIR)/%.ln:		$(SRC)/common/dis/i386/%.c
311	@($(LHEAD) $(LINT.c) $< $(LTAIL))
312
313$(LINTS_DIR)/%.ln:		$(SRC)/common/atomic/%.c
314	@($(LHEAD) $(LINT.c) $< $(LTAIL))
315
316$(LINTS_DIR)/%.ln:		$(SRC)/common/mc/mc-amd/%.c
317	@($(LHEAD) $(LINT.c) $< $(LTAIL))
318
319$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/gfx_private/%.c
320	@($(LHEAD) $(LINT.c) $< $(LTAIL))
321
322$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/xsvc/%.c
323	@($(LHEAD) $(LINT.c) $< $(LTAIL))
324
325#
326# bios call has a funky name change while building
327#
328$(LINTS_DIR)/bios_call.ln:	$(UTSBASE)/i86pc/ml/bios_call_src.s
329	@($(LHEAD) $(LINT.s) $(UTSBASE)/i86pc/ml/bios_call_src.s  $(LTAIL))
330	@mv $(LINTS_DIR)/bios_call_src.ln $(LINTS_DIR)/bios_call.ln
331
332#
333# dboot always compiles in 32-bit mode, so force lint to be 32-bit mode too.
334#
335$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/dboot/%.c
336	@($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
337
338$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/dboot/%.s
339	@($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
340
341$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/boot/%.c
342	@($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
343
344$(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/util/%.c
345	@($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
346
347$(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/util/i386/%.s
348	@($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
349
350