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