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# uts/sparc/st/Makefile
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#	This makefile drives the production of the st driver kernel module.
29#
30#	sparc architecture dependent
31#
32
33#
34#	Path to the base of the uts directory tree (usually /usr/src/uts).
35#
36UTSBASE	= ../..
37
38#
39#	Define the module and object file sets.
40#
41MODULE		= st
42OBJECTS		= $(ST_OBJS:%=$(OBJS_DIR)/%)
43LINTS		= $(ST_OBJS:%.o=$(LINTS_DIR)/%.ln)
44ROOTMODULE	= $(ROOT_DRV_DIR)/$(MODULE)
45CONF_SRCDIR	= $(UTSBASE)/sun/io/scsi/targets
46WARLOCK_OUT     = $(ST_OBJS:%.o=%.ll)
47WARLOCK_OK      = $(MODULE).ok
48WLCMD_DIR       = $(UTSBASE)/common/io/warlock
49
50#
51#	Include common rules.
52#
53include $(UTSBASE)/sparc/Makefile.sparc
54
55#
56#	Define targets
57#
58ALL_TARGET	= $(BINARY) $(SRC_CONFILE)
59LINT_TARGET	= $(MODULE).lint
60INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
61
62# 
63# lint pass one enforcement 
64# 
65CFLAGS += $(CCVERBOSE)
66
67#
68# For now, disable these lint checks; maintainers should endeavor
69# to investigate and remove these for maximum lint coverage.
70# Please do not carry these forward to new Makefiles.
71#
72LINTTAGS	+= -erroff=E_BAD_PTR_CAST_ALIGN
73LINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
74LINTTAGS	+= -erroff=E_SUSPICIOUS_COMPARISON
75
76#
77#	Default build targets.
78#
79.KEEP_STATE:
80
81all:		$(ALL_DEPS)
82
83def:		$(DEF_DEPS)
84
85clean:		$(CLEAN_DEPS)
86		$(RM) $(WARLOCK_OUT) $(WARLOCK_OK)
87
88clobber:	$(CLOBBER_DEPS)
89		$(RM) $(WARLOCK_OUT) $(WARLOCK_OK)
90
91lint:		$(LINT_DEPS)
92
93modlintlib:	$(MODLINTLIB_DEPS)
94
95clean.lint:	$(CLEAN_LINT_DEPS)
96
97install:	$(INSTALL_DEPS)
98
99#	Include common targets.
100#
101include $(UTSBASE)/sparc/Makefile.targ
102
103#
104#	Defines for local commands.
105#
106WARLOCK		= warlock
107WLCC		= wlcc
108TOUCH		= touch
109TEST		= test
110
111#
112# Warlock targets
113#
114# Note that in warlock_with_{esp,isp} it is important to load st.ll
115# before {isp,esp}.ll; the reason is that both have _init/_info/_fini
116# and warlock can only handle one extern function by a given name;
117# any loaded after the first are ignored.
118
119SCSI_FILES = $(SCSI_OBJS:%.o=-l ../scsi/%.ll)
120
121WARLOCK_TARGETS =  warlock_alone warlock_with_esp warlock_with_fas
122$(CLOSED_BUILD)WARLOCK_TARGETS += warlock_with_isp warlock_with_glm
123
124warlock: $(WARLOCK_TARGETS)
125
126warlock_alone: $(WARLOCK_OK)
127
128warlock_with_esp: $(WLCMD_DIR)/st_with_esp.wlcmd $(WARLOCK_OUT) scsi_files \
129	esp_files warlock_ddi.files
130	$(WARLOCK) -c $(WLCMD_DIR)/st_with_esp.wlcmd \
131		$(WARLOCK_OUT) ../esp/esp $(SCSI_FILES)  \
132		-l ../warlock/ddi_dki_impl.ll
133
134warlock_with_fas: $(WLCMD_DIR)/st_with_fas.wlcmd $(WARLOCK_OUT) scsi_files \
135	fas_files warlock_ddi.files
136	$(WARLOCK) -c $(WLCMD_DIR)/st_with_fas.wlcmd \
137		$(WARLOCK_OUT) \
138		../fas/fas ../fas/fas_callbacks \
139		$(SCSI_FILES)  \
140		-l ../warlock/ddi_dki_impl.ll
141
142warlock_with_isp: $(WLCMD_DIR)/st_with_isp.wlcmd $(WARLOCK_OUT) scsi_files \
143	isp_files warlock_ddi.files
144	$(WARLOCK) -c $(WLCMD_DIR)/st_with_isp.wlcmd \
145		$(WARLOCK_OUT) $(CLOSED)/uts/sparc/isp/isp $(SCSI_FILES)  \
146		-l ../warlock/ddi_dki_impl.ll
147
148warlock_with_glm: $(WLCMD_DIR)/st_with_glm.wlcmd $(WARLOCK_OUT) scsi_files \
149	glm_files warlock_ddi.files
150	$(WARLOCK) -c $(WLCMD_DIR)/st_with_glm.wlcmd \
151		$(WARLOCK_OUT) $(CLOSED)/uts/sparc/glm/glm $(SCSI_FILES) \
152		-l ../warlock/ddi_dki_impl.ll
153
154scsi_files:
155	@cd ../scsi; pwd; $(MAKE) warlock
156
157esp_files:
158	@cd ../esp; pwd; $(MAKE) warlock
159
160fas_files:
161	@cd ../fas; pwd; $(MAKE) warlock
162
163isp_files:
164	@cd $(CLOSED)/uts/sparc/isp; pwd; $(MAKE) warlock
165
166glm_files:
167	@cd $(CLOSED)/uts/sparc/glm; pwd; $(MAKE) warlock
168
169st.ok: $(WLCMD_DIR)/st.wlcmd st.ll st_conf.ll  scsi_files warlock_ddi.files
170	$(WARLOCK) -c $(WLCMD_DIR)/st.wlcmd $(WARLOCK_OUT) $(SCSI_FILES) \
171	-l ../warlock/ddi_dki_impl.ll
172	$(TOUCH) $@
173
174%.ll: $(UTSBASE)/common/io/scsi/targets/%.c
175	$(WLCC) $(CPPFLAGS) -DDEBUG -o $@ $<
176
177warlock_ddi.files:
178	@cd ../warlock; pwd; $(MAKE) warlock
179
180scsi.files:
181	@cd ../scsi; pwd; $(MAKE) warlock
182