xref: /illumos-gate/usr/src/uts/sun4u/opl/unix/Makefile (revision 0aaef2f5)
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# Copyright 2019 Joyent, Inc.
25#
26
27#
28#	This makefile drives the production of unix (and unix.o).
29#
30#	sun4u opl implementation architecture dependent
31#
32# uts/sun4u/opl/unix/Makefile
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)/%)
47
48KRTLD_MAPFILE	= $(UTSBASE)/sparc/krtld/mapfile
49KRTLD_OBJECTS	= $(KRTLD_OBJS:%=$(OBJS_DIR)/%)
50KRTLD_O		= $(OBJS_DIR)/krtld.o
51
52ROOTMODULE	= $(ROOT_OPL_KERN_DIR)/$(UNIX)
53UNIX_BIN	= $(OBJS_DIR)/$(UNIX)
54
55LIBS		= $(GENLIB) $(PLATLIB) $(CPULIB)
56
57GENUNIX		= genunix
58GENUNIX_DIR	= ../../$(GENUNIX)
59GENOPTS		= -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
60
61CPU_DIR		= .
62CPUOPTS		= -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME)
63
64PLAT_DIR	= ../../platmod
65PLATOPTS	= -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD)
66
67LIBOPTS		= $(GENOPTS) $(PLATOPTS) $(CPUOPTS)
68
69CTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
70
71#
72#	Include common rules.
73#
74include $(UTSBASE)/sun4u/opl/Makefile.opl
75
76#
77#	Define targets
78#
79ALL_TARGET	= $(UNIX_BIN)
80INSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE)
81
82#
83#       Overrides
84#
85ALL_BUILDS      = $(ALL_BUILDSONLY64)
86DEF_BUILDS      = $(DEF_BUILDSONLY64)
87SYM_BUILDS      = $(DEF_BUILDSONLY64)
88
89#
90#	This is UNIX_DIR. Use a short path.
91#
92UNIX_DIR	= .
93
94#
95#	Overrides
96#
97CLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(KRTLD_O) $(KRTLD_OBJECTS) \
98		   $(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \
99		   $(CPU_OBJ) $(CPULIB) \
100		   $(DTRACESTUBS_O) $(DTRACESTUBS)
101
102CLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
103
104# Turn on doubleword alignment for 64 bit counter timer registers
105CFLAGS += -dalign
106
107#
108# For now, disable these warnings; maintainers should endeavor
109# to investigate and remove these for maximum coverage.
110# Please do not carry these forward to new Makefiles.
111#
112CFLAGS		+= $(CCVERBOSE)
113CERRWARN	+= -_gcc=-Wno-parentheses
114CERRWARN	+= $(CNOWARN_UNINIT)
115CERRWARN	+= -_gcc=-Wno-char-subscripts
116CERRWARN	+= -_gcc=-Wno-unused-variable
117CERRWARN	+= -_gcc=-Wno-unused-function
118CERRWARN	+= -_gcc=-Wno-unused-label
119CERRWARN	+= -_gcc=-Wno-type-limits
120CERRWARN	+= -_gcc=-Wno-clobbered
121CERRWARN	+= -_gcc=-Wno-empty-body
122CERRWARN	+= -_gcc=-Wno-unused-value
123CERRWARN	+= -_gcc=-Wno-switch
124
125#
126#	Default build targets.
127#
128.KEEP_STATE:
129
130all:		$(ALL_DEPS)
131
132def:		$(DEF_DEPS)
133
134clean:		$(CLEAN_DEPS)
135
136clobber:	$(CLOBBER_DEPS)
137
138install:	$(INSTALL_DEPS)
139
140symcheck:       $(SYM_DEPS)
141
142$(UNIX_BIN):	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(UNIX_MAPFILE) $(LIBS) \
143		$(DTRACESTUBS)
144	$(LD) -dy -b -o $@ -e _start -M $(UNIX_MAPFILE) \
145	    $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
146	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
147	$(POST_PROCESS)
148
149symcheck.targ:	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBS) $(DTRACESTUBS)
150	$(LD) -dy -b -o $(SYM_MOD) -M $(UNIX_MAPFILE) \
151	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
152
153$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
154	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
155
156$(KRTLD_O):	$(KRTLD_OBJECTS)
157	$(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS)
158
159#
160#	CPU_OBJ now comprises of 2 object files which come from sun4 common
161#	and from architecture dependent code.  OBJS_DIR is prepended where
162#	CPU_OBJ is defined to allow for building multiple CPU_OBJ's
163#
164$(CPULIB):	$(CPU_OBJ)
165	$(LD) -o $@ $(GSHARED) -h 'cpu/$$CPU' $(CPU_OBJ)
166
167#
168#	Include common targets.
169#
170include $(UTSBASE)/sun4u/opl/Makefile.targ
171