gmsl 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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-2018 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. # Determine if the library has already been included and if so don't
  42. # bother including it again
  43. ifndef __gmsl_included
  44. # Standard definitions for true and false. true is any non-empty
  45. # string, false is an empty string. These are intended for use with
  46. # $(if).
  47. true := T
  48. false :=
  49. # ----------------------------------------------------------------------------
  50. # Function: not
  51. # Arguments: 1: A boolean value
  52. # Returns: Returns the opposite of the arg. (true -> false, false -> true)
  53. # ----------------------------------------------------------------------------
  54. not = $(if $1,$(false),$(true))
  55. # Prevent reinclusion of the library
  56. __gmsl_included := $(true)
  57. # Try to determine where this file is located. If the caller did
  58. # include /foo/gmsl then extract the /foo/ so that __gmsl gets
  59. # included transparently
  60. __gmsl_root :=
  61. ifneq ($(MAKEFILE_LIST),)
  62. __gmsl_root := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
  63. # If there are any spaces in the path in __gmsl_root then give up
  64. ifeq (1,$(words $(__gmsl_root)))
  65. __gmsl_root := $(patsubst %gmsl,%,$(__gmsl_root))
  66. endif
  67. endif
  68. include $(__gmsl_root)__gmsl
  69. endif # __gmsl_included