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