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 
 122 warlock: $(WARLOCK_TARGETS)
 123 
 124 $(WARLOCK_OK): $(WLCMD_DIR)/$(MODULE).wlcmd $(SES_FILES)
 125         @cd ../warlock; $(MAKE) warlock
 126         @cd ../scsi; $(MAKE) warlock
 127         $(WARLOCK) -c $(WLCMD_DIR)/$(MODULE).wlcmd $(SES_FILES) ../warlock/scsi.ll \
 128                 -l ../warlock/ddi_dki_impl.ll  \
 129                 $(SCSI_FILES)
 130         @ $(TOUCH) $@
 131 
 132 warlock_with_esp.ok: $(WLCMD_DIR)/ses_with_esp.wlcmd $(SES_FILES)
 133         @cd ../warlock; $(MAKE) warlock
 134         @cd ../scsi; $(MAKE) warlock
 135         @cd ../esp; $(MAKE) warlock;
 136         $(WARLOCK) -c $(WLCMD_DIR)/ses_with_esp.wlcmd $(SES_FILES) ../esp/esp  \
 137                 ../warlock/scsi.ll \
 138                 -l ../warlock/ddi_dki_impl.ll \
 139                 $(SCSI_FILES)
 140         @ $(TOUCH) $@
 141 
 142 warlock_with_fas.ok: $(WLCMD_DIR)/ses_with_fas.wlcmd $(SES_FILES)
 143         @cd ../warlock; $(MAKE) warlock
 144         @cd ../scsi; $(MAKE) warlock
 145         @cd ../fas; $(MAKE) warlock;
 146         $(WARLOCK) -c $(WLCMD_DIR)/ses_with_fas.wlcmd $(SES_FILES) \
 147                 ../fas/fas ../fas/fas_callbacks \
 148                 ../warlock/scsi.ll \
 149                 -l ../warlock/ddi_dki_impl.ll \
 150                 $(SCSI_FILES)
 151         @ $(TOUCH) $@
 152 
 153 %.ll: $(UTSBASE)/common/io/scsi/targets/%.c
 154         $(WLCC) $(CPPFLAGS) -o $@ $<
 155 
 156