1 # ---------------------------------------------------------------------------- 2 # 3 # GNU Make Standard Library (GMSL) 4 # 5 # A library of functions to be used with GNU Make's $(call) that 6 # provides functionality not available in standard GNU Make. 7 # 8 # Copyright (c) 2005-2008 John Graham-Cumming 9 # 10 # This file is part of GMSL 11 # 12 # Redistribution and use in source and binary forms, with or without 13 # modification, are permitted provided that the following conditions 14 # are met: 15 # 16 # Redistributions of source code must retain the above copyright 17 # notice, this list of conditions and the following disclaimer. 18 # 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. 22 # 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. 26 # 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. 39 # 40 # ---------------------------------------------------------------------------- 41 42 # Determine if the library has already been included and if so don't 43 # bother including it again 44 45 ifndef __gmsl_included 46 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 49 # $(if). 50 51 true := T 52 false := 53 54 # ---------------------------------------------------------------------------- 55 # Function: not 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)) 60 61 # Prevent reinclusion of the library 62 63 __gmsl_included := $(true) 64 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 68 69 ifneq ($(MAKEFILE_LIST),) 70 __gmsl_root := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) 71 72 # If there are any spaces in the path in __gmsl_root then give up 73 74 ifeq (1,$(words $(__gmsl_root))) 75 __gmsl_root := $(patsubst %gmsl,%,$(__gmsl_root)) 76 else 77 __gmsl_root := 78 endif 79 80 include $(__gmsl_root)__gmsl 81 82 else 83 84 include __gmsl 85 86 endif 87 88 endif # __gmsl_included 89 90