xref: /titanic_50/usr/src/uts/i86pc/unix/Makefile (revision 0e42dee69ed771bf604dd1789fca9d77b5bbe302)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26#pragma ident	"%Z%%M%	%I%	%E% SMI"
27#
28#	This makefile drives the production of /unix (and unix.o).
29#
30#	i86pc 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
42
43OBJECTS		= $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
44		  $(CORE_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		  $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
50		  $(LINTS_DIR)/vers.ln \
51		  $(LINTS_DIR)/modstubs.ln
52
53ROOTMODULE	= $(ROOT_PSM_KERN_DIR)/$(UNIX)
54
55UNIX_BIN	= $(OBJS_DIR)/$(UNIX)
56
57KRTLD_32	= misc/krtld
58KRTLD_64	= misc/$(SUBDIR64)/krtld
59KRTLD		= $(KRTLD_$(CLASS))
60
61LIBS		= $(GENLIB)
62
63GENUNIX		= genunix
64GENUNIX_DIR	= ../../intel/$(GENUNIX)
65
66LIBOPTS		= -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
67
68CTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
69
70#
71#	Include common rules.
72#
73include $(UTSBASE)/i86pc/Makefile.i86pc
74
75#
76#	Define targets
77#
78ALL_TARGET	= $(UNIX_BIN)
79LINT_TARGET	= $(LINT_LIB)
80INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE)
81
82#
83#	This is UNIX_DIR. Use a short path.
84#
85UNIX_DIR	= .
86
87#
88#	Overrides
89#
90CLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(OBJS_DIR)/vers.c \
91		   $(OBJS_DIR)/vers.o \
92		   $(DTRACESTUBS_O) $(DTRACESTUBS)
93
94CLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
95CLEANLINTFILES	+= $(LINT_LIB)
96
97# instr_size needs a special header
98$(OBJS_DIR)/instr_size.o :=	EXTRA_OPTIONS	= -I$(SRC)/common/dis/i386
99$(OBJS_DIR)/instr_size.ln :=	EXTRA_OPTIONS	= -I$(SRC)/common/dis/i386
100
101CFLAGS += -DDIS_MEM
102
103#
104#	Default build targets.
105#
106.KEEP_STATE:
107
108def: $(DEF_DEPS)
109
110all: $(ALL_DEPS)
111
112clean: $(CLEAN_DEPS)
113
114clobber: $(CLOBBER_DEPS)
115
116lint: $(LINT_DEPS)
117
118clean.lint: $(CLEAN_LINT_DEPS)
119
120install: $(INSTALL_DEPS)
121
122MAPFILE_32 = $(MAPFILE)
123MAPFILE_64 = $(MAPFILE).amd64
124
125MAPFILE_NAME = $(MAPFILE_$(CLASS))
126
127$(UNIX_BIN):	$(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \
128		$(GENLIB) $(DTRACESTUBS)
129	$(LD) -dy -b -o $@ -e _start -I $(KRTLD) -M $(MAPFILE_NAME) \
130	    $(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
131	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
132	$(POST_PROCESS)
133
134$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
135	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
136
137#
138#	Special rules for generating assym.h for inclusion in assembly files.
139#
140$(DSF_DIR)/$(OBJS_DIR)/assym.h:	FRC
141	@cd $(DSF_DIR); $(MAKE) all.targ
142
143$(GENLIB): FRC
144	@(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ)
145	@pwd
146
147#
148#	The global lint target builds the kernel lint library (llib-lunix.ln)
149#	which is equivalent to a lint of /unix.o. Then all kernel modules for
150#	this architecture are linted against the kernel lint library.
151#
152#	Note:	lint errors in the kernel lint library will be repeated for
153#		each module. It is important that the kernel lint library
154#		be clean to keep the textual output to a reasonable level.
155#
156
157$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
158	@-$(ECHO) "\n$(UNIX): (library construction):"
159	@$(LINT) -o$(UNIX) $(LINTFLAGS) $(LINTS)
160	@$(MV) $(@F) $@
161
162lintlib:	$(LINT_DEPS)
163
164#
165#	Include common targets.
166#
167include $(UTSBASE)/i86pc/Makefile.targ
168