-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile
90 lines (77 loc) · 3.02 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
################################################################################
# Configuration variables.
################################################################################
VERBOSE = 0
################################################################################
ifeq "$(VERBOSE)" "1"
verbose_arg='-v'
else
verbose_arg=
endif
ifeq ($(PREFIX),)
PREFIX := /usr/local
# Blank out VIRTUALENV and use the system pip
VIRTUALENV :=
PIP := pip3
else
VIRTUALENV := $(PREFIX)
PIP := $(VIRTUALENV)/bin/pip3
endif
INSTALL := install
help:
@echo "git apple-llvm can be installed using 'make install'"
install: show-params install-python-package install-git-scripts
show-params:
@echo "'git-apple-llvm' version:"
@echo " ${shell utils/get-git-revision.sh}"
@echo "################################################################################"
@echo "The following parameters are set:"
@echo " PIP = ${PIP}"
@echo " VERBOSE = ${VERBOSE}"
@echo " PREFIX = ${PREFIX}"
@echo " DESTDIR = ${DESTDIR}"
@echo ""
install-python-package: $(PIP)
@echo "Installing python packages"
@echo "################################################################################"
@echo "Upgrading pip before installing python packages"
$(PIP) install --upgrade pip
env GIT_APPLE_LLVM_NO_BIN_LIBEXEC=1 $(PIP) install $(verbose_arg) .
@echo ""
$(PIP):
ifeq ($(VIRTUALENV),)
@echo "$(PIP) not found in the system. Please install it."
else
@echo "Creating virtualenv at $(VIRTUALENV) "
@echo "Cleaning before creating virtualenv"
rm -rf $(VIRTUALENV)
@echo "################################################################################"
python3 -m venv $(VIRTUALENV)
@echo ""
endif
install-git-scripts:
@echo "Installing 'git apple-llvm' bash scripts"
@echo "################################################################################"
$(INSTALL) bin/git-apple-llvm $(DESTDIR)$(PREFIX)/bin/
$(INSTALL) -d $(DESTDIR)$(PREFIX)/libexec/apple-llvm
tar cf - libexec/apple-llvm | (cd $(DESTDIR)$(PREFIX); tar xf -)
echo "${shell utils/get-git-revision.sh}" > $(DESTDIR)$(PREFIX)/libexec/apple-llvm/helpers/version
@echo ""
@echo "################################################################################"
@echo "Installation succeeded: 'git apple-llvm' is now available!"
uninstall:
@echo "Uninstalling 'git-apple-llvm'"
@echo "################################################################################"
@echo ""
@echo "Uninstalling python packages"
@echo "################################################################################"
$(PIP) uninstall -y $(verbose_arg) git_apple_llvm
@echo ""
@echo "Uninstalling 'git apple-llvm' bash scripts"
@echo "################################################################################"
rm -rf $(DESTDIR)$(PREFIX)/bin/git-apple-llvm
rm -rf $(DESTDIR)$(PREFIX)/libexec/apple-llvm
@echo ""
@echo "################################################################################"
@echo "'git apple-llvm' was successfully uninstalled!"
.PHONY: help install uninstall