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