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/intel/scsa2usb/Makefile
  23 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
  27 #
  28 #       This makefile drives the production of the scsa2usb driver
  29 #       kernel module. intel architecture dependent
  30 #
  31 
  32 #
  33 #       Path to the base of the uts directory tree (usually /usr/src/uts).
  34 #
  35 UTSBASE = ../..
  36 
  37 #
  38 #       Define the module and object file sets.
  39 #
  40 MODULE          = scsa2usb
  41 OBJECTS         = $(SCSA2USB_OBJS:%=$(OBJS_DIR)/%)
  42 LINTS           = $(SCSA2USB_OBJS:%.o=$(LINTS_DIR)/%.ln)
  43 ROOTMODULE      = $(ROOT_DRV_DIR)/$(MODULE)
  44 CONF_SRCDIR     = $(UTSBASE)/common/io/usb/scsa2usb
  45 WARLOCK_OUT     = $(SCSA2USB_OBJS:%.o=%.ll)
  46 WARLOCK_OK      = $(MODULE).ok
  47 WLCMD_DIR       = $(UTSBASE)/common/io/warlock
  48 
  49 #
  50 #       Include common rules.
  51 #
  52 include $(UTSBASE)/intel/Makefile.intel
  53 
  54 #
  55 #       Define targets
  56 #
  57 ALL_TARGET      = $(BINARY) $(SRC_CONFILE)
  58 LINT_TARGET     = $(MODULE).lint
  59 INSTALL_TARGET  = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
  60 
  61 #
  62 #       Override defaults to build a unique, local modstubs.o.
  63 #
  64 MODSTUBS_DIR     = $(OBJS_DIR)
  65 CLEANFILES      += $(MODSTUBS_O)
  66 
  67 #
  68 # depends on misc/usba misc/scsi
  69 #
  70 LDFLAGS         += -dy -Nmisc/usba -Nmisc/scsi
  71 
  72 #
  73 # For now, disable these lint checks; maintainers should endeavor
  74 # to investigate and remove these for maximum lint coverage.
  75 # Please do not carry these forward to new Makefiles.
  76 #
  77 LINTTAGS        += -erroff=E_BAD_PTR_CAST_ALIGN
  78 
  79 CERRWARN        += -_gcc=-Wno-unused-label
  80 CERRWARN        += -_gcc=-Wno-uninitialized
  81 
  82 #
  83 #       Default build targets.
  84 #
  85 .KEEP_STATE:
  86 
  87 def:            $(DEF_DEPS)
  88 
  89 all:            $(ALL_DEPS)
  90 
  91 clean:          $(CLEAN_DEPS)
  92                 $(RM) $(WARLOCK_OUT) $(WARLOCK_OK)
  93 
  94 clobber:        $(CLOBBER_DEPS)
  95                 $(RM) $(WARLOCK_OUT) $(WARLOCK_OK)
  96 
  97 lint:           $(LINT_DEPS)
  98 
  99 modlintlib:     $(MODLINTLIB_DEPS)
 100 
 101 clean.lint:     $(CLEAN_LINT_DEPS)
 102 
 103 install:        $(INSTALL_DEPS)
 104 
 105 #
 106 #       Include common targets.
 107 #
 108 include $(UTSBASE)/intel/Makefile.targ
 109 
 110 #
 111 #       Defines for local commands.
 112 #
 113 WARLOCK         = warlock
 114 WLCC            = wlcc
 115 TOUCH           = touch
 116 TEST            = test
 117 
 118 #
 119 #       lock_lint rules
 120 #
 121 USBA_FILES = $(USBA_OBJS:%.o=../usba/%.ll)
 122 UHCI_FILES = $(UHCI_OBJS:%.o=../uhci/%.ll)
 123 OHCI_FILES = $(OHCI_OBJS:%.o=../ohci/%.ll)
 124 EHCI_FILES = $(EHCI_OBJS:%.o=../ehci/%.ll)
 125 SD_FILES   = $(SD_OBJS:%.o=../sd/%.ll)
 126 ST_FILES   = $(ST_OBJS:%.o=../st/%.ll)
 127 SCSI_FILES = $(SCSI_OBJS:%.o= -l ../scsi/%.ll)
 128 CMLB_FILES = $(CMLB_OBJS:%.o=-l ../cmlb/%.ll)
 129 
 130 warlock: $(WARLOCK_OK) warlock_with_usba
 131 
 132 $(WARLOCK_OK): $(WARLOCK_OUT) $(WLCMD_DIR)/scsa2usb.wlcmd warlock_ddi.files \
 133         scsi.files
 134         $(WARLOCK) -c $(WLCMD_DIR)/scsa2usb.wlcmd $(WARLOCK_OUT)  \
 135                 ../warlock/scsi.ll \
 136                 $(SCSI_FILES) \
 137                 -l ../warlock/ddi_dki_impl.ll
 138         $(TOUCH) $@
 139 
 140 %.ll: $(UTSBASE)/common/io/usb/scsa2usb/%.c \
 141                 $(UTSBASE)/common/sys/usb/clients/mass_storage/usb_bulkonly.h \
 142                 $(UTSBASE)/common/sys/usb/clients/mass_storage/usb_cbi.h \
 143                 $(UTSBASE)/common/sys/usb/scsa2usb/scsa2usb.h
 144         $(WLCC)  $(CPPFLAGS) -DDEBUG -o $@ $<
 145 
 146 warlock_with_usba: $(WLCMD_DIR)/scsa2usb_with_usba.wlcmd \
 147         $(WARLOCK_OUT) usba_files \
 148         ohci_files ehci_files uhci_files warlock_ddi.files sd.files st.files \
 149         cmlb.files scsi.files
 150         $(WARLOCK) -c $(WLCMD_DIR)/scsa2usb_with_usba.wlcmd \
 151                 $(USBA_FILES) $(OHCI_FILES) $(EHCI_FILES) $(UHCI_FILES) \
 152                 $(SD_FILES) \
 153                 $(ST_FILES) \
 154                 $(CMLB_FILES) \
 155                 $(SCSI_FILES) \
 156                 $(WARLOCK_OUT) \
 157                 -l ../warlock/ddi_dki_impl.ll
 158 
 159 usba_files:
 160         @cd ../usba;pwd; $(MAKE) warlock
 161 
 162 uhci_files:
 163         @cd ../uhci;pwd; $(MAKE) warlock
 164 
 165 ohci_files:
 166         @cd ../ohci;pwd; $(MAKE) warlock
 167 
 168 ehci_files:
 169         @cd ../ehci;pwd; $(MAKE) warlock
 170 
 171 warlock_ddi.files:
 172         @cd ../warlock; pwd; $(MAKE) warlock
 173 
 174 scsi.files:
 175         @cd ../scsi; pwd; $(MAKE) warlock
 176 
 177 sd.files:
 178         @cd ../sd; pwd; $(MAKE) warlock_alone
 179 
 180 st.files:
 181         @cd ../st; pwd; $(MAKE) warlock_alone
 182 
 183 cmlb.files:
 184          @cd ../cmlb; pwd; $(MAKE) warlock