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# Primary Makefile to build the components in open-src/kernel
1450N/A#
1450N/A###############################################################################
1450N/A
1450N/ATOP:sh=hg root
1450N/A
1450N/Ainclude $(TOP)/open-src/common/Makefile.init
1450N/A
1450N/A#
1450N/A# Definitions that are similar to other Makefiles
1450N/A#
1450N/AOS_SUBDIRS_common =
1450N/A
1450N/AOS_SUBDIRS_sparc = $(OS_SUBDIRS_common) \
1450N/A efb
1450N/A
1450N/AOS_SUBDIRS_i386 = $(OS_SUBDIRS_common) \
1450N/A drm \
1450N/A i915 \
1450N/A mdb
1450N/A
1450N/A# MACH will be either "sparc" or "i386"
1450N/AMACH=$(TARGET_ARCH:-%=%)
1450N/A
1450N/A# This is used for setting pkg attributes, so save for later.
1450N/ASTART_CMD_ECHO = PS4="" ; set -x
1450N/A
1450N/AOS_SUBDIRS=$(OS_SUBDIRS_$(MACH))
1450N/A
1450N/A# Variables to always pass down to subdirs
1450N/APASSDOWN_VARS = V="$(V)" TOP="$(TOP)" CDEBUGFLAGS="$(CDEBUGFLAGS)"
1450N/A
1450N/A.DEFAULT:
1450N/A $(MAKE) -e $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=$@
1450N/A
1450N/A# debug isn't working quite right yet.
1450N/A# World: clean all debug install
1450N/AWorld: clean all install lint
1450N/A
1450N/Aclean: clean-subdirs clean-obsolete-subdirs
1450N/A
1450N/Aclean-subdirs:
1450N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=clean
1450N/A
1450N/Aclobber: xref-clobber
1450N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=clobber
1450N/A
1450N/Asubdirs: $(OS_SUBDIRS)
1450N/A
1450N/Adebug:
1450N/A @ set +e; \
1450N/A cd $@ ; \
1450N/A print "## making debug" $(OS_TARGET) "in open-src/kernel/$(DIRNAME)$@..."; \
1450N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) $(DEBUGPASSDOWN) $(OS_TARGET)
1450N/A
1450N/A$(OS_SUBDIRS): ALWAYS_RUN
1450N/A @case '${MAKEFLAGS}' in *[ik]*) set +e;; esac; \
1450N/A cd $@ ; \
1450N/A print "## making" $(OS_TARGET) "in open-src/kernel/$(DIRNAME)$@..."; \
1450N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) $(OS_TARGET)
1450N/A
1450N/Aclean-obsolete-subdirs:
1450N/A @ set +e; \
1450N/A if [[ ! -z "$(OBSOLETE_SUBDIRS)" ]] ; then \
1450N/A for i in $(OBSOLETE_SUBDIRS) ; do \
1450N/A if [[ -d $$i ]] ; then \
1450N/A if [[ -f $$i/Makefile ]] ; then \
1450N/A $(MAKE) $(MAKEFLAGS) subdirs OS_TARGET=clean OS_SUBDIRS=$$i ; \
1450N/A else ; \
1450N/A print "## removing obsolete build directories in open-src/$(DIRNAME)$$i..."; \
1450N/A ($(START_CMD_ECHO) ; cd $$i && rm -rf build* .checksum* ) ; \
1450N/A ($(START_CMD_ECHO) ; rmdir $$i ) ; \
1450N/A fi ; \
1450N/A fi ; \
1450N/A done ; \
1450N/A fi ; \
1450N/A return 0
1450N/A
1450N/A# Build various x-ref's
1450N/Axref: tags cscope.out
1450N/A
1450N/Axref-clobber: tags-clobber cscope-clobber
1450N/A
1450N/Acscope.files: ALWAYS_RUN
1450N/A @find sys $(OS_SUBDIRS_i386) $(OS_SUBDIRS_sparc) -name "Make*" -o -name "*.[ch]" > $@
1450N/A
1450N/Atags: cscope.files
1450N/A @ctags -tw `cat cscope.files`
1450N/A
1450N/Atags-clobber:
1450N/A @rm -f tags cscope.files
1450N/A
1450N/Acscope.out: cscope.files
1450N/A @cscope-fast -bq
1450N/A
1450N/Acscope-clobber:
1450N/A @rm -f cscope.files cscope.in.out cscope.out cscope.out.in cscope.out.po cscope.po.out
1450N/A
1450N/A# Dummy target to force another target to always be run, even if a file
1450N/A# or directory with the same name already exists (as it will for subdirs)
1450N/AALWAYS_RUN:
1450N/A
1450N/A# Tell dmake it can build subdirs in parallel
1450N/A.PARALLEL: $(OS_SUBDIRS)
1450N/A
1450N/A# Dependencies between modules
1450N/Ai915: drm