-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.example
More file actions
84 lines (58 loc) · 2.15 KB
/
Makefile.example
File metadata and controls
84 lines (58 loc) · 2.15 KB
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
BASE_DIR = ${HOME}/.local
BASE_BIN_DIR = ${BASE_DIR}/bin
# All scripts will be installed in this subdir
# and linked from the parent. This will allow
# for the uninstallation of everything!
APPS_SUBDIR = jakewendt_csvtools
# mkdir will raise error if dir exists
# mkdir -p will not and would create full path
MKDIR = mkdir -p
# In the preferred compilation order ...
TARGETS =
# the @ prefix means the line will be executed, but not printed
# Do I need the &&s? Why not just multiple lines?
# The &&s are a condition so if the first part fails, the next will NOT run.
# Each line is its own thing so if a cd is used, needs to be same line.
# all is the default target that is used when none are given
all: make-all $(TARGETS)
@printf "\nDONE MAKING ALL\n\n"
make-all:
@printf "\nMAKING ALL\n\n"
install: install-all $(TARGETS:%=install-%) install-scripts
@printf "\nDONE INSTALLING ALL\n\n"
@printf "Add $(BASE_BIN_DIR) TO YOUR PATH\n\n"
install-all:
@printf "\nINSTALLING ALL\n\n"
$(MKDIR) $(BASE_BIN_DIR)/$(APPS_SUBDIR)
uninstall: uninstall-scripts
uninstall-scripts:
@printf "\nUNINSTALLING SCRIPTS\n\n"
cd $(BASE_BIN_DIR); \
find . -lname $(APPS_SUBDIR)/\* -exec rm {} \;
rm -rf $(BASE_BIN_DIR)/$(APPS_SUBDIR)
# Remove old stuff. Need -f or get an error.
install-scripts: uninstall-scripts
$(MKDIR) $(BASE_BIN_DIR)/$(APPS_SUBDIR)
@printf "\nINSTALLING SCRIPTS\n\n"
# Crashes if no match exists.
# when these actually exist ...
#cp scripts/*.gawk $(BASE_BIN_DIR)/$(APPS_SUBDIR)/
#cp scripts/*.awk $(BASE_BIN_DIR)/$(APPS_SUBDIR)/
#cp scripts/*.pl $(BASE_BIN_DIR)/$(APPS_SUBDIR)/
#cp scripts/*.rb $(BASE_BIN_DIR)/$(APPS_SUBDIR)/
#cp scripts/*.sh $(BASE_BIN_DIR)/$(APPS_SUBDIR)/
#cp scripts/*.bash $(BASE_BIN_DIR)/$(APPS_SUBDIR)/
#cp scripts/*.r $(BASE_BIN_DIR)/$(APPS_SUBDIR)/
# Why was I being so specific?
cp scripts/* $(BASE_BIN_DIR)/$(APPS_SUBDIR)/
cd $(BASE_BIN_DIR); \
for file in `find $(APPS_SUBDIR) -type f` ; do \
echo $$file; \
ln -s $$file; \
done
clean: clean-all $(TARGETS:%=clean-%)
@printf "\nDONE CLEANING\n\n"
clean-all:
@printf "\nCLEANING ALL\n\n"
test:
@printf "\ntesting is nice, but not today\n\n"