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