-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
68 lines (58 loc) · 1.49 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
DEF=slidefactory.def
SIF=slidefactory.sif
ifndef PREFIX
PREFIX=$(HOME)
endif
INSTALL_BIN=$(PREFIX)/bin
INSTALL_GIT=$(PREFIX)/lib/slidefactory
GIT=https://github.com/csc-training/slide-template
.PHONY: build clean install uninstall
.PHONY: check clone git
build: $(SIF)
clean:
rm $(SIF)
check:
@if [ -e $(INSTALL_GIT) ]; then \
echo "Already installed. Please run 'make uninstall' to remove old installation."; \
exit 1; \
fi
clone:
git clone --recursive . $(INSTALL_GIT)
cd $(INSTALL_GIT) && git remote set-url origin $(GIT) && git fetch origin
git:
@make -s check
@make -s clone
@echo ""
@echo "Installed:"
@echo " $(INSTALL_GIT)/"
@echo ""
@echo "Please add the following into your .bashrc or similar"
@echo " export SLIDEFACTORY=$(INSTALL_GIT)"
install: build
@make -s check
@if [ ! -d $(INSTALL_BIN) ]; then \
mkdir -p $(INSTALL_BIN); \
fi
cp -i $(SIF) $(INSTALL_BIN)/
@make -s clone
@echo ""
@echo "Installed:"
@echo " $(INSTALL_BIN)/$(SIF)"
@echo " $(INSTALL_GIT)/"
@echo ""
@echo "Please add the following into your .bashrc or similar"
@echo " export SLIDEFACTORY=$(INSTALL_GIT)"
uninstall:
@echo "Removing:"
@if [ -e $(INSTALL_BIN)/$(SIF) ]; then \
echo " $(INSTALL_BIN)/$(SIF)"; \
fi
@echo " $(INSTALL_GIT)/"
@read -r -p "Proceed [Y/n]? " OK; \
[ "$$OK" = "y" ] || [ "$$OK" = "Y" ] || [ "$$OK" = "" ] || (exit 1;)
@if [ -e $(INSTALL_BIN)/$(SIF) ]; then \
rm -f $(INSTALL_BIN)/$(SIF); \
fi
rm -rf $(INSTALL_GIT)
%.sif: %.def
sudo singularity build $@ $<