Makefile revision 1500
1276N/A#
1026N/A# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
1276N/A#
1276N/A# Permission is hereby granted, free of charge, to any person obtaining a
1377N/A# copy of this software and associated documentation files (the "Software"),
1026N/A# to deal in the Software without restriction, including without limitation
1026N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
1026N/A# and/or sell copies of the Software, and to permit persons to whom the
1026N/A# Software is furnished to do so, subject to the following conditions:
1026N/A#
1026N/A# The above copyright notice and this permission notice (including the next
1026N/A# paragraph) shall be included in all copies or substantial portions of the
1026N/A# Software.
1026N/A#
1026N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1026N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1026N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1026N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1026N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1026N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1026N/A# DEALINGS IN THE SOFTWARE.
1026N/A#
1026N/A#
1026N/A###############################################################################
1026N/A#
1026N/A# This Makefile builds mdb modules.
1026N/A# It is designed to build both kernel kmdb and mdb .so files
1026N/A#
1026N/A###############################################################################
1026N/A
1026N/A
1276N/ATOP:sh=hg root
1026N/AKERNEL = $(TOP)/open-src/kernel
1026N/ABUILD_TYPE = 64
1276N/Ainclude $(TOP)/open-src/common/Makefile.init
1276N/A# Need common defaults
1276N/Ainclude $(TOP)/open-src/common/Makefile.defs
1026N/Ainclude $(KERNEL)/Makefile.rules
1377N/A
1377N/AKMOD = i915
1377N/AMDBMOD = i915.so
1302N/AMODULES = $(KMOD) $(MDBMOD)
1302N/A
1302N/ACFLAGS += -v -K PIC -xc99=%all -xdebugformat=stabs -xildoff
1026N/ACFLAGS += -D_ELF64 -DMDB_DEBUG -D_KERNEL -D_KMDB -g -m64
1026N/ACPPFLAGS += -I$(KERNEL) -I$(KERNEL)/sys/drm -I/usr/include
1026N/AKMOD_LDFLAGS = -dy -r -Nmisc/kmdbmod -Mmapfile
1026N/ASO_LDFLAGS = $(LDFLAGS) -Wl,-z,direct -Wl,-z,text -M mapfile
1276N/ASO_LDFLAGS += -Wl,-z,parent=/usr/bin$(ARCHLIBSUBDIR)/mdb
1276N/ACPPFLAGS += -xO3 -m64 -Ui386 -U__i386 -Xa -errtags=yes -errwarn=%all \
1026N/A -erroff=E_EMPTY_TRANSLATION_UNIT -erroff=E_STATEMENT_NOT_REACHED \
1026N/A -W0,-xglobalstatic -g -W0,-noglobal \
-DTEXT_DOMAIN=\"SUNW_OST_OSCMD\" -D_ERRNO_VERIFY -DMDB_DEBUG \
-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 555 $(KMOD) $(PROTODIR)$(ROOT_KMOD_DIR)
@$(INSTALL_SCRIPT) -m 555 $(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)