xref: /titanic_52/usr/src/uts/sun4u/starfire/unix/Makefile (revision ba3594ba9b5dd4c846c472a8d657edcb7c8109ac)
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#
23# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27#
28#	This makefile drives the production of unix (and unix.o).
29#
30#	sun4u starfire 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
50
51KRTLD_MAPFILE	= $(UTSBASE)/sparc/krtld/mapfile
52KRTLD_OBJECTS	= $(KRTLD_OBJS:%=$(OBJS_DIR)/%)
53KRTLD_O		= $(OBJS_DIR)/krtld.o
54
55ROOTMODULE	= $(ROOT_STARFIRE_KERN_DIR)/$(UNIX)
56UNIX32_LINK	= $(ROOT_STARFIRE_KERN_DIR_32)/$(UNIX)
57UNIX_BIN	= $(OBJS_DIR)/$(UNIX)
58
59LIBS		= $(GENLIB) $(PLATLIB) $(CPULIB)
60
61GENUNIX		= genunix
62GENUNIX_DIR	= ../../$(GENUNIX)
63GENOPTS		= -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
64
65CPU_DIR		= .
66CPUOPTS		= -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME)
67
68PLAT_DIR	= ../../platmod
69PLATOPTS	= -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD)
70
71LIBOPTS		= $(GENOPTS) $(PLATOPTS) $(CPUOPTS)
72
73CTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
74
75#
76#	Include common rules.
77#
78include $(UTSBASE)/sun4u/starfire/Makefile.starfire
79
80#
81#	Define targets
82#
83ALL_TARGET	= $(UNIX_BIN)
84LINT_TARGET	= $(LINT_LIB)
85INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK)
86
87#
88#	This is UNIX_DIR. Use a short path.
89#
90UNIX_DIR	= .
91
92#
93#	Overrides
94#
95CLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(KRTLD_O) $(KRTLD_OBJECTS) \
96		   $(OBJS_DIR)/vers.c  $(OBJS_DIR)/vers.o \
97		   $(CPU_OBJ) $(CPULIB) \
98		   $(DTRACESTUBS_O) $(DTRACESTUBS)
99
100CLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
101CLEANLINTFILES	+= $(LINT_LIB)
102
103#
104# lint pass one enforcement
105# Turn on doubleword alignment for 64 bit counter timer registers
106#
107CFLAGS += $(CCVERBOSE) -dalign
108
109CERRWARN	+= -_gcc=-Wno-parentheses
110CERRWARN	+= -_gcc=-Wno-uninitialized
111CERRWARN	+= -_gcc=-Wno-char-subscripts
112CERRWARN	+= -_gcc=-Wno-unused-variable
113CERRWARN	+= -_gcc=-Wno-unused-function
114CERRWARN	+= -_gcc=-Wno-unused-label
115CERRWARN	+= -_gcc=-Wno-type-limits
116CERRWARN	+= -_gcc=-Wno-clobbered
117CERRWARN	+= -_gcc=-Wno-empty-body
118CERRWARN	+= -_gcc=-Wno-unused-value
119CERRWARN	+= -_gcc=-Wno-switch
120
121#
122#	Default build targets.
123#
124.KEEP_STATE:
125
126def:		$(DEF_DEPS)
127
128all:		$(ALL_DEPS)
129
130clean:		$(CLEAN_DEPS)
131
132clobber:	$(CLOBBER_DEPS)
133
134lint:		$(LINT_DEPS)
135
136clean.lint:	$(CLEAN_LINT_DEPS)
137
138install:  	$(INSTALL_DEPS)
139
140$(UNIX_BIN):	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) \
141		$(DTRACESTUBS)
142	$(LD) -dy -b -o $@ -e _start -M $(MAPFILE) \
143	    $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
144	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
145	$(POST_PROCESS)
146	$(CHK4UBINARY)
147
148$(UNIX32_LINK):	$(ROOT_PSM_KERN_DIR_32) $(UNIX_BIN)
149	-$(RM) $@; ln -s $(SUBDIR64)/$(UNIX) $@
150
151symcheck:	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBS)
152	$(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
153	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
154
155$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
156	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
157
158$(KRTLD_O):	$(KRTLD_OBJECTS)
159	$(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS)
160
161#
162#	CPU_OBJ now comprises of 2 object files which come from sun4 common
163#	and from architecture dependent code.  OBJS_DIR is prepended where
164#	CPU_OBJ is defined to allow for building multiple CPU_OBJ's
165#
166$(CPULIB):	$(CPU_OBJ)
167	$(BUILD.SO) $(CPU_OBJ)
168
169#
170#	The global lint target builds the kernel lint library (llib-lunix.ln)
171#	which is equivalent to a lint of /unix.o. Then all kernel modules for
172#	this architecture are linted against the kernel lint library.
173#
174#	Note:	lint errors in the kernel lint library will be repeated for
175#		each module. It is important that the kernel lint library
176#		be clean to keep the textual output to a reasonable level.
177#
178
179$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
180	@-$(ECHO) "\n$(UNIX): (library construction):"
181	@$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS)
182	@$(MV) $(@F) $@
183
184lintlib:	$(LINT_DEPS)
185
186#
187#	Include common targets.
188#
189include $(UTSBASE)/sun4u/starfire/Makefile.targ
190