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 # uts/sparc/ses/Makefile
  23 #
  24 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  25 # Use is subject to license terms.
  26 # Copyright (c) 2011 Bayard G. Bell. All rights reserved.
  27 #
  28 # This makefile drives the production of the ses 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 #
  36 UTSBASE = ../..
  37 
  38 #
  39 # Define the module and object file sets.
  40 #
  41 MODULE          = ses
  42 OBJECTS         = $(SES_OBJS:%=$(OBJS_DIR)/%)
  43 LINTS           = $(SES_OBJS:%.o=$(LINTS_DIR)/%.ln)
  44 ROOTMODULE      = $(ROOT_DRV_DIR)/$(MODULE)
  45 CONF_SRCDIR     = $(UTSBASE)/sun/io/scsi/targets
  46 WARLOCK_OUT     = $(SES_OBJS:%.o=%.ll)
  47 WARLOCK_OK      = $(MODULE).ok
  48 WLCMD_DIR       = $(UTSBASE)/common/io/warlock
  49 
  50 #
  51 # Include common rules.
  52 #
  53 include $(UTSBASE)/sparc/Makefile.sparc
  54 
  55 #
  56 # Define targets
  57 #
  58 ALL_TARGET      = $(BINARY) $(SRC_CONFILE)
  59 LINT_TARGET     = $(MODULE).lint
  60 INSTALL_TARGET  = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
  61 CLEANFILES      += $(WARLOCK_TARGETS)
  62 
  63 #
  64 # Define dependency on scsi
  65 #
  66 LDFLAGS += -dy -N misc/scsi
  67 
  68 #
  69 # For now, disable these lint checks; maintainers should endeavor
  70 # to investigate and remove these for maximum lint coverage.
  71 # Please do not carry these forward to new Makefiles.
  72 #
  73 LINTTAGS        += -erroff=E_BAD_PTR_CAST_ALIGN
  74 LINTTAGS        += -erroff=E_ASSIGN_NARROW_CONV
  75 LINTTAGS        += -erroff=E_SUSPICIOUS_COMPARISON
  76 
  77 #
  78 # Default build targets.
  79 #
  80 .KEEP_STATE:
  81 
  82 def:            $(DEF_DEPS)
  83 
  84 all:            $(ALL_DEPS)
  85 
  86 clean:          $(CLEAN_DEPS)
  87                 $(RM) $(WARLOCK_OUT) $(WARLOCK_OK)
  88 
  89 clobber:        $(CLOBBER_DEPS)
  90                 $(RM) $(WARLOCK_OUT) $(WARLOCK_OK)
  91 
  92 modlintlib:     $(MODLINTLIB_DEPS) lint64
  93 
  94 clean.lint:     $(CLEAN_LINT_DEPS)
  95 
  96 install:        $(INSTALL_DEPS)
  97 
  98 #
  99 #       Include common targets.
 100 #
 101 include $(UTSBASE)/sparc/Makefile.targ
 102 
 103 
 104 #
 105 # Defines for local commands.
 106 #
 107 WARLOCK         = warlock
 108 WLCC            = wlcc
 109 TOUCH           = touch
 110 TEST            = test
 111 
 112 #
 113 # Warlock targets
 114 #
 115 # XXX FIX ME.  this can be improved quite a bit
 116 
 117 SES_FILES       = $(MODULE).ll
 118 SCSI_FILES      = $(SCSI_OBJS:%.o=-l ../scsi/%.ll)
 119 
 120 WARLOCK_TARGETS = $(WARLOCK_OK) warlock_with_esp.ok warlock_with_fas.ok
 121 $(CLOSED_BUILD)WARLOCK_TARGETS += warlock_with_isp.ok warlock_with_glm.ok
 122 
 123 warlock: $(WARLOCK_TARGETS)
 124 
 125 $(WARLOCK_OK): $(WLCMD_DIR)/$(MODULE).wlcmd $(SES_FILES)
 126         @cd ../warlock; $(MAKE) warlock
 127         @cd ../scsi; $(MAKE) warlock
 128         $(WARLOCK) -c $(WLCMD_DIR)/$(MODULE).wlcmd $(SES_FILES) ../warlock/scsi.ll \
 129                 -l ../warlock/ddi_dki_impl.ll  \
 130                 $(SCSI_FILES)
 131         @ $(TOUCH) $@
 132 
 133 warlock_with_esp.ok: $(WLCMD_DIR)/ses_with_esp.wlcmd $(SES_FILES)
 134         @cd ../warlock; $(MAKE) warlock
 135         @cd ../scsi; $(MAKE) warlock
 136         @cd ../esp; $(MAKE) warlock;
 137         $(WARLOCK) -c $(WLCMD_DIR)/ses_with_esp.wlcmd $(SES_FILES) ../esp/esp  \
 138                 ../warlock/scsi.ll \
 139                 -l ../warlock/ddi_dki_impl.ll \
 140                 $(SCSI_FILES)
 141         @ $(TOUCH) $@
 142 
 143 warlock_with_fas.ok: $(WLCMD_DIR)/ses_with_fas.wlcmd $(SES_FILES)
 144         @cd ../warlock; $(MAKE) warlock
 145         @cd ../scsi; $(MAKE) warlock
 146         @cd ../fas; $(MAKE) warlock;
 147         $(WARLOCK) -c $(WLCMD_DIR)/ses_with_fas.wlcmd $(SES_FILES) \
 148                 ../fas/fas ../fas/fas_callbacks \
 149                 ../warlock/scsi.ll \
 150                 -l ../warlock/ddi_dki_impl.ll \
 151                 $(SCSI_FILES)
 152         @ $(TOUCH) $@
 153 
 154 warlock_with_isp.ok: $(WLCMD_DIR)/ses_with_isp.wlcmd $(SES_FILES)
 155         @cd ../warlock; $(MAKE) warlock
 156         @cd ../scsi; $(MAKE) warlock
 157         @cd $(CLOSED)/uts/sparc/isp; $(MAKE) warlock;
 158         $(WARLOCK) -c $(WLCMD_DIR)/ses_with_isp.wlcmd $(SES_FILES) \
 159                 $(CLOSED)/uts/sparc/isp/isp \
 160                 ../warlock/scsi.ll \
 161                 -l ../warlock/ddi_dki_impl.ll \
 162                 $(SCSI_FILES)
 163         @ $(TOUCH) $@
 164 
 165 warlock_with_glm.ok: $(WLCMD_DIR)/ses_with_glm.wlcmd $(SES_FILES)
 166         @cd ../warlock; $(MAKE) warlock
 167         @cd ../scsi; $(MAKE) warlock
 168         @cd $(CLOSED)/uts/sparc/glm; $(MAKE) warlock;
 169         $(WARLOCK) -c $(WLCMD_DIR)/ses_with_glm.wlcmd $(SES_FILES) \
 170                 $(CLOSED)/uts/sparc/glm/glm \
 171                 ../warlock/scsi.ll \
 172                 -l ../warlock/ddi_dki_impl.ll \
 173                 $(SCSI_FILES)
 174         @ $(TOUCH) $@
 175 
 176 %.ll: $(UTSBASE)/common/io/scsi/targets/%.c
 177         $(WLCC) $(CPPFLAGS) -o $@ $<
 178 
 179