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