xref: /titanic_51/usr/src/uts/sun4u/starcat/unix/Makefile (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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#ident	"%Z%%M%	%I%	%E% SMI"
27#
28#	This makefile drives the production of unix (and unix.o).
29#
30#	sun4u starcat 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
42OBJECTS		= $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
43		  $(CORE_OBJS:%=$(OBJS_DIR)/%) \
44		  $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
45LINTS		= $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
46		  $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
47		  $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
48		  $(LINTS_DIR)/vers.ln \
49		  $(LINTS_DIR)/modstubs.ln
50ROOTMODULE	= $(ROOT_STARCAT_KERN_DIR)/$(UNIX)
51UNIX_BIN	= $(OBJS_DIR)/$(UNIX)
52
53KRTLD_32	= misc/krtld
54KRTLD_64	= misc/$(SUBDIR64)/krtld
55KRTLD		= $(KRTLD_$(CLASS))
56
57LIBS		= $(GENLIB) $(PLATLIB) $(CPULIB)
58
59GENUNIX		= genunix
60GENUNIX_DIR	= ../../$(GENUNIX)
61GENOPTS		= -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
62
63CPU_DIR		= .
64CPUOPTS		= -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME)
65
66PLAT_DIR	= ../../platmod
67PLATOPTS	= -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD)
68
69LIBOPTS		= $(GENOPTS) $(PLATOPTS) $(CPUOPTS)
70
71CTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
72
73#
74#	Include common rules.
75#
76include $(UTSBASE)/sun4u/starcat/Makefile.starcat
77
78#
79#	Define targets
80#
81ALL_TARGET	= $(UNIX_BIN)
82LINT_TARGET	= $(LINT_LIB)
83INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE)
84
85#
86#       Overrides
87#
88ALL_BUILDS      = $(ALL_BUILDSONLY64)
89DEF_BUILDS      = $(DEF_BUILDSONLY64)
90SYM_BUILDS      = $(DEF_BUILDSONLY64)
91CLEANLINTFILES  += $(LINT32_FILES)
92
93#
94#	This is UNIX_DIR. Use a short path.
95#
96UNIX_DIR	= .
97
98#
99#	Overrides
100#
101CLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(OBJS_DIR)/vers.c \
102		   $(OBJS_DIR)/vers.o $(CPU_OBJ) $(CPULIB) \
103		   $(DTRACESTUBS_O) $(DTRACESTUBS)
104
105CLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
106CLEANLINTFILES	+= $(LINT_LIB)
107
108#
109# lint pass one enforcement
110# Turn on doubleword alignment for 64 bit counter timer registers
111#
112CFLAGS += $(CCVERBOSE) -dalign
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
133symcheck:       $(SYM_DEPS)
134
135$(UNIX_BIN):	$(UNIX_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) $(DTRACESTUBS)
136	$(LD) -dy -b -o $@ -e _start -I $(KRTLD) -M $(MAPFILE) \
137	    $(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
138	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
139	$(POST_PROCESS)
140
141symcheck.targ:	$(UNIX_O) $(MODSTUBS_O) $(LIBS) $(DTRACESTUBS)
142	$(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
143	$(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
144
145#$(UNIX).glom:	$(UNIX)
146#	${LD} -dy -b -z nodefs -o $@ -e _start -I $(KRTLD) -M $(MAPFILE) \
147#	$(UNIX_O) $(MODSTUBS_O) $(GENUNIX_DIR)/$(GENUNIX)
148#	$(POST_PROCESS)
149
150$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
151	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
152
153#
154#	Special rules for generating assym.h for inclusion in assembly files.
155#
156$(DSF_DIR)/$(OBJS_DIR)/assym.h:	FRC
157	@cd $(DSF_DIR); $(MAKE) all.targ
158
159$(GENLIB):	FRC
160	@(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ)
161	@pwd
162
163$(PLATLIB):
164	?@(cd $(PLAT_DIR); pwd; $(MAKE) all.targ)
165	?@pwd
166#
167#	CPU_OBJ now comprises of 2 object files which come from sun4 common
168#	and from architecture dependent code.  OBJS_DIR is prepended where
169#	CPU_DIR is defined to allow for building multiple CPU_OBJ's
170#
171$(CPULIB):	$(CPU_OBJ)
172	$(LD) -o $@ -G -h 'cpu/$$CPU' $(CPU_OBJ)
173
174#
175#	The global lint target builds the kernel lint library (llib-lunix.ln)
176#	which is equivalent to a lint of /unix.o. Then all kernel modules for
177#	this architecture are linted against the kernel lint library.
178#
179#	Note:	lint errors in the kernel lint library will be repeated for
180#		each module. It is important that the kernel lint library
181#		be clean to keep the textual output to a reasonable level.
182#
183
184$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
185	@-$(ECHO) "\n$(UNIX): (library construction):"
186	@$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS)
187	@$(MV) $(@F) $@
188
189lintlib:	$(LINT_DEPS)
190
191#
192#	Include common targets.
193#
194include $(UTSBASE)/sun4u/starcat/Makefile.targ
195