Makefile revision 9507:e6271d3ec9f2
1757Sdg#
2757Sdg# CDDL HEADER START
3757Sdg#
4757Sdg# The contents of this file are subject to the terms of the
5757Sdg# Common Development and Distribution License (the "License").
6757Sdg# You may not use this file except in compliance with the License.
7757Sdg#
8757Sdg# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9757Sdg# or http://www.opensolaris.org/os/licensing.
10757Sdg# See the License for the specific language governing permissions
11757Sdg# and limitations under the License.
12757Sdg#
13757Sdg# When distributing Covered Code, include this CDDL HEADER in each
14757Sdg# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15757Sdg# If applicable, add the following below this CDDL HEADER, with the
16757Sdg# fields enclosed by brackets "[]" replaced with your own identifying
17757Sdg# information: Portions Copyright [yyyy] [name of copyright owner]
18757Sdg#
19757Sdg# CDDL HEADER END
20757Sdg#
21757Sdg
22757Sdg#
23757Sdg# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24757Sdg# Use is subject to license terms.
25757Sdg#
26757Sdg
27757Sdg#
28757Sdg#	This makefile drives the production of unix (and unix.o).
2950477Speter#
30757Sdg#	sun4u starfire implementation architecture dependent
31757Sdg#
3271257Speter
33757Sdg#
3418207Sbde#	Path to the base of the uts directory tree (usually /usr/src/uts).
3518207Sbde#
36121983SjhbUTSBASE	= ../../..
3721979Sbde
3818207Sbde#
3918207Sbde#	Define the module and object file sets.
4018207Sbde#
4118207SbdeUNIX		= unix
42757SdgOBJECTS		= $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
43757Sdg		  $(CORE_OBJS:%=$(OBJS_DIR)/%) \
4413085Sdg		  $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
4573011SjakeLINTS		= $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
4673011Sjake		  $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
4773011Sjake		  $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
48113090Sdes		  $(LINTS_DIR)/vers.ln \
49113090Sdes		  $(LINTS_DIR)/modstubs.ln
5073011Sjake
5173011SjakeKRTLD_MAPFILE	= $(UTSBASE)/sparc/krtld/mapfile
5273011SjakeKRTLD_OBJECTS	= $(KRTLD_OBJS:%=$(OBJS_DIR)/%)
5373011SjakeKRTLD_O		= $(OBJS_DIR)/krtld.o
5473011Sjake
5573011SjakeROOTMODULE	= $(ROOT_STARFIRE_KERN_DIR)/$(UNIX)
5673011SjakeUNIX32_LINK	= $(ROOT_STARFIRE_KERN_DIR_32)/$(UNIX)
5771257SpeterUNIX_BIN	= $(OBJS_DIR)/$(UNIX)
5818835Sbde
5918835SbdeLIBS		= $(GENLIB) $(PLATLIB) $(CPULIB)
6018835Sbde
6123409SbdeGENUNIX		= genunix
62121983SjhbGENUNIX_DIR	= ../../$(GENUNIX)
63121983SjhbGENOPTS		= -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
64121983Sjhb
65121983SjhbCPU_DIR		= .
66121983SjhbCPUOPTS		= -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME)
6713085Sdg
68121983SjhbPLAT_DIR	= ../../platmod
69121983SjhbPLATOPTS	= -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD)
70121983Sjhb
71121983SjhbLIBOPTS		= $(GENOPTS) $(PLATOPTS) $(CPUOPTS)
72121983Sjhb
7313085SdgCTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
7413085Sdg
75757Sdg#
76757Sdg#	Include common rules.
7718428Sbde#
781247Sdginclude $(UTSBASE)/sun4u/starfire/Makefile.starfire
791703Sdg
80113090Sdes#
81113090Sdes#	Define targets
82113090Sdes#
83113090SdesALL_TARGET	= $(UNIX_BIN)
8413085SdgLINT_TARGET	= $(LINT_LIB)
85757SdgINSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK)
86757Sdg
87757Sdg#
88757Sdg#	This is UNIX_DIR. Use a short path.
89757Sdg#
90757SdgUNIX_DIR	= .
91757Sdg
92757Sdg#
93757Sdg#	Overrides
94757Sdg#
95757SdgCLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(KRTLD_O) $(KRTLD_OBJECTS) \
96757Sdg		   $(OBJS_DIR)/vers.c  $(OBJS_DIR)/vers.o \
97757Sdg		   $(CPU_OBJ) $(CPULIB) \
98757Sdg		   $(DTRACESTUBS_O) $(DTRACESTUBS)
991703Sdg
10071098SpeterCLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
10113085SdgCLEANLINTFILES	+= $(LINT_LIB)
1021247Sdg
1031247Sdg#
1041247Sdg# lint pass one enforcement 
10516029Speter# Turn on doubleword alignment for 64 bit counter timer registers
10616029Speter#
10716029SpeterCFLAGS += $(CCVERBOSE) -dalign
10816029Speter
10916029Speter#
1101247Sdg#	Default build targets.
1111247Sdg#
1121247Sdg.KEEP_STATE:
1131247Sdg
1141247Sdgdef:		$(DEF_DEPS)
1151247Sdg
1161247Sdgall:		$(ALL_DEPS)
1171247Sdg
1181247Sdgclean:		$(CLEAN_DEPS)
1191247Sdg
1201247Sdgclobber:	$(CLOBBER_DEPS)
1211247Sdg
1221247Sdglint:		$(LINT_DEPS)
1231247Sdg
1241247Sdgclean.lint:	$(CLEAN_LINT_DEPS)
1251247Sdg
1261247Sdginstall:  	$(INSTALL_DEPS)
1271247Sdg
1281247Sdg$(UNIX_BIN):	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) \
1291247Sdg		$(DTRACESTUBS) 
1301247Sdg	$(LD) -dy -b -o $@ -e _start -M $(MAPFILE) \
1311247Sdg	    $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 
1321247Sdg	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
1331703Sdg	$(POST_PROCESS)
13416029Speter	$(CHK4UBINARY)
13516029Speter
13616029Speter$(UNIX32_LINK):	$(ROOT_PSM_KERN_DIR_32) $(UNIX_BIN)
1371703Sdg	-$(RM) $@; ln -s $(SUBDIR64)/$(UNIX) $@
1381247Sdg
1391247Sdgsymcheck:	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBS)
1401247Sdg	$(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
1411247Sdg	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 
1421247Sdg
1431247Sdg$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
1441247Sdg	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
1451247Sdg
1461247Sdg$(KRTLD_O):	$(KRTLD_OBJECTS)
1471247Sdg	$(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS)
1481247Sdg
1491703Sdg#
15016029Speter#	CPU_OBJ now comprises of 2 object files which come from sun4 common
15116029Speter#	and from architecture dependent code.  OBJS_DIR is prepended where
15216029Speter#	CPU_OBJ is defined to allow for building multiple CPU_OBJ's
1531703Sdg#
1541703Sdg$(CPULIB):	$(CPU_OBJ)
1551703Sdg	$(BUILD.SO) $(CPU_OBJ)
1561247Sdg
1571247Sdg#
1581247Sdg#	The global lint target builds the kernel lint library (llib-lunix.ln)
1591247Sdg#	which is equivalent to a lint of /unix.o. Then all kernel modules for
1601247Sdg#	this architecture are linted against the kernel lint library.
1611247Sdg#
1621703Sdg#	Note:	lint errors in the kernel lint library will be repeated for
16316029Speter#		each module. It is important that the kernel lint library
16416029Speter#		be clean to keep the textual output to a reasonable level.
16516029Speter#
16616029Speter
16716029Speter$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
16816029Speter	@-$(ECHO) "\n$(UNIX): (library construction):"
16918428Sbde	@$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS)
1701703Sdg	@$(MV) $(@F) $@
1711703Sdg
1721247Sdglintlib:	$(LINT_DEPS)
1731247Sdg
1741247Sdg#
175757Sdg#	Include common targets.
17618428Sbde#
1771703Sdginclude $(UTSBASE)/sun4u/starfire/Makefile.targ
1781703Sdg