-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
51 lines (43 loc) · 983 Bytes
/
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
# default target
target = cpp
COMP = g++
ifeq ($(target),c)
COMP = gcc
endif
.PHONY: all help run build gen clean
help:
@cat help.txt
all: run
# ------ target = c / cpp / others ------
ifneq ($(target),py)
run: code.$(target).exe
./$^
build: code.$(target).exe
code.$(target).exe: code.$(target)
@echo "********************************************"
@echo "This compiling may consume more than 30 mins"
@echo "on low-spec computers. Good luck!"
@echo "********************************************"
$(COMP) $^ -o $@ -O0
# ------ target = py ------
else
run: code.py
@echo "*********************************"
@echo "Python 3.10 or newer is required!"
@echo "*********************************"
python $^
endif
ifeq ($(target),all)
gen: gen.py
python $^ c $(d)
python $^ cpp $(d)
python $^ py $(d)
else
gen: code.$(target)
endif
code.$(target): gen.py
python $^ $(target) $(d)
clean:
-rm -rf code.cpp code.cpp.exe
-rm -rf code.c code.c.exe
-rm -rf code.py