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