Makefile revision 1637
1494N/A#
1611N/A# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
1494N/A#
1494N/A# Permission is hereby granted, free of charge, to any person obtaining a
1494N/A# copy of this software and associated documentation files (the "Software"),
1494N/A# to deal in the Software without restriction, including without limitation
1494N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
1494N/A# and/or sell copies of the Software, and to permit persons to whom the
1494N/A# Software is furnished to do so, subject to the following conditions:
1494N/A#
1494N/A# The above copyright notice and this permission notice (including the next
1494N/A# paragraph) shall be included in all copies or substantial portions of the
1494N/A# Software.
1494N/A#
1494N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1494N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1494N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1494N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1494N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1494N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1494N/A# DEALINGS IN THE SOFTWARE.
1494N/A#
1494N/A#
1494N/A###############################################################################
1494N/A#
1494N/A# Primary Makefile to build the components in open-src/kernel
1494N/A#
1494N/A###############################################################################
1494N/A
1494N/ATOP:sh=hg root
1494N/A
1494N/Ainclude $(TOP)/open-src/common/Makefile.init
1494N/A
1494N/A#
1494N/A# Definitions that are similar to other Makefiles
1494N/A#
1494N/AOS_SUBDIRS_common =
1494N/A
1537N/AOS_SUBDIRS_sparc = $(OS_SUBDIRS_common)
1494N/A
1494N/AOS_SUBDIRS_i386 = $(OS_SUBDIRS_common) \
1494N/A drm \
1494N/A i915 \
1494N/A mdb
1494N/A
1494N/A# MACH will be either "sparc" or "i386"
1494N/AMACH=$(TARGET_ARCH:-%=%)
1494N/A
1494N/A# This is used for setting pkg attributes, so save for later.
1494N/ASTART_CMD_ECHO = PS4="" ; set -x
1494N/A
1494N/AOS_SUBDIRS=$(OS_SUBDIRS_$(MACH))
1494N/A
1494N/A# Variables to always pass down to subdirs
1494N/APASSDOWN_VARS = V="$(V)" TOP="$(TOP)" CDEBUGFLAGS="$(CDEBUGFLAGS)"
1494N/A
1494N/A.DEFAULT:
1494N/A $(MAKE) -e $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=$@
1494N/A
1494N/A# debug isn't working quite right yet.
1494N/A# World: clean all debug install
1494N/AWorld: clean all install lint
1494N/A
1494N/Aclean: clean-subdirs clean-obsolete-subdirs
1494N/A
1494N/Aclean-subdirs:
1494N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=clean
1494N/A
1611N/Aclobber: xref-clobber parfait-clobber
1512N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=clobber
1512N/A
1494N/Asubdirs: $(OS_SUBDIRS)
1494N/A
1494N/Adebug:
1494N/A @ set +e; \
1494N/A cd $@ ; \
1494N/A print "## making debug" $(OS_TARGET) "in open-src/kernel/$(DIRNAME)$@..."; \
1494N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) $(DEBUGPASSDOWN) $(OS_TARGET)
1494N/A
1494N/A$(OS_SUBDIRS): ALWAYS_RUN
1494N/A @case '${MAKEFLAGS}' in *[ik]*) set +e;; esac; \
1494N/A cd $@ ; \
1494N/A print "## making" $(OS_TARGET) "in open-src/kernel/$(DIRNAME)$@..."; \
1494N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) $(OS_TARGET)
1494N/A
1494N/Aclean-obsolete-subdirs:
1494N/A @ set +e; \
1494N/A if [[ ! -z "$(OBSOLETE_SUBDIRS)" ]] ; then \
1494N/A for i in $(OBSOLETE_SUBDIRS) ; do \
1494N/A if [[ -d $$i ]] ; then \
1494N/A if [[ -f $$i/Makefile ]] ; then \
1494N/A $(MAKE) $(MAKEFLAGS) subdirs OS_TARGET=clean OS_SUBDIRS=$$i ; \
1494N/A else ; \
1494N/A print "## removing obsolete build directories in open-src/$(DIRNAME)$$i..."; \
1494N/A ($(START_CMD_ECHO) ; cd $$i && rm -rf build* .checksum* ) ; \
1494N/A ($(START_CMD_ECHO) ; rmdir $$i ) ; \
1494N/A fi ; \
1494N/A fi ; \
1494N/A done ; \
1494N/A fi ; \
1494N/A return 0
1494N/A
1512N/A# Build various x-ref's
1637N/AXREFDIRS = Make* sys $(OS_SUBDIRS_i386) $(OS_SUBDIRS_sparc) $(PROTODIR)/usr/include/drm
1611N/A
1512N/Axref: tags cscope.out
1512N/A
1512N/Axref-clobber: tags-clobber cscope-clobber
1512N/A
1512N/Acscope.files: ALWAYS_RUN
1637N/A @echo "Building filelist from $(XREFDIRS)"; \
1637N/A find $(XREFDIRS) -follow -name "Make*" -o -name "*.[ch]" > $@; \
1611N/A if [[ -f gfxp_files ]]; then \
1611N/A /usr/bin/cat -s gfxp_files >> $@; \
1611N/A fi
1512N/A
1512N/Atags: cscope.files
1512N/A @ctags -tw `cat cscope.files`
1512N/A
1512N/Atags-clobber:
1512N/A @rm -f tags cscope.files
1512N/A
1512N/Acscope.out: cscope.files
1512N/A @cscope-fast -bq
1512N/A
1512N/Acscope-clobber:
1512N/A @rm -f cscope.files cscope.in.out cscope.out cscope.out.in cscope.out.po cscope.po.out
1512N/A
1611N/A# Create local Parfait output
1611N/AXBUILD_HG_ID:sh=hg id -i
1611N/APLOG = parfait_log
1611N/APARFAIT_MAX_JOBS = 100%
1611N/A
1611N/A
1611N/A${PLOG}:
1611N/A @if [[ ! -d $@ ]] ; then mkdir $@ ; fi ; \
1611N/A
1611N/Aparfait: ALWAYS_RUN ${PLOG}
1611N/A -@echo "Making Parfait" ; \
1611N/A parfait -e all -c ${TOP}/open-src/common/X-parfait.conf \
1611N/A -z "${TOP}/open-src/kernel" -j "${PARFAIT_MAX_JOBS}" \
1611N/A -r "${XBUILD_HG_ID}" -o ${PLOG}/parfait.txt -g ${PLOG}/parfait \
1611N/A ${TOP}/open-src/kernel > ${PLOG}/parfait.out 2>&1 ; \
1611N/A if [[ $$? != 0 ]]; \
1611N/A then echo "Parfait defects discovered, see ${PWD}/${PLOG}"; \
1611N/A fi ; \
1611N/A return 0
1611N/A
1611N/Aparfait-clobber:
1611N/A rm -rf ${PLOG}
1611N/A
1494N/A# Dummy target to force another target to always be run, even if a file
1494N/A# or directory with the same name already exists (as it will for subdirs)
1494N/AALWAYS_RUN:
1494N/A
1494N/A# Tell dmake it can build subdirs in parallel
1494N/A.PARALLEL: $(OS_SUBDIRS)
1494N/A
1494N/A# Dependencies between modules
1494N/Ai915: drm