xref: /titanic_52/usr/src/uts/i86pc/unix/Makefile (revision 74e20cfe817b82802b16fac8690dadcda76f54f5)
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# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25#ident	"%Z%%M%	%I%	%E% SMI"
26#
27#	This makefile drives the production of /unix (and unix.o).
28#
29#	i86pc implementation architecture dependent
30#
31
32#
33#	Path to the base of the uts directory tree (usually /usr/src/uts).
34#
35UTSBASE	= ../..
36
37#
38#	Define the module and object file sets.
39#
40UNIX		= unix
41
42OBJECTS		= $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
43		  $(CORE_OBJS:%=$(OBJS_DIR)/%) \
44		  $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
45
46LINTS		= $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
47		  $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
48		  $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
49		  $(LINTS_DIR)/vers.ln \
50		  $(LINTS_DIR)/modstubs.ln
51
52ROOTMODULE	= $(ROOT_PSM_KERN_DIR)/$(UNIX)
53
54UNIX_BIN	= $(OBJS_DIR)/$(UNIX)
55
56KRTLD_32	= misc/krtld
57KRTLD_64	= misc/$(SUBDIR64)/krtld
58KRTLD		= $(KRTLD_$(CLASS))
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
69#
70#	Include common rules.
71#
72include $(UTSBASE)/i86pc/Makefile.i86pc
73
74#
75#	Define targets
76#
77ALL_TARGET	= $(UNIX_BIN)
78LINT_TARGET	= $(LINT_LIB)
79INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE)
80
81#
82#	This is UNIX_DIR. Use a short path.
83#
84UNIX_DIR	= .
85
86#
87#	Overrides
88#
89CLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(OBJS_DIR)/vers.c \
90		   $(OBJS_DIR)/vers.o \
91		   $(DTRACESTUBS_O) $(DTRACESTUBS)
92
93CLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
94CLEANLINTFILES	+= $(LINT_LIB)
95
96# instr_size needs a special header
97$(OBJS_DIR)/instr_size.o :=	EXTRA_OPTIONS	= -I$(SRC)/common/dis/i386
98$(OBJS_DIR)/instr_size.ln :=	EXTRA_OPTIONS	= -I$(SRC)/common/dis/i386
99
100CFLAGS += -DDIS_MEM
101
102#
103# For now, disable these lint checks; maintainers should endeavor
104# to investigate and remove these for maximum lint coverage.
105# Please do not carry these forward to new Makefiles.
106#
107LINTTAGS	+= -erroff=E_BAD_PTR_CAST_ALIGN
108LINTTAGS	+= -erroff=E_SUSPICIOUS_COMPARISON
109LINTTAGS	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
110LINTTAGS	+= -erroff=E_STATIC_UNUSED
111LINTTAGS	+= -erroff=E_PTRDIFF_OVERFLOW
112LINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
113
114#
115#	Default build targets.
116#
117.KEEP_STATE:
118
119def: $(DEF_DEPS)
120
121all: $(ALL_DEPS)
122
123clean: $(CLEAN_DEPS)
124
125clobber: $(CLOBBER_DEPS)
126
127lint: $(LINT_DEPS)
128
129clean.lint: $(CLEAN_LINT_DEPS)
130
131install: $(INSTALL_DEPS)
132
133MAPFILE_32 = $(MAPFILE)
134MAPFILE_64 = $(MAPFILE).amd64
135
136MAPFILE_NAME = $(MAPFILE_$(CLASS))
137
138$(UNIX_BIN):	$(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \
139		$(GENLIB) $(DTRACESTUBS)
140	$(LD) -dy -b -o $@ -e _start -I $(KRTLD) -M $(MAPFILE_NAME) \
141	    $(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
142	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
143	$(POST_PROCESS)
144
145$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
146	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
147
148#
149#	Special rules for generating assym.h for inclusion in assembly files.
150#
151$(DSF_DIR)/$(OBJS_DIR)/assym.h:	FRC
152	@cd $(DSF_DIR); $(MAKE) all.targ
153
154$(GENLIB): FRC
155	@(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ)
156	@pwd
157
158#
159#	The global lint target builds the kernel lint library (llib-lunix.ln)
160#	which is equivalent to a lint of /unix.o. Then all kernel modules for
161#	this architecture are linted against the kernel lint library.
162#
163#	Note:	lint errors in the kernel lint library will be repeated for
164#		each module. It is important that the kernel lint library
165#		be clean to keep the textual output to a reasonable level.
166#
167
168$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
169	@-$(ECHO) "\n$(UNIX): (library construction):"
170	@$(LINT) -o$(UNIX) $(LINTFLAGS) $(LINTS)
171	@$(MV) $(@F) $@
172
173lintlib:	$(LINT_DEPS)
174
175#
176#	Include common targets.
177#
178include $(UTSBASE)/i86pc/Makefile.targ
179