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