-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (71 loc) · 2.61 KB
/
Copy pathMakefile
File metadata and controls
92 lines (71 loc) · 2.61 KB
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
# Need c-compiler and JPEB-emulator in root directory to use this makefile
CC = ../JPEB-compiler/dist-newstyle/build/x86_64-linux/ghc-9.4.8/c-compiler-0.1.0.0/x/c-compiler/build/c-compiler/c-compiler
AS = python3 ../JPEB-compiler/Assembler.py
EMU = ../JPEB-emulator/target/release/JPEB-emulator
SIM = ../JPEB-FPGA/build/cpu
SIM_DATA = ../JPEB-FPGA/data
DATA_DIR = ../data
COMMON_C := $(wildcard common/*.c)
MAPPED_S := $(COMMON_C:.c=.s)
EXTRA_S := $(filter-out $(MAPPED_S),$(wildcard common/*.s))
COMMON := $(strip $(MAPPED_S) $(EXTRA_S))
.PRECIOUS: %.bin %.s
math_demos/math_demos.bin: math_demos/math_demos.s math_demos/mandelbrot/mandelbrot.s math_demos/collatz/collatz.s math_demos/life/life.s $(COMMON)
rm -f $@
$(AS) math_demos/math_demos.s math_demos/mandelbrot/mandelbrot.s math_demos/collatz/collatz.s math_demos/life/life.s $(COMMON)
dino/dino.bin: dino/dino.s dino/dino_animations.s $(COMMON)
rm -f $@
$(AS) dino/dino.s dino/dino_animations.s $(COMMON)
dino/dino_simple.bin: dino/dino_simple.s dino/dino_animations.s $(COMMON)
rm -f $@
$(AS) dino/dino_simple.s dino/dino_animations.s $(COMMON)
mandelbrot/mandelbrot.bin: mandelbrot/mandelbrot.s
rm -f $@
$(AS) mandelbrot/mandelbrot.s $(COMMON)
ascii_mandelbrot/mandelbrot.bin: ascii_mandelbrot/mandelbrot.s
rm -f $@
$(AS) ascii_mandelbrot/mandelbrot.s $(COMMON)
snake/snake_test.bin: snake/snake_test.s
rm -f $@
$(AS) snake/snake_test.s $(COMMON)
snake/snake.bin: snake/snake.s
rm -f $@
$(AS) snake/snake.s $(COMMON)
snake/snake_low_res.bin: snake/snake_low_res.s
rm -f $@
$(AS) snake/snake_low_res.s $(COMMON)
console/console.bin: console/console.s
rm -f $@
$(AS) console/console.s $(COMMON)
console/printx.bin: console/printx.s
rm -f $@
$(AS) console/printx.s $(COMMON)
%.s: %.c $(COMMON)
rm -f $@
$(CC) $<
%.bin: %.s $(COMMON)
rm -f $@
rm -f $*.hex
$(AS) $< $(COMMON)
%.run: %.bin
$(EMU) $<
%.deploy: %.bin
@cp ${DATA_DIR}/*.mem ${SIM_DATA}/
@cp $*.hex ${SIM_DATA}/program.mem
@sed -i '1s/^/@0\n/' ${SIM_DATA}/program.mem
@echo "Deployed $*"
# $(SIM) +DATAPATH=${SIM_DATA}/
common/text.s: common/text.c
rm -f common/text.s
$(CC) common/text.c
common/tile.s: common/tile.c
rm -f common/tile.s
$(CC) common/tile.c
common/io_addresses.s: common/io_addresses.c
rm -f common/io_addresses.s
$(CC) common/io_addresses.c
clean:
@find . -type f -name "*.bin" -exec rm -f {} +
@find . -type f -name "*.out" -exec rm -f {} +
@find . -type f -name "*.hex" -exec rm -f {} +
@rm -f collatz/collatz.s common/text.s mandelbrot/mandelbrot.s life/life.s common/tile.s math_demos/math_demos.s ascii_mandelbrot/mandelbrot.s