-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
62 lines (52 loc) · 1.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
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
REALPATH := grealpath
else
REALPATH := realpath
endif
BUILD := build
DIST := dist
FAKE_LIBC := fake_libc_include
GIT := git
MAKE := make
PYTHON := python
PIP := pip
PYCPARSER := pycparser
PYCPARSER_GIT := https://github.com/eliben/$(PYCPARSER).git
PYCPARSER_UTILS := $(PYCPARSER)/utils
PYCPARSER_FAKE_LIBC := $(PYCPARSER_UTILS)/$(FAKE_LIBC)
PYINSTALLER := pyinstaller
REQUIREMENTS := requirements.txt
VENV := .venv
VENVACTIVATE := $(VENV)/bin/activate
VENV_PIP := $(VENV)/bin/pip
setup:
@$(MAKE) venv
@$(MAKE) dependencies
@$(MAKE) fake_libc
@$(MAKE) install
@$(MAKE) link
venv:
$(PYTHON) -m venv "$(VENV)"
dependencies:
@$(MAKE) pip_requirements
@$(MAKE) fake_libc
pip_requirements:
@$(VENV_PIP) install -r $(REQUIREMENTS)
fake_libc:
@echo "fetch $(PYCPARSER) repository"
$(GIT) clone -n --depth=1 --filter=tree:0 "$(PYCPARSER_GIT)"
cd $(PYCPARSER) ; $(GIT) sparse-checkout set --no-cone utils
cd $(PYCPARSER) ; $(GIT) checkout
cp -r "$(PYCPARSER_FAKE_LIBC)" "$(FAKE_LIBC)"
rm -rf "$(PYCPARSER)"
install:
source $(VENVACTIVATE) ; $(PYINSTALLER) --noconfirm porydex.py
link:
ln -s $(shell $(REALPATH) dist/porydex/porydex) "$(VENV)/bin/porydex"
clean:
rm -rf "$(VENV)"
rm -rf "$(PYCPARSER)"
rm -rf "$(FAKE_LIBC)"
rm -rf "$(BUILD)"
rm -rf "$(DIST)"