xref: /titanic_51/usr/src/uts/i86xpv/unix/Makefile (revision bbaa8b60dd95d714741fc474adad3cf710ef4efd)
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#	This makefile drives the production of unix (and unix.o).
27#
28#	i86xpv implementation architecture dependent
29#
30
31#
32#	Path to the base of the uts directory tree (usually /usr/src/uts).
33#
34UTSBASE	= ../..
35
36#
37#	Define the module and object file sets.
38#
39UNIX		= unix
40DBOOT		= dboot
41
42OBJECTS		= $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
43		  $(CORE_OBJS:%=$(OBJS_DIR)/%) \
44		  $(KRTLD_OBJS:%=$(OBJS_DIR)/%) \
45		  $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
46
47LINTS		= $(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
53
54ROOTMODULE	= $(ROOT_PSM_KERN_DIR)/$(UNIX)
55
56UNIX_BIN	= $(OBJS_DIR)/$(UNIX)
57
58LIBS		= $(GENLIB)
59
60GENUNIX		= genunix
61GENUNIX_DIR	= ../../intel/$(GENUNIX)
62
63LIBOPTS		= -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
64
65CTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
66
67DBOOT_OBJS_DIR	= dboot/$(OBJS_DIR)
68DBOOT_OBJECTS	= $(DBOOT_OBJS:%=$(DBOOT_OBJS_DIR)/%)
69DBOOT_BIN	= $(DBOOT_OBJS_DIR)/$(DBOOT)
70DBOOT_O		= $(OBJS_DIR)/$(DBOOT).o
71DBOOT_S		= $(DBOOT_O:%.o=%.s)
72DBOOT_LINTS	= $(DBOOT_OBJS:%.o=$(DBOOT_OBJS_DIR)/%.ln)
73DBOOT_LINT	= $(LINT_$(MACH)_$(CLASS))
74
75#
76#	Include common rules.
77#
78include $(UTSBASE)/i86xpv/Makefile.i86xpv
79
80#
81#	Define targets
82#
83ALL_TARGET	= $(UNIX_BIN)
84LINT_TARGET	= $(LINT_LIB) $(DBOOT_LINT_LIB)
85INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE)
86
87#
88#	This is UNIX_DIR. Use a short path.
89#
90UNIX_DIR	= .
91
92#
93#	Overrides
94#
95CLEANFILES	+=		\
96	$(UNIX_O) $(MODSTUBS_O)	\
97	$(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \
98	$(DTRACESTUBS_O) $(DTRACESTUBS)
99
100CLEANFILES	+=		\
101	$(DBOOT_O) $(DBOOT_S)	\
102	$(DBOOT_OBJECTS)	\
103	$(DBOOT_BIN)
104
105CLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
106CLEANLINTFILES	+= $(LINT_LIB) $(DBOOT_LINT_LIB) $(DBOOT_LINTS)
107
108# instr_size needs a special header
109$(OBJS_DIR)/instr_size.o :=	EXTRA_OPTIONS	= -I$(SRC)/common/dis/i386
110$(OBJS_DIR)/instr_size.ln :=	EXTRA_OPTIONS	= -I$(SRC)/common/dis/i386
111
112CFLAGS += -DDIS_MEM
113
114#
115# For now, disable these lint checks; maintainers should endeavor
116# to investigate and remove these for maximum lint coverage.
117# Please do not carry these forward to new Makefiles.
118#
119LINTTAGS	+= -erroff=E_BAD_PTR_CAST_ALIGN
120LINTTAGS	+= -erroff=E_SUSPICIOUS_COMPARISON
121LINTTAGS	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
122LINTTAGS	+= -erroff=E_STATIC_UNUSED
123LINTTAGS	+= -erroff=E_PTRDIFF_OVERFLOW
124LINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
125
126CERRWARN	+= -_gcc=-Wno-parentheses
127CERRWARN	+= -_gcc=-Wno-uninitialized
128CERRWARN	+= -_gcc=-Wno-char-subscripts
129CERRWARN	+= -_gcc=-Wno-unused-variable
130CERRWARN	+= -_gcc=-Wno-unused-function
131CERRWARN	+= -_gcc=-Wno-unused-label
132CERRWARN	+= -_gcc=-Wno-type-limits
133CERRWARN	+= -_gcc=-Wno-clobbered
134CERRWARN	+= -_gcc=-Wno-unused-value
135CERRWARN	+= -_gcc=-Wno-empty-body
136
137# Ensure that lint sees 'struct cpu' containing a fully declared
138# embedded 'struct machcpu'
139#
140LINTFLAGS	+= -D_MACHDEP -I../../i86pc
141
142#
143#	Default build targets.
144#
145.KEEP_STATE:
146
147def: $(DEF_DEPS)
148
149all: $(ALL_DEPS)
150
151clean: $(CLEAN_DEPS)
152
153clobber: $(CLOBBER_DEPS)
154
155lint: $(LINT_DEPS)
156
157clean.lint: $(CLEAN_LINT_DEPS)
158
159install: $(INSTALL_DEPS)
160
161MAPFILE_32 = $(MAPFILE)
162MAPFILE_64 = $(MAPFILE).amd64
163
164MAPFILE_NAME = $(MAPFILE_$(CLASS))
165
166$(UNIX_BIN):	$(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \
167		$(GENLIB) $(DTRACESTUBS) $(DBOOT_O)
168	$(LD) -dy -b -o $@ -e dboot_image -znointerp -M $(MAPFILE_NAME) \
169	    $(UNIX_O) $(DBOOT_O) $(MODSTUBS_O) $(LIBOPTS) \
170	    $(DTRACESTUBS)
171	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
172	$(POST_PROCESS)
173
174$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
175	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
176
177$(DBOOT_BIN):	$(DBOOT_OBJS_DIR) $(DBOOT_OBJECTS) dboot/Mapfile.dboot
178	$(LD) -dn -e _start -M dboot/Mapfile.dboot \
179		-o $(DBOOT_BIN) $(DBOOT_OBJECTS)
180
181$(DBOOT_O):	$(DBOOT_BIN)
182	@echo "	.data"					> $(DBOOT_S)
183	@echo "	.globl	dboot_image"			>> $(DBOOT_S)
184	@echo "dboot_image:"				>> $(DBOOT_S)
185	$(ELFEXTRACT) $(DBOOT_BIN)			>> $(DBOOT_S)
186	$(COMPILE.s) -o $(DBOOT_O) $(DBOOT_S)
187
188$(DBOOT_OBJS_DIR):
189	-@mkdir -p $@ 2> /dev/null
190
191#
192#	Special rules for generating assym.h for inclusion in assembly files.
193#
194$(DSF_DIR)/$(OBJS_DIR)/assym.h $(DSF_DIR)/$(OBJS_DIR)/kdi_assym.h:	FRC
195	@cd $(DSF_DIR); $(MAKE) all.targ
196
197#
198#	The global lint target builds the kernel lint library (llib-lunix.ln)
199#	which is equivalent to a lint of /unix.o. Then all kernel modules for
200#	this architecture are linted against the kernel lint library.
201#
202#	Note:	lint errors in the kernel lint library will be repeated for
203#		each module. It is important that the kernel lint library
204#		be clean to keep the textual output to a reasonable level.
205#
206
207$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
208	@pwd
209	@-$(ECHO) "\n$(UNIX): (library construction):"
210	@$(LINT) -o$(UNIX) $(LINTFLAGS) $(LINTS)
211	@$(MV) $(@F) $@
212
213$(DBOOT_LINT_LIB):	$(LINT_LIB_DIR) $(DBOOT_LINTS)
214	@pwd
215	@-$(ECHO) "\n$(DBOOT): (library construction):"
216	@$(LINT) -o$(DBOOT) $(DBOOT_LINTFLAGS) $(DBOOT_LINTS)
217	@$(MV) $(@F) $@
218
219lintlib:	$(LINT_DEPS)
220
221#
222#	Include common targets.
223#
224include $(UTSBASE)/i86xpv/Makefile.targ
225