1450N/A#
1450N/A# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
1450N/A#
1450N/A# Permission is hereby granted, free of charge, to any person obtaining a
1450N/A# copy of this software and associated documentation files (the "Software"),
1450N/A# to deal in the Software without restriction, including without limitation
1450N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
1450N/A# and/or sell copies of the Software, and to permit persons to whom the
1450N/A# Software is furnished to do so, subject to the following conditions:
1450N/A#
1450N/A# The above copyright notice and this permission notice (including the next
1450N/A# paragraph) shall be included in all copies or substantial portions of the
1450N/A# Software.
1450N/A#
1450N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1450N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1450N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1450N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1450N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1450N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1450N/A# DEALINGS IN THE SOFTWARE.
1450N/A#
1450N/A#
1450N/A###############################################################################
1450N/A#
1450N/A# Makefile.inc - rules common to the kernel directory
1450N/A#
1450N/A###############################################################################
1450N/A
1450N/APWD:sh=pwd
1450N/ATOP:sh=hg root
1450N/A
1450N/AMODTYPE=driver
1450N/A
1450N/A# Hierarchical parent for pkg names in this area
1450N/A# Note that each driver needs to set the MODULE_PKGTAIL
1450N/A# value so that it can be appropriately installed in that package
1450N/A# e.g. i915/drm define this as "MODULE_PKGTAIL = drm"
1450N/AMODTYPE_PKGHIER = driver/graphics
1450N/AMODTYPE_PKGHIER_SET = yes
1450N/A
1450N/A# PKGCLASS - Drivers/Display for framebuffers.
1450N/AMODULE_PKGCLASS = Drivers/Display
1450N/AMODULE_PKGCLASS_SET = yes
1450N/A
1450N/A# The package that this belongs in - must match the name in pkg/manifests
1450N/A# This is something that should be a bit more dynamic.
1450N/AMODULE_PKG = driver-graphics-drm
1450N/A
1450N/A# Default module description for packages in this area
1450N/AMODTYPE_DESC = the $(MODULE_NAME) driver
1450N/A
1450N/A### Include common definitions
1450N/Ainclude $(TOP)/open-src/common/Makefile.init
1450N/A
1450N/A#
1450N/A# Default build types, driver is only 64 bit, and this one is x86 only.
1450N/A#
1450N/ABUILD_TYPES_DEFAULT = $(BUILD_TYPES_SET:yes=$(POUND_SIGN))
1450N/A# debug isn't working quite right yet
1450N/A# $(BUILD_TYPES_DEFAULT) BUILD_TYPES=64 debug
1450N/A$(BUILD_TYPES_DEFAULT) BUILD_TYPES=64
1450N/A# $(BUILD_TYPES_DEFAULT) BUILD_TYPES=64
1450N/A$(BUILD_TYPES_DEFAULT) BUILD_TYPES_SET=yes
1450N/A
1450N/A
1450N/A# Set comments in ELF binaries to help identify versions/builds
1450N/A# XXXX - We probably need something here, but not sure what.
1450N/A# MODTYPE_ADD_BUILD_TARGETS=set-elf-comments
1450N/A
1450N/A# Define common LDFLAGS
1450N/AMODTYPE_LDFLAGS = -zstrip-class=comment -zstrip-class=exclude
1450N/A
1450N/A#
1450N/A# Defines that are specific to kernel drivers
1450N/A#
1450N/A# Default build options
1450N/AUSE_DEFAULT_CONFIG_LDFLAGS = no
1450N/AUSE_DEFAULT_CONFIG_CPPFLAGS = no
1450N/AUSE_DEFAULT_CONFIG_ENV = no
1450N/A
1450N/A#
1450N/A# Much of the below is the redefinition of defines in the common
1450N/A# Makefiles. It was changed here as the environment is sufficiently
1450N/A# different for kernel modules that it introduced a fair amount of
1450N/A# changed code. So it was initially decided to separate the work
1450N/A# and figure later how to move this into common code (which can be
1450N/A# accomplished in smaller increments).
1450N/A
1450N/A#
1450N/A# Due to the common Makefile's use of DEFAULT_LD_OPTIONS, we clear it here.
1450N/A#
1450N/ADEFAULT_LD_OPTIONS =
1450N/A
1450N/A#
1450N/A# Define CONFIG_ENV for kernel modules here.
1450N/A# Note that _anything_ needed to build these modules must be listed here
1450N/A# as they are not retained from the common Makefiles.
1450N/A#
1450N/ACONFIG_ENV = CC="$(CC)" CXX="$(CXX)" AR="$(AR)"
1450N/ACONFIG_ENV += LD="$(LD)"
1450N/ACONFIG_ENV += CFLAGS="$(MODTYPE_CFLAGS) $(MODULE_CFLAGS)"
1450N/ACONFIG_ENV += CXXFLAGS="$(MODTYPE_CXXFLAGS) $(MODULE_CXXFLAGS)"
1450N/ACONFIG_ENV += CPPFLAGS="$(DEFAULT_CONFIG_CPPFLAGS) $(MODTYPE_CPPFLAGS) $(MODULE_CPPFLAGS)"
1450N/ACONFIG_ENV += LDFLAGS="$(MODULE_LDFLAGS) $(MODTYPE_LDFLAGS)"
1450N/ACONFIG_ENV += PKG_CONFIG_PATH="$(DEFAULT_PKG_CONFIG_PATH)"
1450N/ACONFIG_ENV += INSTALL="$(INSTALL_SCRIPT)" CPPROG="cp -p"
1450N/ACONFIG_ENV += MAKE="$(MODULE_MAKE)" CONFIG_SHELL="$(CONFIG_SHELL)"
1450N/ACONFIG_ENV += NM="/usr/gnu/bin/nm"
1450N/ACONFIG_ENV += POUND_SIGN="$(POUND_SIGN)"
1450N/ACONFIG_ENV += PROTOMETA="$(PROTOMETA)/$(MODULE_PKG)"
1450N/ACONFIG_ENV += X11_MAN_DIR="$(X11_MAN_DIR)"
1450N/A
1450N/A# Where to find the common include files
1450N/ADRM_INCL = -I$(TOP)/open-src/kernel/sys/drm -I$(TOP)/open-src/kernel/sys
1450N/A
1450N/A#
1450N/A# CFLAGS for modules in open-src/kernel
1450N/A#
1450N/A# Compiler flags for kernel modules
1450N/AKFLAGS = -m64 -U$(MACH) -U__$(MACH) -xmodel=kernel -xvector=none \
1450N/A -Wu,-save_args -v -xildoff -D_KERNEL -D_ELF64 -D_DDI_STRICT \
1450N/A -Dsun -D__sun -D__SVR4 -D_SYSCALL32 -D_SYSCALL32_IMPL \
1450N/A -D_ASM_INLINES -Xa -xspace -xdebugformat=stabs -errtags=yes \
1450N/A -errwarn=%all -W0,-xglobalstatic
1450N/A
1450N/A# Architecture specific flags
1450N/A# New flags for sunstudio12.4
1450N/A# KFLAGS_i386 += -W2,-xregs=no%float
1450N/A# KFLAGS_i386 += -Wu,-xregs=no%float
1450N/A# KFLAGS_i386 += -W0,-y-xregs=no%float
1450N/A
1450N/A# To make sure ctfconvert has CTF data
1450N/ACTF_FLAGS = -g
1450N/A
1450N/AINC_PATH = -I. $(DRM_INCL) -I/usr/include
1450N/A
1450N/A# Debug cflags - added in the "debug" path of the target makefile.
1450N/AMODTYPE_CFLAGS_DEBUG = -DDEBUG
1450N/A
1450N/AMODTYPE_CPPFLAGS = $(INC_PATH)
1450N/AMODTYPE_CFLAGS = $(INC_PATH) $(KFLAGS) $(KFLAGS_$(MACH)) $(CTF_FLAGS) $(PROG_FLAGS)
1450N/A
1450N/A#
1450N/A# Define the MODTYPE environment
1450N/A#
1450N/AMODTYPE_BUILD_ENV = CFLAGS='$(MODTYPE_CFLAGS)'
1450N/AMODTYPE_BUILD_ENV += CC='$(CC)' LD='$(LD)' LINT='$(LINT)'
1450N/A
1450N/A### Include common file
1450N/Ainclude $(TOP)/open-src/common/Makefile.inc