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 #
  23 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 
  27 #
  28 #       This makefile drives the production of the generic
  29 #       unix kernel module.
  30 #
  31 #       x86 implementation architecture dependent
  32 #
  33 
  34 #
  35 #       Path to the base of the uts directory tree (usually /usr/src/uts).
  36 #
  37 UTSBASE = ../..
  38 
  39 #
  40 #       Define the module and object file sets.
  41 #
  42 MODULE          = genunix
  43 GENUNIX         = $(OBJS_DIR)/$(MODULE)
  44 
  45 OBJECTS         = $(GENUNIX_OBJS:%=$(OBJS_DIR)/%) \
  46                   $(NOT_YET_KMODS:%=$(OBJS_DIR)/%)
  47 
  48 LINTS           = $(GENUNIX_OBJS:%.o=$(LINTS_DIR)/%.ln) \
  49                   $(NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln)
  50 
  51 ROOTMODULE      = $(ROOT_KERN_DIR)/$(MODULE)
  52 
  53 LIBGEN          = $(OBJS_DIR)/libgenunix.so
  54 LIBSTUBS        = $(GENSTUBS_OBJS:%=$(OBJS_DIR)/%)
  55 
  56 #
  57 #       Include common rules.
  58 #
  59 include $(UTSBASE)/intel/Makefile.intel
  60 
  61 #
  62 #       Define targets
  63 #
  64 ALL_TARGET      = $(LIBGEN)
  65 LINT_TARGET     = $(MODULE).lint
  66 INSTALL_TARGET  = $(GENUNIX) $(ROOTMODULE)
  67 
  68 #
  69 #       Overrides
  70 #
  71 CLOBBERFILES    += $(GENUNIX)
  72 CLEANFILES      += $(LIBSTUBS) $(LIBGEN)
  73 BINARY          =
  74 
  75 CPPFLAGS        += -I$(SRC)/common
  76 CPPFLAGS        += -I$(SRC)/uts/common/fs/zfs
  77 
  78 CPPFLAGS        += -I$(UTSBASE)/i86pc
  79 
  80 #
  81 # For now, disable these lint checks; maintainers should endeavor
  82 # to investigate and remove these for maximum lint coverage.
  83 # Please do not carry these forward to new Makefiles.
  84 #
  85 LINTTAGS        += -erroff=E_SUSPICIOUS_COMPARISON
  86 LINTTAGS        += -erroff=E_BAD_PTR_CAST_ALIGN
  87 LINTTAGS        += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
  88 LINTTAGS        += -erroff=E_STATIC_UNUSED
  89 LINTTAGS        += -erroff=E_PTRDIFF_OVERFLOW
  90 LINTTAGS        += -erroff=E_ASSIGN_NARROW_CONV
  91 
  92 CERRWARN        += -_gcc=-Wno-unused-label
  93 CERRWARN        += -_gcc=-Wno-unused-variable
  94 CERRWARN        += -_gcc=-Wno-unused-value
  95 CERRWARN        += -_gcc=-Wno-unused-function
  96 CERRWARN        += -_gcc=-Wno-parentheses
  97 CERRWARN        += -_gcc=-Wno-switch
  98 CERRWARN        += -_gcc=-Wno-type-limits
  99 CERRWARN        += -_gcc=-Wno-uninitialized
 100 CERRWARN        += -_gcc=-Wno-clobbered
 101 CERRWARN        += -_gcc=-Wno-empty-body
 102 
 103 #
 104 # Ensure that lint sees 'struct cpu' containing a fully declared
 105 # embedded 'struct machcpu'
 106 #
 107 LINTFLAGS       += -D_MACHDEP -I../../i86pc
 108 
 109 #
 110 #       Default build targets.
 111 #
 112 .KEEP_STATE:
 113 
 114 def:            $(DEF_DEPS)
 115 
 116 all:            $(ALL_DEPS)
 117 
 118 clean:          $(CLEAN_DEPS)
 119 
 120 clobber:        $(CLOBBER_DEPS)
 121 
 122 lint:           $(LINT_DEPS)
 123 
 124 modlintlib:     $(MODLINTLIB_DEPS)
 125 
 126 clean.lint:     $(CLEAN_LINT_DEPS)
 127 
 128 install:        $(INSTALL_DEPS)
 129 
 130 $(LIBGEN):      $(GENUNIX) $(LIBSTUBS)
 131         $(BUILD.SO) $(GENUNIX) $(LIBSTUBS)
 132 
 133 $(GENUNIX): $(OBJECTS)
 134         $(LD) -r $(LDFLAGS) -o $@ $(OBJECTS)
 135         $(CTFMERGE_MODULE)
 136         $(POST_PROCESS)
 137 
 138 #
 139 #       Include common targets.
 140 #
 141 include $(UTSBASE)/intel/Makefile.targ
 142 
 143 #
 144 #       Software workarounds for hardware "features".
 145 #
 146 include $(UTSBASE)/i86pc/Makefile.workarounds
 147 
 148 ALL_DEFS += $(WORKAROUND_DEFS)
 149 
 150 #
 151 # Override.
 152 #
 153 $(MODULE).lint := GEN_LINT_LIB =