Makefile revision 1494
1494N/A#
1494N/A# Copyright (c) 2015, 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
1494N/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
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
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