106 lines
3.3 KiB
Makefile
106 lines
3.3 KiB
Makefile
program-name = rodo
|
|
program-source = $(program-name).rkt
|
|
|
|
directory-local = ~/.local/bin
|
|
directory-global = /usr/local/bin
|
|
directory-source = src
|
|
|
|
.PHONY: help
|
|
help:
|
|
@echo "Usage"
|
|
@echo " make <command> [<args>]"
|
|
@echo ""
|
|
@echo "Commands:"
|
|
@echo " help"
|
|
@echo " Displays this help message"
|
|
@echo ""
|
|
@echo " clean"
|
|
@echo " Removes the $(program-name) executable from $(directory-source)/"
|
|
@echo ""
|
|
@echo " compile"
|
|
@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 "Examples:"
|
|
@echo " make help"
|
|
@echo " make clean"
|
|
@echo " make compile"
|
|
@echo " sudo make install-global"
|
|
@echo " sudo make uninstall-global"
|
|
@echo " make install-local"
|
|
@echo " make uninstall-local"
|
|
@echo " make install-custom location=~/bin/"
|
|
@echo ""
|
|
@echo "Note: You will have to manually uninstall custom installations"
|
|
|
|
|
|
.PHONY: install
|
|
install:
|
|
@echo "Try running make help"
|
|
|
|
.PHONY: uninstall
|
|
uninstall:
|
|
@echo "Try running make help"
|
|
|
|
# Uninstallation ---------------------------------------------------------
|
|
.PHONY: uninstall-local
|
|
uninstall-local:
|
|
@echo "uninstalling $(program-name) from $(directory-local) ..."
|
|
@rm $(directory-local)/$(program-name)
|
|
@echo "uninstallation complete!"
|
|
|
|
.PHONY: uninstall-global
|
|
uninstall-global:
|
|
@echo "uninstalling $(program-name) from $(directory-global) ..."
|
|
@rm $(directory-global)/$(program-name)
|
|
@echo "uninstallation complete!"
|
|
|
|
# Installation -----------------------------------------------------------
|
|
.PHONY: install-custom
|
|
install-custom: compile
|
|
@echo "Moving ./$(program-name) to $(location) ..."
|
|
@mv ./$(program-name) $(location)
|
|
@echo "Installation complete!"
|
|
|
|
.PHONY: install-local
|
|
install-local: compile
|
|
@echo "Making $(directory-local) if it doesn't already exist ..."
|
|
@mkdir -p $(directory-local)
|
|
@echo "Moving ./$(program-name) to $(directory-local)/$(program-name) ..."
|
|
@mv ./$(program-name) $(directory-local)/$(progam-name)
|
|
@echo "Installation complete!"
|
|
|
|
.PHONY: install-global
|
|
install-global: compile
|
|
@echo "Moving ./$(program-name) to $(directory-global)/$(program-name) ..."
|
|
@mv ./$(program-name) $(directory-global)/$(progam-name)
|
|
@echo "Installation complete!"
|
|
|
|
compile:
|
|
@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) ./
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
@echo "Deleting any $(program-name) executables found in your current folder ..."
|
|
@rm ./$(program-name)
|
|
|