xref: /titanic_44/usr/src/uts/sun4u/opl/unix/Makefile (revision 6b35cb3cf158584a9408d44b9b6796564e8e1882)
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# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26#
27#	This makefile drives the production of unix (and unix.o).
28#
29#	sun4u opl implementation architecture dependent
30#
31# uts/sun4u/opl/unix/Makefile
32#
33
34#
35#	Path to the base of the uts directory tree (usually /usr/src/uts).
36#
37UTSBASE	= ../../..
38
39#
40#	Define the module and object file sets.
41#
42UNIX		= unix
43OBJECTS		= $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
44		  $(CORE_OBJS:%=$(OBJS_DIR)/%) \
45		  $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
46LINTS		= $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
47		  $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
48		  $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
49		  $(LINTS_DIR)/vers.ln \
50		  $(LINTS_DIR)/modstubs.ln
51
52KRTLD_MAPFILE	= $(UTSBASE)/sparc/krtld/mapfile
53KRTLD_OBJECTS	= $(KRTLD_OBJS:%=$(OBJS_DIR)/%)
54KRTLD_O		= $(OBJS_DIR)/krtld.o
55
56ROOTMODULE	= $(ROOT_OPL_KERN_DIR)/$(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/opl/Makefile.opl
79
80#
81#	Define targets
82#
83ALL_TARGET	= $(UNIX_BIN)
84LINT_TARGET	= $(LINT_LIB)
85INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE)
86
87#
88#       Overrides
89#
90ALL_BUILDS      = $(ALL_BUILDSONLY64)
91DEF_BUILDS      = $(DEF_BUILDSONLY64)
92SYM_BUILDS      = $(DEF_BUILDSONLY64)
93CLEANLINTFILES  += $(LINT32_FILES)
94
95#
96#	This is UNIX_DIR. Use a short path.
97#
98UNIX_DIR	= .
99
100#
101#	Overrides
102#
103CLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(KRTLD_O) $(KRTLD_OBJECTS) \
104		   $(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \
105		   $(CPU_OBJ) $(CPULIB) \
106		   $(DTRACESTUBS_O) $(DTRACESTUBS)
107
108CLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
109CLEANLINTFILES	+= $(LINT_LIB)
110
111#
112# lint pass one enforcement
113# Turn on doubleword alignment for 64 bit counter timer registers
114#
115CFLAGS += $(CCVERBOSE) -dalign
116
117CERRWARN	+= -_gcc=-Wno-parentheses
118CERRWARN	+= -_gcc=-Wno-uninitialized
119CERRWARN	+= -_gcc=-Wno-char-subscripts
120CERRWARN	+= -_gcc=-Wno-unused-variable
121CERRWARN	+= -_gcc=-Wno-unused-function
122CERRWARN	+= -_gcc=-Wno-unused-label
123CERRWARN	+= -_gcc=-Wno-type-limits
124CERRWARN	+= -_gcc=-Wno-clobbered
125CERRWARN	+= -_gcc=-Wno-empty-body
126CERRWARN	+= -_gcc=-Wno-unused-value
127CERRWARN	+= -_gcc=-Wno-switch
128
129#
130#	Default build targets.
131#
132.KEEP_STATE:
133
134all:		$(ALL_DEPS)
135
136def:		$(DEF_DEPS)
137
138clean:		$(CLEAN_DEPS)
139
140clobber:	$(CLOBBER_DEPS)
141
142lint:		$(LINT_DEPS)
143
144clean.lint:	$(CLEAN_LINT_DEPS)
145
146install:  	$(INSTALL_DEPS)
147
148symcheck:       $(SYM_DEPS)
149
150$(UNIX_BIN):	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) \
151		$(DTRACESTUBS)
152	$(LD) -dy -b -o $@ -e _start -M $(MAPFILE) \
153	    $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
154	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
155	$(POST_PROCESS)
156
157symcheck.targ:	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBS) $(DTRACESTUBS)
158	$(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
159	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
160
161$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
162	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
163
164$(KRTLD_O):	$(KRTLD_OBJECTS)
165	$(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS)
166
167#
168#	CPU_OBJ now comprises of 2 object files which come from sun4 common
169#	and from architecture dependent code.  OBJS_DIR is prepended where
170#	CPU_OBJ is defined to allow for building multiple CPU_OBJ's
171#
172$(CPULIB):	$(CPU_OBJ)
173	$(LD) -o $@ -G -h 'cpu/$$CPU' $(CPU_OBJ)
174
175#
176#	The global lint target builds the kernel lint library (llib-lunix.ln)
177#	which is equivalent to a lint of /unix.o. Then all kernel modules for
178#	this architecture are linted against the kernel lint library.
179#
180#	Note:	lint errors in the kernel lint library will be repeated for
181#		each module. It is important that the kernel lint library
182#		be clean to keep the textual output to a reasonable level.
183#
184
185$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
186	@-$(ECHO) "\n$(UNIX): (library construction):"
187	@$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS)
188	@$(MV) $(@F) $@
189
190lintlib:	$(LINT_DEPS)
191
192#
193#	Include common targets.
194#
195include $(UTSBASE)/sun4u/opl/Makefile.targ
196