nicethings/Makefile

105 lines
3.3 KiB
Makefile
Raw Permalink Normal View History

2020-07-07 14:51:27 +00:00
program-name = nicethings
2020-07-11 22:48:47 +00:00
program-source = $(program-name).rkt
2020-06-15 18:09:05 +00:00
directory-local = ~/.local/bin
directory-global = /usr/local/bin
directory-source = src
2020-07-07 14:51:27 +00:00
.PHONY: help
2020-06-15 18:09:05 +00:00
help:
2020-07-07 14:51:27 +00:00
@echo "Usage"
2020-07-11 22:48:47 +00:00
@echo " make <command> [<args>]"
2020-06-15 18:09:05 +00:00
@echo ""
2020-07-07 14:51:27 +00:00
@echo "Commands:"
2020-07-11 22:48:47 +00:00
@echo " help"
@echo " Displays this help message"
@echo ""
@echo " clean"
@echo " Removes the $(program-name) executable from $(directory-source)/"
@echo ""
@echo " build"
@echo " Creates a $(program-name) executable in your current directory"
@echo ""
@echo " install-global"
@echo " Installs a $(program-name) executable in $(directory-global)/"
@echo " Note: This command requires sudo or root access"
@echo ""
@echo " uninstall-global"
@echo " Deletes a $(program-name) executable from $(directory-global)/"
@echo " Note: This command requires sudo or root access"
@echo ""
@echo " install-local"
@echo " Installs a $(program-name) executable in $(directory-local)/"
@echo ""
@echo " uninstall-local"
@echo " Deletes a $(program-name) executable from $(directory-local)/"
@echo ""
@echo " install-custom location=<args>"
@echo " Installs a $(program-name) executable in a custom location"
2020-07-07 14:51:27 +00:00
@echo ""
@echo "Examples:"
@echo " make help"
@echo " make clean"
@echo " make build"
@echo " sudo make install-global"
@echo " sudo make uninstall-global"
@echo " make install-local"
@echo " make uninstall-local"
2020-07-11 22:48:47 +00:00
@echo " make install-custom location=~/bin/"
2020-07-07 15:25:35 +00:00
@echo ""
@echo "Note: You will have to manually uninstall custom installations"
2020-07-07 14:51:27 +00:00
2020-06-15 18:09:05 +00:00
2020-07-07 14:51:27 +00:00
.PHONY: install
2020-06-15 18:09:05 +00:00
install:
@echo "Try running make help"
2020-07-07 14:51:27 +00:00
.PHONY: uninstall
2020-06-15 18:09:05 +00:00
uninstall:
@echo "Try running make help"
2020-07-07 15:25:35 +00:00
# Uninstallation ---------------------------------------------------------
2020-07-07 14:51:27 +00:00
.PHONY: uninstall-local
2020-06-15 18:09:05 +00:00
uninstall-local:
2020-07-11 22:48:47 +00:00
@echo "Uninstalling $(program-name) from $(directory-local) ..."
@rm $(directory-local)/$(program-name)
2020-07-15 05:10:49 +00:00
@echo "Uninstallation complete!"
2020-06-15 18:09:05 +00:00
2020-07-07 14:51:27 +00:00
.PHONY: uninstall-global
2020-06-15 18:09:05 +00:00
uninstall-global:
2020-07-11 22:48:47 +00:00
@echo "Uninstalling $(program-name) from $(directory-global) ..."
@rm $(directory-global)/$(program-name)
2020-07-15 05:10:49 +00:00
@echo "Uninstallation complete!"
2020-06-15 18:09:05 +00:00
2020-07-07 15:25:35 +00:00
# Installation -----------------------------------------------------------
.PHONY: install-custom
install-custom: build
2020-07-11 22:48:47 +00:00
@echo "Moving ./$(program-name) to $(location) ..."
@mv ./$(program-name) $(location)
2020-07-15 05:10:49 +00:00
@echo "Installation complete!"
2020-07-07 15:25:35 +00:00
2020-07-07 14:51:27 +00:00
.PHONY: install-local
2020-06-15 18:09:05 +00:00
install-local: build
2020-07-15 05:10:49 +00:00
@echo "Making $(directory-local) if it doesn't already exist ..."
@mkdir -p $(directory-local)
2020-07-11 22:48:47 +00:00
@echo "Moving ./$(program-name) to $(directory-local)/$(program-name) ..."
@mv ./$(program-name) $(directory-local)/$(progam-name)
2020-07-15 05:10:49 +00:00
@echo "Installation complete!"
2020-06-15 18:09:05 +00:00
2020-07-07 14:51:27 +00:00
.PHONY: install-global
2020-06-15 18:09:05 +00:00
install-global: build
2020-07-11 22:48:47 +00:00
@echo "Moving ./$(program-name) to $(directory-global)/$(program-name) ..."
@mv ./$(program-name) $(directory-global)/$(progam-name)
2020-07-15 05:10:49 +00:00
@echo "Installation complete!"
2020-06-15 18:09:05 +00:00
2020-07-07 14:51:27 +00:00
.PHONY: clean
2020-06-15 18:09:05 +00:00
clean:
2020-07-11 22:48:47 +00:00
@echo "Deleting any $(program-name) executables found in your current folder ..."
@rm ./$(program-name)
2020-06-15 18:09:05 +00:00
build:
2020-07-11 22:48:47 +00:00
@echo "Creating a $(directory-source)/$(program-name) executable from $(directory-source)/$(program-source) ..."
@raco exe $(directory-source)/$(program-source)
@echo "Moving $(directory-source)/$(program-name) executable to your current folder ..."
@mv $(directory-source)/$(program-name) ./