Makefile revision 1676
1fdd2470b625a58b57d0b155e6caf8c4fc0afe8aAutomatic Updater# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Permission is hereby granted, free of charge, to any person obtaining a
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# copy of this software and associated documentation files (the "Software"),
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# to deal in the Software without restriction, including without limitation
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the rights to use, copy, modify, merge, publish, distribute, sublicense,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# and/or sell copies of the Software, and to permit persons to whom the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Software is furnished to do so, subject to the following conditions:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# The above copyright notice and this permission notice (including the next
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# paragraph) shall be included in all copies or substantial portions of the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
d3907d27cc138f45772d3d63082ae02c7659148aAutomatic Updater# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# DEALINGS IN THE SOFTWARE.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein###############################################################################
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Primary Makefile to build the components in open-src/kernel
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein###############################################################################
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Definitions that are similar to other Makefiles
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# MACH will be either "sparc" or "i386"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# This is used for setting pkg attributes, so save for later.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Variables to always pass down to subdirs
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic UpdaterPASSDOWN_VARS = V="$(V)" TOP="$(TOP)" CDEBUGFLAGS="$(CDEBUGFLAGS)"
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater $(MAKE) -e $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=$@
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# No tarballs to archive
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# debug isn't working quite right yet.
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater# World: clean all debug install
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updaterclean: clean-subdirs clean-obsolete-subdirs
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=clean
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=clobber
a1ad6695ed6f988406cf155aa26376f84f73bcb9Automatic Updater print "## making debug" $(OS_TARGET) "in open-src/kernel/$(DIRNAME)$@..."; \
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) $(DEBUGPASSDOWN) $(OS_TARGET)
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater @case '${MAKEFLAGS}' in *[ik]*) set +e;; esac; \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein print "## making" $(OS_TARGET) "in open-src/kernel/$(DIRNAME)$@..."; \
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) $(OS_TARGET)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if [[ -d $$i ]] ; then \
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater $(MAKE) $(MAKEFLAGS) subdirs OS_TARGET=clean OS_SUBDIRS=$$i ; \
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater print "## removing obsolete build directories in open-src/$(DIRNAME)$$i..."; \
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater ($(START_CMD_ECHO) ; cd $$i && rm -rf build* .checksum* ) ; \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Build various x-ref's
71c66a876ecca77923638d3f94cc0783152b2f03Mark AndrewsXREFDIRS = Make* sys $(OS_SUBDIRS_i386) $(OS_SUBDIRS_sparc) $(PROTODIR)/usr/include/drm
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein find $(XREFDIRS) -follow -name "Make*" -o -name "*.[ch]" > $@; \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if [[ -f gfxp_files ]]; then \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein @rm -f cscope.files cscope.in.out cscope.out cscope.out.in cscope.out.po cscope.po.out
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Create local Parfait output
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein @if [[ ! -d $@ ]] ; then mkdir $@ ; fi ; \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein -@echo "Making Parfait" ; \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein parfait -e all -c ${TOP}/open-src/common/X-parfait.conf \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein -z "${TOP}/open-src/kernel" -j "${PARFAIT_MAX_JOBS}" \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein -r "${XBUILD_HG_ID}" -o ${PLOG}/parfait.txt -g ${PLOG}/parfait \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ${TOP}/open-src/kernel > ${PLOG}/parfait.out 2>&1 ; \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if [[ $$? != 0 ]]; \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein then echo "Parfait defects discovered, see ${PWD}/${PLOG}"; \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Dummy target to force another target to always be run, even if a file
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# or directory with the same name already exists (as it will for subdirs)
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Tell dmake it can build subdirs in parallel
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Dependencies between modules