xref: /titanic_51/usr/src/uts/sun4v/unix/Makefile (revision faebf79429f1b4c0f9334ac0f880806edf891f1f)
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 2005 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#	sun4v 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
52ROOTMODULE	= $(ROOT_PSM_KERN_DIR)/$(UNIX)
53UNIX32_LINK	= $(ROOT_PSM_KERN_DIR_32)/$(UNIX)
54UNIX_BIN	= $(OBJS_DIR)/$(UNIX)
55
56KRTLD_32	= misc/krtld
57KRTLD_64	= misc/$(SUBDIR64)/krtld
58KRTLD		= $(KRTLD_$(CLASS))
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)/sun4v/Makefile.sun4v
80
81#
82#	Define targets
83#
84ALL_TARGET	= $(UNIX_BIN)
85LINT_TARGET	= $(LINT_LIB)
86INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK)
87
88#
89#	This is UNIX_DIR. Use a short path.
90#
91UNIX_DIR	= .
92
93#
94#	Overrides
95#
96CLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(OBJS_DIR)/vers.c \
97		   $(OBJS_DIR)/vers.o $(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
109#
110#	Default build targets.
111#
112.KEEP_STATE:
113
114def:		$(DEF_DEPS)
115
116all:		$(ALL_DEPS)
117
118clean:		$(CLEAN_DEPS)
119
120clobber:	$(CLOBBER_DEPS)
121
122lint:		$(LINT_DEPS)
123
124clean.lint:	$(CLEAN_LINT_DEPS)
125
126install:  	$(INSTALL_DEPS)
127
128
129$(UNIX_BIN):	$(UNIX_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) $(DTRACESTUBS)
130	$(LD) -dy -b -o $@ -e _start -I $(KRTLD) -M $(MAPFILE) \
131	    $(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
132	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
133	$(POST_PROCESS)
134
135$(UNIX32_LINK):	$(ROOT_PSM_KERN_DIR_32) $(UNIX_BIN)
136	-$(RM) $@; ln -s $(SUBDIR64)/$(UNIX) $@
137
138symcheck:	$(UNIX_O) $(MODSTUBS_O) $(LIBS)
139	$(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
140	$(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
141
142#$(UNIX).glom:	$(UNIX)
143#	${LD} -dy -b -z nodefs -o $@ -e _start -I $(KRTLD) -M $(MAPFILE) \
144#	$(UNIX_O) $(MODSTUBS_O) $(GENUNIX_DIR)/$(GENUNIX)
145#	$(POST_PROCESS)
146
147$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
148	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
149
150#
151#	Special rules for generating assym.h for inclusion in assembly files.
152#
153$(DSF_DIR)/$(OBJS_DIR)/assym.h:	FRC
154	@cd $(DSF_DIR); $(MAKE) all.targ
155
156$(GENLIB):	FRC
157	@(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ)
158	@pwd
159
160$(PLATLIB):
161	?@(cd $(PLAT_DIR); pwd; $(MAKE) all.targ)
162	?@pwd
163
164#
165#	CPU_OBJ now comprises of 2 object files which come from sun4 common
166#	and from architecture dependent code.  OBJS_DIR is prepended where
167#	CPU_OBJ is defined to allow for building multiple CPU_OBJ's
168#
169$(CPULIB):	$(CPU_OBJ)
170	$(BUILD.SO) $(CPU_OBJ)
171
172#
173#	The global lint target builds the kernel lint library (llib-lunix.ln)
174#	which is equivalent to a lint of /unix.o. Then all kernel modules for
175#	this architecture are linted against the kernel lint library.
176#
177#	Note:	lint errors in the kernel lint library will be repeated for
178#		each module. It is important that the kernel lint library
179#		be clean to keep the textual output to a reasonable level.
180#
181
182$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
183	@-$(ECHO) "\n$(UNIX): (library construction):"
184	@$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS)
185	@$(MV) $(@F) $@
186
187lintlib:	$(LINT_DEPS)
188
189#
190#	Include common targets.
191#
192include $(UTSBASE)/$(PLATFORM)/Makefile.targ
193
194