-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathMakefile
110 lines (94 loc) · 3.29 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
105
106
107
108
109
110
# | | #
# --+---------------------------------------------------------+-- #
# | Code by: yasserbdj96 | #
# | Email: [email protected] | #
# | GitHub: github.com/yasserbdj96 | #
# | Sponsor: github.com/sponsors/yasserbdj96 | #
# | BTC: bc1q2dks8w8uurca5xmfwv4jwl7upehyjjakr3xga9 | #
# | | #
# | All posts with #yasserbdj96 | #
# | All views are my own. | #
# --+---------------------------------------------------------+-- #
# | | #
#START{
VENV = venv
PYTHON = $(VENV)/bin/python3
PIP = $(VENV)/bin/pip
#
ifeq ($(OS),Windows_NT)
detected_OS := Windows
else
detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
endif
ifeq ($(detected_OS),Windows)
pipforos = $(PIP) install -r ./hiphp-win/requirements-win.txt
endif
ifeq ($(detected_OS),Linux)#Darwin for Mac OS X
pipforos = $(PIP) install -r ./hiphp-linux/requirements-linux.txt
endif
# The rest of your Makefile remains unchanged
clean:
rm -rf hiphp/__pycache__
rm -rf $(VENV)
mrproper: clean
rm -rf *.log
#
ifeq ($(filter-out $(MAKECMDGOALS),run),)
ARGUMENTS := $(filter-out $@,$(MAKECMDGOALS))
endif
# Extract the values of specific arguments
URL := $(shell echo $(ARGUMENTS) | sed -n 's/.*\(--url\)[= ]\+\([^ ]\+\).*/\2/p')
ifeq ($(strip $(URL)),)
URL := $(shell echo $(ARGUMENTS) | sed -n 's/.*\(--URL\)[= ]\+\([^ ]\+\).*/\2/p')
endif
KEY := $(shell echo $(ARGUMENTS) | sed -n 's/.*\(--key\)[= ]\+\([^ ]\+\).*/\2/p')
ifeq ($(strip $(KEY)),)
KEY := $(shell echo $(ARGUMENTS) | sed -n 's/.*\(--KEY\)[= ]\+\([^ ]\+\).*/\2/p')
endif
PROXIES := $(shell echo $(ARGUMENTS) | sed -n 's/.*\(--proxies\)[= ]\+\([^ ]\+\).*/\2/p')
ifeq ($(strip $(PROXIES)),)
PROXIES := $(shell echo $(ARGUMENTS) | sed -n 's/.*\(--PROXIES\)[= ]\+\([^ ]\+\).*/\2/p')
endif
ifeq ($(filter --TK,$(ARGUMENTS)),--TK)
ifeq ($(strip $(URL)$(KEY)),)
RUN = $(PYTHON) main.py --TK
else
RUN = $(PYTHON) main.py --TK --KEY='$(KEY)' --URL='$(URL)'
endif
else ifeq ($(filter --tk,$(ARGUMENTS)),--tk)
ifeq ($(strip $(URL)$(KEY)),)
RUN = $(PYTHON) main.py --TK
else
RUN = $(PYTHON) main.py --TK --KEY='$(KEY)' --URL='$(URL)'
endif
else ifeq ($(filter --dst,$(ARGUMENTS)),--dst)
RUN = $(PYTHON) main.py --DST
else ifeq ($(filter --DST,$(ARGUMENTS)),--DST)
RUN = $(PYTHON) main.py --DST
else
ifeq ($(strip $(URL)$(KEY)),)
$(error URL and KEY are both empty)
else ifeq ($(filter --Y,$(ARGUMENTS)),--Y)
# ifeq ($(strip $(PROXIES)),)
RUN = $(PYTHON) main.py --KEY=$(KEY) --URL=$(URL) --Y
# else
# RUN = $(PYTHON) main.py --KEY=$(KEY) --URL=$(URL) --Y PROXIES=$(PROXIES)
# endif
else
# ifeq ($(strip $(PROXIES)),)
RUN = $(PYTHON) main.py --KEY=$(KEY) --URL=$(URL)
# else
# RUN = $(PYTHON) main.py --KEY=$(KEY) --URL=$(URL) PROXIES="$(PROXIES)"
# endif
endif
endif
run: $(VENV)/bin/activate
$(RUN)
$(VENV)/bin/activate: requirements.txt
python3 -m venv $(VENV)
$(PIP) install -r ./requirements.txt
$(pipforos)
#clean:
# rm -rf hiphp/__pycache__
# rm -rf $(VENV)
#}END.