nicethings/Makefile

89 lines
3.1 KiB
Makefile
Raw Normal View History

2020-07-07 14:51:27 +00:00
program-name = nicethings
2020-06-15 18:09:05 +00:00
directory-local = ~/.local/bin
directory-global = /usr/local/bin
directory-source = src
directory-current = .
2020-07-07 14:51:27 +00:00
file-source = $(program-name).rkt
file-source-origin = $(directory-source)/$(file-source)
2020-06-15 18:09:05 +00:00
2020-07-07 14:51:27 +00:00
file-executable = $(program-name)
2020-06-15 18:09:05 +00:00
file-executable-local = $(directory-local)/$(file-executable)
file-executable-global = $(directory-global)/$(file-executable)
2020-07-07 14:51:27 +00:00
file-executable-origin= $(directory-source)/$(file-executable)
2020-06-15 18:09:05 +00:00
file-executable-current= $(directory-current)/$(file-executable)
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-06-15 18:09:05 +00:00
@echo " make [command]"
@echo ""
2020-07-07 14:51:27 +00:00
@echo "Commands:"
2020-06-15 18:09:05 +00:00
@echo " help - Displays this help message"
2020-07-07 14:51:27 +00:00
@echo " clean - Removes the $(file-executable) executable from $(directory-source)/"
2020-06-15 18:09:05 +00:00
@echo " build - Creates a $(file-executable) executable in your current directory"
@echo " install-global - Installs a $(file-executable) executable in $(directory-global)/"
@echo " uninstall-global - Deletes a $(file-executable) executable from $(directory-global)/"
@echo " install-local - Installs a $(file-executable) executable in $(directory-local)/"
@echo " uninstall-local - Deletes a $(file-executable) executable from $(directory-local)/"
2020-07-07 15:25:35 +00:00
@echo " install-custom - Installs a $(file-executable) 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-07 15:25:35 +00:00
@echo " make install-custom custom-location=~/bin/"
@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:
@echo "Uninstalling $(file-executable) from $(file-executable-local) ..."
2020-07-07 14:51:27 +00:00
@rm $(file-executable-local)
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:
@echo "Uninstalling $(file-executable) from $(file-executable-global) ..."
2020-07-07 14:51:27 +00:00
@rm $(file-executable-global)
2020-06-15 18:09:05 +00:00
2020-07-07 15:25:35 +00:00
# Installation -----------------------------------------------------------
.PHONY: install-custom
install-custom: build
@echo "Moving $(file-executable-current) to $(custom-location) ..."
@mv $(file-executable-current) $(custom-location)
2020-07-07 14:51:27 +00:00
.PHONY: install-local
2020-06-15 18:09:05 +00:00
install-local: build
@echo "Moving $(file-executable-current) to $(file-executable-local) ..."
@mv $(file-executable-current) $(file-executable-local)
2020-07-07 14:51:27 +00:00
.PHONY: install-global
2020-06-15 18:09:05 +00:00
install-global: build
@echo "Moving $(file-executable-current) to $(file-executable-global) ..."
@mv $(file-executable-current) $(file-executable-global)
2020-07-07 14:51:27 +00:00
.PHONY: clean
2020-06-15 18:09:05 +00:00
clean:
@echo "Deleting any $(file-executable) executables found in your current folder ..."
2020-07-07 14:51:27 +00:00
@rm $(file-executable-current)
2020-06-15 18:09:05 +00:00
build:
2020-07-07 14:51:27 +00:00
@echo "Creating $(file-executable-origin) executable from $(file-source-origin) ..."
@raco exe $(file-source-origin)
@echo "Moving $(file-executable-origin) executable to your current folder ..."
@mv $(file-executable-origin) $(directory-current)/