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