simplified makefile

main
Jesse Laprade 2020-07-11 18:45:53 -04:00
parent f51c4aa5fc
commit b1794f3901
1 changed files with 45 additions and 36 deletions

View File

@ -1,32 +1,41 @@
program-name = rodo program-name = rodo
program-source = $(program-name).rkt
directory-local = ~/.local/bin directory-local = ~/.local/bin
directory-global = /usr/local/bin directory-global = /usr/local/bin
directory-source = src directory-source = src
directory-current = .
file-source = $(program-name).rkt
file-source-origin = $(directory-source)/$(file-source)
file-executable = $(program-name)
file-executable-local = $(directory-local)/$(file-executable)
file-executable-global = $(directory-global)/$(file-executable)
file-executable-origin= $(directory-source)/$(file-executable)
file-executable-current= $(directory-current)/$(file-executable)
.PHONY: help .PHONY: help
help: help:
@echo "Usage" @echo "Usage"
@echo " make command [<args>]" @echo " make <command> [<args>]"
@echo "" @echo ""
@echo "Commands:" @echo "Commands:"
@echo " help - Displays this help message" @echo " help"
@echo " clean - Removes the $(file-executable) executable from $(directory-source)/" @echo " Displays this help message"
@echo " build - Creates a $(file-executable) executable in your current directory" @echo ""
@echo " install-global - Installs a $(file-executable) executable in $(directory-global)/" @echo " clean"
@echo " uninstall-global - Deletes a $(file-executable) executable from $(directory-global)/" @echo " Removes the $(program-name) executable from $(directory-source)/"
@echo " install-local - Installs a $(file-executable) executable in $(directory-local)/" @echo ""
@echo " uninstall-local - Deletes a $(file-executable) executable from $(directory-local)/" @echo " build"
@echo " install-custom [<args>] - Installs a $(file-executable) executable in a custom location" @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"
@echo "" @echo ""
@echo "Examples:" @echo "Examples:"
@echo " make help" @echo " make help"
@ -36,7 +45,7 @@ help:
@echo " sudo make uninstall-global" @echo " sudo make uninstall-global"
@echo " make install-local" @echo " make install-local"
@echo " make uninstall-local" @echo " make uninstall-local"
@echo " make install-custom custom-location=~/bin/" @echo " make install-custom location=~/bin/"
@echo "" @echo ""
@echo "Note: You will have to manually uninstall custom installations" @echo "Note: You will have to manually uninstall custom installations"
@ -52,37 +61,37 @@ uninstall:
# Uninstallation --------------------------------------------------------- # Uninstallation ---------------------------------------------------------
.PHONY: uninstall-local .PHONY: uninstall-local
uninstall-local: uninstall-local:
@echo "Uninstalling $(file-executable) from $(file-executable-local) ..." @echo "Uninstalling $(program-name) from $(directory-local) ..."
@rm $(file-executable-local) @rm $(directory-local)/$(program-name)
.PHONY: uninstall-global .PHONY: uninstall-global
uninstall-global: uninstall-global:
@echo "Uninstalling $(file-executable) from $(file-executable-global) ..." @echo "Uninstalling $(program-name) from $(directory-global) ..."
@rm $(file-executable-global) @rm $(directory-global)/$(program-name)
# Installation ----------------------------------------------------------- # Installation -----------------------------------------------------------
.PHONY: install-custom .PHONY: install-custom
install-custom: build install-custom: build
@echo "Moving $(file-executable-current) to $(custom-location) ..." @echo "Moving ./$(program-name) to $(location) ..."
@mv $(file-executable-current) $(custom-location) @mv ./$(program-name) $(location)
.PHONY: install-local .PHONY: install-local
install-local: build install-local: build
@echo "Moving $(file-executable-current) to $(file-executable-local) ..." @echo "Moving ./$(program-name) to $(directory-local)/$(program-name) ..."
@mv $(file-executable-current) $(file-executable-local) @mv ./$(program-name) $(directory-local)/$(progam-name)
.PHONY: install-global .PHONY: install-global
install-global: build install-global: build
@echo "Moving $(file-executable-current) to $(file-executable-global) ..." @echo "Moving ./$(program-name) to $(directory-global)/$(program-name) ..."
@mv $(file-executable-current) $(file-executable-global) @mv ./$(program-name) $(directory-global)/$(progam-name)
.PHONY: clean .PHONY: clean
clean: clean:
@echo "Deleting any $(file-executable) executables found in your current folder ..." @echo "Deleting any $(program-name) executables found in your current folder ..."
@rm $(file-executable-current) @rm ./$(program-name)
build: build:
@echo "Creating $(file-executable-origin) executable from $(file-source-origin) ..." @echo "Creating a $(directory-source)/$(program-name) executable from $(directory-source)/$(program-source) ..."
@raco exe $(file-source-origin) @raco exe $(directory-source)/$(program-source)
@echo "Moving $(file-executable-origin) executable to your current folder ..." @echo "Moving $(directory-source)/$(program-name) executable to your current folder ..."
@mv $(file-executable-origin) $(directory-current)/ @mv $(directory-source)/$(program-name) ./