1# Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5# This file contains definitions that are specific to the invocation 6# and usage of Gnu Make. 7 8ifndef VERBOSE 9# Be silent unless 'VERBOSE' is set on the make command line. 10SILENT = --silent 11endif 12 13ifndef ADHD_BUILD_DIR 14export ADHD_BUILD_DIR = $(ADHD_DIR)/build/$(BOARD) 15endif 16 17GAVD_ARCHIVE = $(ADHD_BUILD_DIR)/lib/gavd.a 18 19LIBS = \ 20 -L$(ADHD_DIR)/cras/src/.libs \ 21 $(GAVD_ARCHIVE) \ 22 $(foreach lib,$(MY_LIBS),-l$(lib)) 23 24# mkdir: Creates a directory, and all its parents, if it does not exist. 25# 26mkdir = [ ! -d $(1) ] && \ 27 $(MKDIR) --parents $(1) || true 28 29# remake: Gnu Make function which will create the build directory, 30# then build the first argument by recursively invoking make. 31# The recursive make is performed in the build directory. 32# 33# $(call remake,<label>,<subdirectory>,<makefile>,<target>) 34# 35# ex: @$(call remake,Building,gavd,Makefile,gavd) 36# $(1) $(2) $(3) $(4) 37# 38# REL_DIR: 39# 40# Directory relative from the root of the source tree. REL_DIR is 41# built up using the previous value plus the current target 42# directory. 43# 44# ADHD_SOURCE_DIR: 45# 46# The directory containing the sources for the target directory 47# being built. This is used by Makefiles to access files in the 48# source directory. It has the same value as VPATH. 49# 50# THIS_BUILD_DIR: 51# 52# The build directory which is currently being built. This is the 53# same 'pwd', and the directory in which Make is building. 54# 55# The build is performed in the build directory and VPATH is used to 56# allow Make to find the source files in the source directory. 57# 58remake = \ 59 +($(if $(REL_DIR), \ 60 export REL_DIR=$${REL_DIR}/$(2), \ 61 export REL_DIR=$(2)) && \ 62 $(call mkdir,$(ADHD_BUILD_DIR)/$${REL_DIR}) && \ 63 $(MESSAGE) "$(1) $${REL_DIR}"; \ 64 $(MAKE) $(SILENT) \ 65 -f $(ADHD_DIR)/$${REL_DIR}/$(3) \ 66 -C $(ADHD_BUILD_DIR)/$${REL_DIR} \ 67 VPATH=$(ADHD_DIR)/$${REL_DIR} \ 68 ADHD_SOURCE_DIR=$(ADHD_DIR)/$${REL_DIR} \ 69 THIS_BUILD_DIR=$(ADHD_BUILD_DIR)/$${REL_DIR} \ 70 $(4)) 71