Kconfig 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # SPDX-License-Identifier: GPL-2.0
  2. # Shorthand
  3. warning = $(warning-if,y,$(1))
  4. # Simply expanded variable.
  5. X := 1
  6. SIMPLE := $(X)
  7. X := 2
  8. $(warning,SIMPLE = $(SIMPLE))
  9. # Recursively expanded variable.
  10. X := 1
  11. RECURSIVE = $(X)
  12. X := 2
  13. $(warning,RECURSIVE = $(RECURSIVE))
  14. # Append something to a simply expanded variable.
  15. Y := 3
  16. SIMPLE += $(Y)
  17. Y := 4
  18. $(warning,SIMPLE = $(SIMPLE))
  19. # Append something to a recursively expanded variable.
  20. Y := 3
  21. RECURSIVE += $(Y)
  22. Y := 4
  23. $(warning,RECURSIVE = $(RECURSIVE))
  24. # Use += operator to an undefined variable.
  25. # This works as a recursively expanded variable.
  26. Y := 3
  27. UNDEFINED_VARIABLE += $(Y)
  28. Y := 4
  29. $(warning,UNDEFINED_VARIABLE = $(UNDEFINED_VARIABLE))
  30. # You can use variable references for the lefthand side of assignment statement.
  31. X := A
  32. Y := B
  33. $(X)$(Y) := 5
  34. $(warning,AB = $(AB))
  35. # User-defined function.
  36. greeting = $(1), my name is $(2).
  37. $(warning,$(greeting,Hello,John))
  38. # The number of arguments is not checked for user-defined functions.
  39. # If some arguments are optional, it is useful to pass fewer parameters.
  40. # $(2) will be blank in this case.
  41. $(warning,$(greeting,Hello))
  42. # Unreferenced parameters are just ignored.
  43. $(warning,$(greeting,Hello,John,ignored,ignored))