xref: /titanic_44/usr/src/uts/sun4v/unix/Makefile (revision 1ce1951135b81c803c8dcf2f3c756009b1b0170a)
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 2007 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		  $(KRTLD_OBJS:%.o=$(LINTS_DIR)/%.ln) \
50		  $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
51		  $(LINTS_DIR)/vers.ln \
52		  $(LINTS_DIR)/modstubs.ln
53
54KRTLD_MAPFILE	= $(UTSBASE)/sparc/krtld/mapfile
55KRTLD_OBJECTS	= $(KRTLD_OBJS:%=$(OBJS_DIR)/%)
56KRTLD_O		= $(OBJS_DIR)/krtld.o
57
58ROOTMODULE	= $(ROOT_PSM_KERN_DIR)/$(UNIX)
59UNIX32_LINK	= $(ROOT_PSM_KERN_DIR_32)/$(UNIX)
60UNIX_BIN	= $(OBJS_DIR)/$(UNIX)
61
62LIBS		= $(GENLIB) $(PLATLIB) $(CPULIB)
63
64GENUNIX		= genunix
65GENUNIX_DIR	= ../$(GENUNIX)
66GENOPTS		= -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
67
68CPU_DIR		= .
69CPUOPTS		= -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME)
70
71PLAT_DIR	= ../platmod
72PLATOPTS	= -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD)
73
74LIBOPTS		= $(GENOPTS) $(PLATOPTS) $(CPUOPTS)
75
76CTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
77
78#
79#	Include common rules.
80#
81include $(UTSBASE)/sun4v/Makefile.sun4v
82
83#
84#	Define targets
85#
86ALL_TARGET	= $(UNIX_BIN)
87LINT_TARGET	= $(LINT_LIB)
88INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK)
89
90#
91#	This is UNIX_DIR. Use a short path.
92#
93UNIX_DIR	= .
94
95#
96#	Overrides
97#
98CLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(KRTLD_O) $(KRTLD_OBJECTS) \
99		   $(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \
100		   $(CPU_OBJ) $(CPULIB) \
101		   $(DTRACESTUBS_O) $(DTRACESTUBS)
102
103CLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
104CLEANLINTFILES	+= $(LINT_LIB)
105
106#
107# lint pass one enforcement
108# Turn on doubleword alignment for 64 bit counter timer registers
109#
110CFLAGS += $(CCVERBOSE) -dalign
111
112#
113# For now, disable these lint checks; maintainers should endeavor
114# to investigate and remove these for maximum lint coverage.
115# Please do not carry these forward to new Makefiles.
116#
117LINTTAGS	+= -erroff=E_SUSPICIOUS_COMPARISON
118LINTTAGS	+= -erroff=E_BAD_PTR_CAST_ALIGN
119LINTTAGS	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
120LINTTAGS	+= -erroff=E_STATIC_UNUSED
121LINTTAGS	+= -erroff=E_PTRDIFF_OVERFLOW
122LINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
123
124#
125#	Default build targets.
126#
127.KEEP_STATE:
128
129def:		$(DEF_DEPS)
130
131all:		$(ALL_DEPS)
132
133clean:		$(CLEAN_DEPS)
134
135clobber:	$(CLOBBER_DEPS)
136
137lint:		$(LINT_DEPS)
138
139clean.lint:	$(CLEAN_LINT_DEPS)
140
141install:  	$(INSTALL_DEPS)
142
143
144$(UNIX_BIN):	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) \
145		$(DTRACESTUBS)
146	$(LD) -dy -b -o $@ -e _start -M $(MAPFILE) \
147	    $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
148	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
149	$(POST_PROCESS)
150
151$(UNIX32_LINK):	$(ROOT_PSM_KERN_DIR_32) $(UNIX_BIN)
152	-$(RM) $@; ln -s $(SUBDIR64)/$(UNIX) $@
153
154symcheck:	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBS)
155	$(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
156	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
157
158$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
159	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
160
161$(KRTLD_O):	$(KRTLD_OBJECTS)
162	$(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS)
163
164#
165#	Special rules for generating assym.h for inclusion in assembly files.
166#
167$(DSF_DIR)/$(OBJS_DIR)/assym.h:	FRC
168	@cd $(DSF_DIR); $(MAKE) all.targ
169
170$(GENLIB):	FRC
171	@(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ)
172	@pwd
173
174$(PLATLIB):
175	?@(cd $(PLAT_DIR); pwd; $(MAKE) all.targ)
176	?@pwd
177
178#
179#	CPU_OBJ now comprises of 2 object files which come from sun4 common
180#	and from architecture dependent code.  OBJS_DIR is prepended where
181#	CPU_OBJ is defined to allow for building multiple CPU_OBJ's
182#
183$(CPULIB):	$(CPU_OBJ)
184	$(BUILD.SO) $(CPU_OBJ)
185
186#
187#	The global lint target builds the kernel lint library (llib-lunix.ln)
188#	which is equivalent to a lint of /unix.o. Then all kernel modules for
189#	this architecture are linted against the kernel lint library.
190#
191#	Note:	lint errors in the kernel lint library will be repeated for
192#		each module. It is important that the kernel lint library
193#		be clean to keep the textual output to a reasonable level.
194#
195
196$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
197	@-$(ECHO) "\n$(UNIX): (library construction):"
198	@$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS)
199	@$(MV) $(@F) $@
200
201lintlib:	$(LINT_DEPS)
202
203#
204#	Include common targets.
205#
206include $(UTSBASE)/$(PLATFORM)/Makefile.targ
207
208