blob: 2ce9a46a20cb8b7295bd60d1d87c6f2e8b7d1f8a [file] [log] [blame]
Daniel Dunbarb3a69012009-06-26 16:47:03 +00001# Makefile utilities
2
3###
4# Utility functions
5
Daniel Dunbarfaf01502010-01-18 06:48:33 +00006# Function: streq LHS RHS
7#
8# Return "true" if LHS == RHS, otherwise "".
9#
10# LHS == RHS <=> (LHS subst RHS is empty) and (RHS subst LHS is empty)
11streq = $(if $(1),$(if $(subst $(1),,$(2))$(subst $(2),,$(1)),,true),$(if $(2),,true))
12
13# Function: strneq LHS RHS
14#
15# Return "true" if LHS != RHS, otherwise "".
16strneq = $(if $(call streq,$(1),$(2)),,true)
17
Daniel Dunbarb3a69012009-06-26 16:47:03 +000018# Function: Set variable value
19#
20# Set the given make variable to the given value.
21Set = $(eval $(1) := $(2))
22
23# Function: Append variable value
24#
25# Append the given value to the given make variable.
26Append = $(eval $(1) += $(2))
27
28###
29# Clean up make behavior
30
31# Cancel all suffix rules. We don't want no stinking suffix rules.
32.SUFFIXES:
33
34###
35# Debugging
36
Daniel Dunbar557a6ea2010-01-13 16:13:01 +000037# General debugging rule, use 'make print-XXX' to print the definition, value
38# and origin of XXX.
39make-print-%:
Daniel Dunbarb3a69012009-06-26 16:47:03 +000040 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))
41