1 # ----------------------------------------------------------------------------
3 # GNU Make Standard Library (GMSL)
5 # A library of functions to be used with GNU Make's $(call) that
6 # provides functionality not available in standard GNU Make.
8 # Copyright (c) 2005-2007 John Graham-Cumming
10 # This file is part of GMSL
12 # Redistribution and use in source and binary forms, with or without
13 # modification, are permitted provided that the following conditions
16 # Redistributions of source code must retain the above copyright
17 # notice, this list of conditions and the following disclaimer.
19 # Redistributions in binary form must reproduce the above copyright
20 # notice, this list of conditions and the following disclaimer in the
21 # documentation and/or other materials provided with the distribution.
23 # Neither the name of the John Graham-Cumming nor the names of its
24 # contributors may be used to endorse or promote products derived from
25 # this software without specific prior written permission.
27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 # POSSIBILITY OF SUCH DAMAGE.
40 # ----------------------------------------------------------------------------
42 # Determine if the library has already been included and if so don't
43 # bother including it again
45 ifndef __gmsl_included
47 # Standard definitions for true and false. true is any non-empty
48 # string, false is an empty string. These are intended for use with
54 # ----------------------------------------------------------------------------
56 # Arguments: 1: A boolean value
57 # Returns: Returns the opposite of the arg. (true -> false, false -> true)
58 # ----------------------------------------------------------------------------
59 not = $(if $1,$(false),$(true))
61 # Prevent reinclusion of the library
63 __gmsl_included := $(true)
65 # Try to determine where this file is located. If the caller did
66 # include /foo/gmsl then extract the /foo/ so that __gmsl gets
67 # included transparently
69 __gmsl_root := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
71 # If there are any spaces in the path in __gmsl_root then give up
73 ifeq (1,$(words $(__gmsl_root)))
74 __gmsl_root := $(patsubst %gmsl,%,$(__gmsl_root))
79 include $(__gmsl_root)__gmsl
81 endif # __gmsl_included