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