Makefile revision 1494
474N/A#
474N/A# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
474N/A#
474N/A# Permission is hereby granted, free of charge, to any person obtaining a
911N/A# copy of this software and associated documentation files (the "Software"),
474N/A# to deal in the Software without restriction, including without limitation
474N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
474N/A# and/or sell copies of the Software, and to permit persons to whom the
474N/A# Software is furnished to do so, subject to the following conditions:
474N/A#
474N/A# The above copyright notice and this permission notice (including the next
474N/A# paragraph) shall be included in all copies or substantial portions of the
474N/A# Software.
474N/A#
474N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
474N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
474N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
474N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
474N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
474N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
474N/A# DEALINGS IN THE SOFTWARE.
474N/A#
474N/A#
474N/A###############################################################################
474N/A#
474N/A# This Makefile builds mdb modules.
474N/A# It is designed to build both kernel kmdb and mdb .so files
474N/A#
474N/A###############################################################################
474N/A
474N/A
474N/ATOP:sh=hg root
474N/AKERNEL = $(TOP)/open-src/kernel
474N/Ainclude $(TOP)/open-src/common/Makefile.init
474N/A# Need common defaults
493N/Ainclude $(TOP)/open-src/common/Makefile.defs
474N/Ainclude $(KERNEL)/Makefile.rules
474N/A
493N/A# Need to figure out how to import this.
474N/A# ARCHLIBSUBDIR=amd64
911N/AKMOD = i915
911N/AMDBMOD = i915.so
911N/AMODULES = $(KMOD) $(MDBMOD)
911N/A
474N/ACFLAGS += -v -K PIC -xc99=%all -xdebugformat=stabs -xildoff
474N/ACFLAGS += -D_ELF64 -DMDB_DEBUG -D_KERNEL -D_KMDB -g -m64
474N/ACPPFLAGS += -I$(KERNEL) -I$(KERNEL)/sys/drm -I/usr/include
474N/AKMOD_LDFLAGS = -dy -r -Nmisc/kmdbmod -Mmapfile
474N/ASO_LDFLAGS = $(LDFLAGS) -Wl,-z,direct -Wl,-z,text -M mapfile -lc
493N/ASO_LDFLAGS += -Wl,-z,parent=/usr/bin$(ARCHLIBSUBDIR)/mdb
493N/ACPPFLAGS += -xO3 -m64 -Ui386 -U__i386 -Xa -errtags=yes -errwarn=%all \
474N/A -erroff=E_EMPTY_TRANSLATION_UNIT -erroff=E_STATEMENT_NOT_REACHED \
474N/A -W0,-xglobalstatic -g -W0,-noglobal \
474N/A -DTEXT_DOMAIN=\"SUNW_OST_OSCMD\" -D_ERRNO_VERIFY -DMDB_DEBUG \
474N/A -D_KERNEL -D_ELF64
SOURCES = i915.c
OBJECTS = $(SOURCES:%.c=%.o)
LINTFILES = $(SOURCES:%.c=%.ln)
BC_OBJS = $(SOURCES:%.c=%.o.bc)
all: $(MODULES)
.KEEP_STATE:
.NO_PARALLEL:
.PARALLEL: $(OBJECTS) $(LINTFILES)
$(OBJECTS): $(SOURCES)
@print CFLAGS=$(CFLAGS)
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
$(CTFCONVERT) $(CTFCVTFLAGS) $@
$(KMOD): $(OBJECTS)
$(LD) -o $@ $(OBJECTS) $(KMOD_LDFLAGS) $(LIBS)
$(CTFMERGE) $(CTFMERGE_LABEL) -o $@ $(OBJECTS)
$(MDBMOD): $(OBJECTS)
$(CC) $(CFLAGS) $(CPPFLAGS) -G -o $@ $(SOURCES) $(LDFLAGS) \
$(SO_LDFLAGS) $(LIBS)
install: $(MODULES)
@print Installing $(KMOD) in $(PROTODIR)$(ROOT_KMOD_DIR)
@print Installing $(MDBMOD) in $(PROTODIR)$(ROOT_MDB_DIR)
@mkdir -p $(PROTODIR)$(ROOT_KMOD_DIR)
@mkdir -p $(PROTODIR)$(ROOT_MDB_DIR)
@$(INSTALL_SCRIPT) -m 644 $(KMOD) $(PROTODIR)$(ROOT_KMOD_DIR)
@$(INSTALL_SCRIPT) -m 644 $(MDBMOD) $(PROTODIR)$(ROOT_MDB_DIR)
clean:
rm -f $(OBJECTS) $(BC_OBJS) $(MODULES)
clean.lint:
rm -f $(LINTFILES)
clobber: clean clean.lint
rm -f $(MODULES)
%.ln:%.c
$(LINT) $(LINTFLAGS) $(CPPFLAGS) -o $@ $<
lint: $(LINTFILES)