-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
105 lines (92 loc) · 3.31 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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 " 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"
@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"
@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: build
@echo "Moving ./$(program-name) to $(location) ..."
@mv ./$(program-name) $(location)
@echo "Installation complete!"
.PHONY: install-local
install-local: build
@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: build
@echo "Moving ./$(program-name) to $(directory-global)/$(program-name) ..."
@mv ./$(program-name) $(directory-global)/$(progam-name)
@echo "Installation complete!"
build:
@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)