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.
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.
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]
23 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
26 # This makefile drives the production of unix (and unix.o).
28 # i86pc implementation architecture dependent
32 # Path to the base of the uts directory tree (usually /usr/src/uts).
37 # Define the module and object file sets.
42 OBJECTS
= $(SPECIAL_OBJS
:%=$(OBJS_DIR
)/%) \
43 $(CORE_OBJS
:%=$(OBJS_DIR
)/%) \
44 $(KRTLD_OBJS
:%=$(OBJS_DIR
)/%) \
45 $(MACH_NOT_YET_KMODS
:%=$(OBJS_DIR
)/%)
47 LINTS
= $(SPECIAL_OBJS
:%.o
=$(LINTS_DIR
)/%.ln
) \
48 $(CORE_OBJS
:%.o
=$(LINTS_DIR
)/%.ln
) \
49 $(KRTLD_OBJS
:%.o
=$(LINTS_DIR
)/%.ln
) \
50 $(MACH_NOT_YET_KMODS
:%.o
=$(LINTS_DIR
)/%.ln
) \
51 $(LINTS_DIR
)/vers.ln \
52 $(LINTS_DIR
)/modstubs.ln
54 ROOTMODULE
= $(ROOT_PSM_KERN_DIR
)/$(UNIX
)
56 UNIX_BIN
= $(OBJS_DIR
)/$(UNIX
)
61 GENUNIX_DIR
= ..
/..
/intel
/$(GENUNIX
)
63 LIBOPTS
= -L
$(GENUNIX_DIR
)/$(OBJS_DIR
) -l
$(GENUNIX
)
65 COMMP_CTF_SRC
= $(OBJS_DIR
)/comm_page_ctf.c
67 CTFEXTRAOBJS
= $(OBJS_DIR
)/vers.o
$(OBJS_DIR
)/comm_page_ctf.o
69 DBOOT_OBJS_DIR
= dboot
/$(OBJS_DIR
)
70 DBOOT_OBJECTS
= $(DBOOT_OBJS
:%=$(DBOOT_OBJS_DIR
)/%)
71 DBOOT_BIN
= $(DBOOT_OBJS_DIR
)/$(DBOOT
)
72 DBOOT_O
= $(OBJS_DIR
)/$(DBOOT
).o
73 DBOOT_S
= $(DBOOT_O
:%.o
=%.s
)
74 DBOOT_LINTS
= $(DBOOT_OBJS
:%.o
=$(DBOOT_OBJS_DIR
)/%.ln
)
75 DBOOT_LINT
= $(i386_LINT
)
76 DBOOT_LINTTAGS
= -erroff
=E_STATIC_UNUSED
79 # Include common rules.
81 include $(UTSBASE
)/i86pc
/Makefile.i86pc
86 ALL_TARGET
= $(UNIX_BIN
)
87 LINT_TARGET
= $(LINT_LIB
) $(DBOOT_LINT_LIB
)
88 INSTALL_TARGET
= $(UNIX_BIN
) $(ROOTMODULE
)
91 # This is UNIX_DIR. Use a short path.
99 $(UNIX_O
) $(MODSTUBS_O
) \
101 $(OBJS_DIR
)/dtracestubs.s \
102 $(DTRACESTUBS_O
) $(DTRACESTUBS
) \
107 $(DBOOT_O
) $(DBOOT_S
) \
109 $(OBJS_DIR
)/bios_call_src.o \
110 $(OBJS_DIR
)/bios_call_src \
111 $(OBJS_DIR
)/bios_call.s \
115 $(DBOOT_OBJS_DIR
)/$(VGATEXT_FONT
).c \
116 $(OBJS_DIR
)/$(VGATEXT_FONT
).c
119 $(OBJS_DIR
)/fb_swtch_src.o \
120 $(OBJS_DIR
)/fb_swtch_src \
121 $(OBJS_DIR
)/fb_swtch.s
124 $(ZLIB_OBJS
:%.o
=$(OBJS_DIR
)/%.o
) \
125 $(ZLIB_OBJS
:%.o
=$(OBJS_DIR
)/%.ln
)
127 CLOBBERFILES
= $(CLEANFILES
) $(UNIX_BIN
)
128 CLEANLINTFILES
+= $(LINT_LIB
) $(DBOOT_LINT_LIB
) $(DBOOT_LINTS
)
130 # instr_size needs a special header
131 $(OBJS_DIR
)/instr_size.o
:= EXTRA_OPTIONS
= -I
$(SRC
)/common
/dis
/i386
132 $(OBJS_DIR
)/instr_size.ln
:= EXTRA_OPTIONS
= -I
$(SRC
)/common
/dis
/i386
135 # When performing shadow studio builds, the pre-processed comm page
136 # output from gcc can end up confusing studio.
138 $(OBJS_DIR
)/comm_page_ctf.o
:= CERRWARN
+= -_cc
=-erroff
=E_TKNS_IGNORED_AT_END_OF_DIR
143 # For now, disable these lint checks; maintainers should endeavor
144 # to investigate and remove these for maximum lint coverage.
145 # Please do not carry these forward to new Makefiles.
147 LINTTAGS
+= -erroff
=E_BAD_PTR_CAST_ALIGN
148 LINTTAGS
+= -erroff
=E_SUSPICIOUS_COMPARISON
149 LINTTAGS
+= -erroff
=E_SUPPRESSION_DIRECTIVE_UNUSED
150 LINTTAGS
+= -erroff
=E_STATIC_UNUSED
151 LINTTAGS
+= -erroff
=E_PTRDIFF_OVERFLOW
152 LINTTAGS
+= -erroff
=E_ASSIGN_NARROW_CONV
154 CERRWARN
+= -_gcc
=-Wno-parentheses
155 CERRWARN
+= -_gcc
=-Wno-uninitialized
156 CERRWARN
+= -_gcc
=-Wno-char-subscripts
157 CERRWARN
+= -_gcc
=-Wno-unused-variable
158 CERRWARN
+= -_gcc
=-Wno-unused-function
159 CERRWARN
+= -_gcc
=-Wno-unused-label
160 CERRWARN
+= -_gcc
=-Wno-type-limits
161 CERRWARN
+= -_gcc
=-Wno-clobbered
162 CERRWARN
+= -_gcc
=-Wno-empty-body
163 CERRWARN
+= -_gcc
=-Wno-unused-value
165 # Ensure that lint sees 'struct cpu' containing a fully declared
166 # embedded 'struct machcpu'
168 LINTFLAGS
+= -D_MACHDEP
-I..
/..
/i86pc
171 # Default build targets.
181 clobber: $(CLOBBER_DEPS
)
185 clean.lint
: $(CLEAN_LINT_DEPS
)
187 install: $(INSTALL_DEPS
)
189 MAPFILE_32
= $(MAPFILE
)
190 MAPFILE_64
= $(MAPFILE
).amd64
192 MAPFILE_NAME
= $(MAPFILE_
$(CLASS
))
194 $(UNIX_BIN
): $(UNIX_O
) $(MODSTUBS_O
) $(MAPFILE_NAME
) \
195 $(GENLIB
) $(DTRACESTUBS
) $(DBOOT_O
)
196 $(LD
) -dy
-b
-o
$@
-e dboot_image
-znointerp
-M
$(MAPFILE_NAME
) \
197 $(UNIX_O
) $(DBOOT_O
) $(MODSTUBS_O
) $(LIBOPTS
) \
199 $(MBH_PATCH
) $(UNIX_BIN
)
200 $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX
)
203 $(UNIX_O
): $(OBJECTS
) $(CTFEXTRAOBJS
)
204 $(LD
) -r
-o
$@
$(OBJECTS
) $(OBJS_DIR
)/vers.o
206 $(DBOOT_BIN
): $(DBOOT_OBJS_DIR
) $(DBOOT_OBJECTS
) dboot
/Mapfile.dboot
207 $(LD
) -dn
-e _start
-M dboot
/Mapfile.dboot \
208 -o
$(DBOOT_BIN
) $(DBOOT_OBJECTS
)
210 $(DBOOT_O
): $(DBOOT_BIN
)
211 @echo
" .data" > $(DBOOT_S
)
212 @echo
" .globl dboot_image" >> $(DBOOT_S
)
213 @echo
"dboot_image:" >> $(DBOOT_S
)
214 $(ELFEXTRACT
) $(DBOOT_BIN
) >> $(DBOOT_S
)
215 $(COMPILE.s
) -o
$(DBOOT_O
) $(DBOOT_S
)
218 -@mkdir
-p
$@
2> /dev
/null
220 $(COMMP_CTF_SRC
): $(UTSBASE
)/i86pc
/ml
/comm_page.s
221 $(COMPILE.
cpp) -D_GENCTF
-o
$@
$(UTSBASE
)/i86pc
/ml
/comm_page.s
223 $(OBJS_DIR
)/comm_page_ctf.o
: $(COMMP_CTF_SRC
)
224 $(COMPILE.c
) -o
$@
$<
228 # Special rules for generating assym.h for inclusion in assembly files.
230 $(DSF_DIR
)/$(OBJS_DIR
)/assym.h
$(DSF_DIR
)/$(OBJS_DIR
)/kdi_assym.h
: FRC
231 @cd
$(DSF_DIR
); $(MAKE
) all.targ
234 # The global lint target builds the kernel lint library (llib-lunix.ln)
235 # which is equivalent to a lint of /unix.o. Then all kernel modules for
236 # this architecture are linted against the kernel lint library.
238 # Note: lint errors in the kernel lint library will be repeated for
239 # each module. It is important that the kernel lint library
240 # be clean to keep the textual output to a reasonable level.
243 $(LINT_LIB
): $(LINT_LIB_DIR
) $(LINTS
)
245 @
-$(ECHO
) "\n$(UNIX): (library construction):"
246 @
$(LINT
) -o
$(UNIX
) $(LINTFLAGS
) $(LINTS
)
249 $(DBOOT_LINT_LIB
): $(LINT_LIB_DIR
) $(DBOOT_LINTS
)
251 @
-$(ECHO
) "\n$(DBOOT): (library construction):"
252 @
$(LINT
) -o
$(DBOOT
) $(DBOOT_LINTFLAGS
) $(DBOOT_LINTS
)
255 lintlib
: $(LINT_DEPS
)
258 # Include common targets.
260 include $(UTSBASE
)/i86pc
/Makefile.targ