You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

105 lines
3.3 KiB

  1. program-name = pancake
  2. program-source = $(program-name).rkt
  3. directory-local = ~/.local/bin
  4. directory-global = /usr/local/bin
  5. directory-source = src
  6. .PHONY: help
  7. help:
  8. @echo "Usage"
  9. @echo " make <command> [<args>]"
  10. @echo ""
  11. @echo "Commands:"
  12. @echo " help"
  13. @echo " Displays this help message"
  14. @echo ""
  15. @echo " clean"
  16. @echo " Removes the $(program-name) executable from $(directory-source)/"
  17. @echo ""
  18. @echo " build"
  19. @echo " Creates a $(program-name) executable in your current directory"
  20. @echo ""
  21. @echo " install-global"
  22. @echo " Installs a $(program-name) executable in $(directory-global)/"
  23. @echo " Note: This command requires sudo or root access"
  24. @echo ""
  25. @echo " uninstall-global"
  26. @echo " Deletes a $(program-name) executable from $(directory-global)/"
  27. @echo " Note: This command requires sudo or root access"
  28. @echo ""
  29. @echo " install-local"
  30. @echo " Installs a $(program-name) executable in $(directory-local)/"
  31. @echo ""
  32. @echo " uninstall-local"
  33. @echo " Deletes a $(program-name) executable from $(directory-local)/"
  34. @echo ""
  35. @echo " install-custom location=<args>"
  36. @echo " Installs a $(program-name) executable in a custom location"
  37. @echo ""
  38. @echo "Examples:"
  39. @echo " make help"
  40. @echo " make clean"
  41. @echo " make build"
  42. @echo " sudo make install-global"
  43. @echo " sudo make uninstall-global"
  44. @echo " make install-local"
  45. @echo " make uninstall-local"
  46. @echo " make install-custom location=~/bin/"
  47. @echo ""
  48. @echo "Note: You will have to manually uninstall custom installations"
  49. .PHONY: install
  50. install:
  51. @echo "Try running make help"
  52. .PHONY: uninstall
  53. uninstall:
  54. @echo "Try running make help"
  55. # Uninstallation ---------------------------------------------------------
  56. .PHONY: uninstall-local
  57. uninstall-local:
  58. @echo "Uninstalling $(program-name) from $(directory-local) ..."
  59. @rm $(directory-local)/$(program-name)
  60. @echo "Uninstallation complete!"
  61. .PHONY: uninstall-global
  62. uninstall-global:
  63. @echo "Uninstalling $(program-name) from $(directory-global) ..."
  64. @rm $(directory-global)/$(program-name)
  65. @echo "Uninstallation complete!"
  66. # Installation -----------------------------------------------------------
  67. .PHONY: install-custom
  68. install-custom: build
  69. @echo "Moving ./$(program-name) to $(location) ..."
  70. @mv ./$(program-name) $(location)
  71. @echo "Installation complete!"
  72. .PHONY: install-local
  73. install-local: build
  74. @echo "Making $(directory-local) if it doesn't already exist ..."
  75. @mkdir -p $(directory-local)
  76. @echo "Moving ./$(program-name) to $(directory-local)/$(program-name) ..."
  77. @mv ./$(program-name) $(directory-local)/$(progam-name)
  78. @echo "Installation complete!"
  79. .PHONY: install-global
  80. install-global: build
  81. @echo "Moving ./$(program-name) to $(directory-global)/$(program-name) ..."
  82. @mv ./$(program-name) $(directory-global)/$(progam-name)
  83. @echo "Installation complete!"
  84. .PHONY: clean
  85. clean:
  86. @echo "Deleting any $(program-name) executables found in your current folder ..."
  87. @rm ./$(program-name)
  88. build:
  89. @echo "Creating a $(directory-source)/$(program-name) executable from $(directory-source)/$(program-source) ..."
  90. @raco exe $(directory-source)/$(program-source)
  91. @echo "Moving $(directory-source)/$(program-name) executable to your current folder ..."
  92. @mv $(directory-source)/$(program-name) ./