code_junkie

Makefile If-Then Else and Loops

Nov 11th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. conditional-directive
  2. text-if-true
  3. endif
  4.  
  5. conditional-directive
  6. text-if-true
  7. else
  8. text-if-false
  9. endif
  10.  
  11. conditional-directive
  12. text-if-one-is-true
  13. else conditional-directive
  14. text-if-true
  15. else
  16. text-if-false
  17. endif
  18.  
  19. ifeq (arg1, arg2)
  20. ifeq 'arg1' 'arg2'
  21. ifeq "arg1" "arg2"
  22. ifeq "arg1" 'arg2'
  23. ifeq 'arg1' "arg2"
  24.  
  25. ifneq (arg1, arg2)
  26. ifneq 'arg1' 'arg2'
  27. ifneq "arg1" "arg2"
  28. ifneq "arg1" 'arg2'
  29. ifneq 'arg1' "arg2"
  30.  
  31. ifdef variable-name
  32.  
  33. ifndef variable-name
  34.  
  35. $(foreach var, list, text)
  36.  
  37. ifeq ($(strip $(OS)),Linux)
  38. PYTHON = /usr/bin/python
  39. FIND = /usr/bin/find
  40. endif
  41.  
  42. LIST_OF_THINGS_TO_DO = do_this do_that
  43. $(LIST_OF_THINGS_TO_DO):
  44.  
  45. SUBDIRS = snafu fubar
  46. $(SUBDIRS):
  47. cd $@ && $(MAKE)
Add Comment
Please, Sign In to add comment