-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
105 lines (90 loc) · 2.6 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
ID=talos
ENTRY=includes
ASM=uxnasm
EMU=uxncli
BAK_DIR=bak
ETC_DIR=etc
SRC_DIR=src
BIN_DIR=bin
ROM_DIR=rom
ROMS_DIR=~/roms
DEBUG ?= NO_DBG
TAL=${ID}/${ENTRY}.tal
ROM=${ROM_DIR}/${ID}.rom
SYM=${ROM}.sym
DIS=${ETC_DIR}/uxndis.rom
SYMS=${ETC_DIR}/sym.rom
DUMP=${ETC_DIR}/hx.rom
MULTI:=$(shell printf '\e')
TTY:=$(shell stty -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr \
-icrnl -ixon -ixoff -icanon onlcr -echo -isig -iuclc -ixany \
-imaxbel -xcase min 1 time 0)
run: install
@ stty raw -echo
@ echo "Running: ~/${BIN_DIR}/${ID}"
echo $TTY
@ ${ID}; \
EXIT_CODE=$$? ; \
stty ${TTY}; \
exit $$EXIT_CODE
setup:
@ echo "Setting up: ~/{${BIN_DIR},${ROMS_DIR}}"
@ mkdir -p ~/${BIN_DIR} ${ROMS_DIR} ${ROM_DIR}
build:
@ echo "Building: ./${ROM}*"
@ # Sorry
@ cpp -P -w -D $DEBUG config/pre-options.tal -o config/options.tal
@ cpp -P -w -D $DEBUG src/debugger/routines/pre-after-eval.tal \
-o src/debugger/routines/after-eval.tal
@cpp -P -w -D $DEBUG src/debugger/routines/pre-before-eval.tal \
-o src/debugger/routines/before-eval.tal
@ cd ${SRC_DIR} && ${ASM} ${TAL} ../${ROM}
dump: build
@ echo "Dumping: ./${ROM}.dmp"
@ ${EMU} ${DUMP} ${ROM} 2> /dev/null > ${ROM}.dmp
symbols: build
@ echo "Reading symbols: ./${SYM}.txt"
@ ${EMU} ${SYMS} ${SYM} > ${SYM}.txt 2>&1
disassemble: build
@ echo "Disassembling: ./${ROM}.dis"
@ ${EMU} ${DIS} ${ROM} > ${ROM}.dis
install: setup build dump symbols disassemble
@ echo "Installing: ./{${BIN_DIR},${ROM_DIR}}/* at ~/{${BIN_DIR},${ROMS_DIR}}"
@ cp ${BIN_DIR}/* ~/${BIN_DIR}
@ cp ${ROM} ${ROMS_DIR}
test: install
@ echo "Testing: ~/${ROM_DIR}/${ID}.rom"
@ printf "%s\n" \
"@sierpinski ( -- ) ${MULTI}" \
" ( mask ) [ LIT2r 0a18 ] [ LIT2r 2018 ]" \
" ( size ) [ LIT2 &size 1001 ] SUB" \
" &>ver ( -- )" \
" DUP INCk" \
" &>pad ( length -- )" \
" DEOkr" \
" #01 SUB DUP ?&>pad" \
" &>fill ( length i -- )" \
" ANDk DUP2r ?{ POP2r ORA2kr } DEOr DEOkr" \
" INC ADDk ,&size LDR LTH ?&>fill" \
" POP2 OVR2r DEOr" \
" #01 SUB INCk ?&>ver" \
" POP POP2r POP2r JMP2r ${MULTI}" \
"sierpinski" \
"bye" | ${EMU} ${ROMS_DIR}/${ID}.rom
cli: install
@ echo "Running: ~/${BIN_DIR}/${ID}-cli"
@ stty raw -echo
@ ${ID}-cli; \
EXIT_CODE=$$? ; \
stty ${TTY}; \
exit $$EXIT_CODE
gui: install
@ echo "Running: ~/${BIN_DIR}/${ID}-gui"
@ stty raw -echo
@ ${ID}-gui; \
EXIT_CODE=$$? ; \
stty ${TTY}; \
exit $$EXIT_CODE
clean:
@ echo "Cleaning: ${ROM_DIR}/*"
@ rm ${ROM_DIR}/*