Makefile revision 6094:3154969ecb41
1226031Sstas#
2226031Sstas# CDDL HEADER START
3226031Sstas#
4226031Sstas# The contents of this file are subject to the terms of the
5226031Sstas# Common Development and Distribution License (the "License").
6226031Sstas# You may not use this file except in compliance with the License.
7226031Sstas#
8226031Sstas# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9226031Sstas# or http://www.opensolaris.org/os/licensing.
10226031Sstas# See the License for the specific language governing permissions
11226031Sstas# and limitations under the License.
12226031Sstas#
13226031Sstas# When distributing Covered Code, include this CDDL HEADER in each
14226031Sstas# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15226031Sstas# If applicable, add the following below this CDDL HEADER, with the
16226031Sstas# fields enclosed by brackets "[]" replaced with your own identifying
17226031Sstas# information: Portions Copyright [yyyy] [name of copyright owner]
18226031Sstas#
19226031Sstas# CDDL HEADER END
20226031Sstas#
21226031Sstas
22226031Sstas#
23226031Sstas# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24226031Sstas# Use is subject to license terms.
25226031Sstas#
26226031Sstas# ident	"%Z%%M%	%I%	%E% SMI"
27226031Sstas#
28226031Sstas
29226031Sstas#
30226031Sstas#	This makefile drives the production of unix (and unix.o).
31226031Sstas#
32226031Sstas#	sun4u starfire implementation architecture dependent
33226031Sstas#
34226031Sstas
35226031Sstas#
36226031Sstas#	Path to the base of the uts directory tree (usually /usr/src/uts).
37226031Sstas#
38226031SstasUTSBASE	= ../../..
39226031Sstas
40226031Sstas#
41226031Sstas#	Define the module and object file sets.
42226031Sstas#
43226031SstasUNIX		= unix
44226031SstasOBJECTS		= $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
45226031Sstas		  $(CORE_OBJS:%=$(OBJS_DIR)/%) \
46226031Sstas		  $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
47226031SstasLINTS		= $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
48226031Sstas		  $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
49226031Sstas		  $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
50226031Sstas		  $(LINTS_DIR)/vers.ln \
51226031Sstas		  $(LINTS_DIR)/modstubs.ln
52226031Sstas
53226031SstasKRTLD_MAPFILE	= $(UTSBASE)/sparc/krtld/mapfile
54226031SstasKRTLD_OBJECTS	= $(KRTLD_OBJS:%=$(OBJS_DIR)/%)
55226031SstasKRTLD_O		= $(OBJS_DIR)/krtld.o
56226031Sstas
57226031SstasROOTMODULE	= $(ROOT_STARFIRE_KERN_DIR)/$(UNIX)
58226031SstasUNIX32_LINK	= $(ROOT_STARFIRE_KERN_DIR_32)/$(UNIX)
59226031SstasUNIX_BIN	= $(OBJS_DIR)/$(UNIX)
60226031Sstas
61226031SstasLIBS		= $(GENLIB) $(PLATLIB) $(CPULIB)
62226031Sstas
63226031SstasGENUNIX		= genunix
64226031SstasGENUNIX_DIR	= ../../$(GENUNIX)
65226031SstasGENOPTS		= -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
66226031Sstas
67226031SstasCPU_DIR		= .
68226031SstasCPUOPTS		= -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME)
69226031Sstas
70226031SstasPLAT_DIR	= ../../platmod
71226031SstasPLATOPTS	= -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD)
72226031Sstas
73226031SstasLIBOPTS		= $(GENOPTS) $(PLATOPTS) $(CPUOPTS)
74226031Sstas
75226031SstasCTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
76226031Sstas
77226031Sstas#
78226031Sstas#	Include common rules.
79226031Sstas#
80226031Sstasinclude $(UTSBASE)/sun4u/starfire/Makefile.starfire
81226031Sstas
82226031Sstas#
83226031Sstas#	Define targets
84226031Sstas#
85226031SstasALL_TARGET	= $(UNIX_BIN)
86226031SstasLINT_TARGET	= $(LINT_LIB)
87226031SstasINSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK)
88226031Sstas
89226031Sstas#
90226031Sstas#	This is UNIX_DIR. Use a short path.
91226031Sstas#
92226031SstasUNIX_DIR	= .
93226031Sstas
94226031Sstas#
95226031Sstas#	Overrides
96226031Sstas#
97226031SstasCLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(KRTLD_O) $(KRTLD_OBJECTS) \
98226031Sstas		   $(OBJS_DIR)/vers.c  $(OBJS_DIR)/vers.o \
99226031Sstas		   $(CPU_OBJ) $(CPULIB) \
100226031Sstas		   $(DTRACESTUBS_O) $(DTRACESTUBS)
101226031Sstas
102226031SstasCLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
103226031SstasCLEANLINTFILES	+= $(LINT_LIB)
104226031Sstas
105226031Sstas#
106226031Sstas# lint pass one enforcement 
107226031Sstas# Turn on doubleword alignment for 64 bit counter timer registers
108226031Sstas#
109226031SstasCFLAGS += $(CCVERBOSE) -dalign
110226031Sstas
111226031Sstas#
112226031Sstas#	Default build targets.
113226031Sstas#
114226031Sstas.KEEP_STATE:
115226031Sstas
116226031Sstasdef:		$(DEF_DEPS)
117226031Sstas
118226031Sstasall:		$(ALL_DEPS)
119226031Sstas
120226031Sstasclean:		$(CLEAN_DEPS)
121226031Sstas
122226031Sstasclobber:	$(CLOBBER_DEPS)
123226031Sstas
124226031Sstaslint:		$(LINT_DEPS)
125226031Sstas
126226031Sstasclean.lint:	$(CLEAN_LINT_DEPS)
127226031Sstas
128226031Sstasinstall:  	$(INSTALL_DEPS)
129226031Sstas
130226031Sstas$(UNIX_BIN):	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) \
131226031Sstas		$(DTRACESTUBS) 
132226031Sstas	$(LD) -dy -b -o $@ -e _start -M $(MAPFILE) \
133226031Sstas	    $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 
134226031Sstas	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
135226031Sstas	$(POST_PROCESS)
136226031Sstas
137226031Sstas$(UNIX32_LINK):	$(ROOT_PSM_KERN_DIR_32) $(UNIX_BIN)
138226031Sstas	-$(RM) $@; ln -s $(SUBDIR64)/$(UNIX) $@
139226031Sstas
140226031Sstassymcheck:	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBS)
141226031Sstas	$(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
142226031Sstas	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 
143226031Sstas
144226031Sstas$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
145226031Sstas	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
146226031Sstas
147226031Sstas$(KRTLD_O):	$(KRTLD_OBJECTS)
148226031Sstas	$(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS)
149226031Sstas
150226031Sstas#
151226031Sstas#	CPU_OBJ now comprises of 2 object files which come from sun4 common
152226031Sstas#	and from architecture dependent code.  OBJS_DIR is prepended where
153226031Sstas#	CPU_OBJ is defined to allow for building multiple CPU_OBJ's
154226031Sstas#
155226031Sstas$(CPULIB):	$(CPU_OBJ)
156226031Sstas	$(BUILD.SO) $(CPU_OBJ)
157226031Sstas
158226031Sstas#
159226031Sstas#	The global lint target builds the kernel lint library (llib-lunix.ln)
160226031Sstas#	which is equivalent to a lint of /unix.o. Then all kernel modules for
161226031Sstas#	this architecture are linted against the kernel lint library.
162226031Sstas#
163226031Sstas#	Note:	lint errors in the kernel lint library will be repeated for
164226031Sstas#		each module. It is important that the kernel lint library
165226031Sstas#		be clean to keep the textual output to a reasonable level.
166226031Sstas#
167226031Sstas
168226031Sstas$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
169226031Sstas	@-$(ECHO) "\n$(UNIX): (library construction):"
170226031Sstas	@$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS)
171226031Sstas	@$(MV) $(@F) $@
172226031Sstas
173226031Sstaslintlib:	$(LINT_DEPS)
174226031Sstas
175226031Sstas#
176226031Sstas#	Include common targets.
177226031Sstas#
178226031Sstasinclude $(UTSBASE)/sun4u/starfire/Makefile.targ
179226031Sstas