-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (71 loc) · 2.38 KB
/
Makefile
File metadata and controls
79 lines (71 loc) · 2.38 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
# Makefile for ZX Spectrum Basic projects
.PHONY: all clean build examples build-asm examples-asm help
# Default target
all: build build-asm
# Build all source files
build:
@echo "Building ZX Spectrum Basic projects..."
@mkdir -p build
@for basfile in src/*.bas; do \
if [ -f "$$basfile" ]; then \
filename=$$(basename "$$basfile" .bas); \
echo "Compiling $$basfile..."; \
zxbc "$$basfile" -o "build/$$filename.tap" -O 2; \
zxbc "$$basfile" -o "build/$$filename.bin" -O 2; \
fi \
done
@echo "Build complete!"
# Build example files
examples:
@echo "Building example files..."
@mkdir -p build/examples
@for basfile in examples/*.bas; do \
if [ -f "$$basfile" ]; then \
filename=$$(basename "$$basfile" .bas); \
echo "Compiling $$basfile..."; \
zxbc "$$basfile" -o "build/examples/$$filename.tap" -O 2; \
zxbc "$$basfile" -o "build/examples/$$filename.bin" -O 2; \
fi \
done
@echo "Examples build complete!"
# Build assembly source files
build-asm:
@echo "Building Z80 Assembly projects..."
@mkdir -p build/asm
@for asmfile in src/asm/*.asm; do \
if [ -f "$$asmfile" ]; then \
filename=$$(basename "$$asmfile" .asm); \
echo "Assembling $$asmfile..."; \
sjasmplus --raw="build/asm/$$filename.bin" "$$asmfile" || \
z80asm -o "build/asm/$$filename.bin" "$$asmfile"; \
fi \
done
@echo "Assembly build complete!"
# Build assembly examples
examples-asm:
@echo "Building assembly example files..."
@mkdir -p build/examples/asm
@for asmfile in examples/asm/*.asm; do \
if [ -f "$$asmfile" ]; then \
filename=$$(basename "$$asmfile" .asm); \
echo "Assembling $$asmfile..."; \
sjasmplus --raw="build/examples/asm/$$filename.bin" "$$asmfile" || \
z80asm -o "build/examples/asm/$$filename.bin" "$$asmfile"; \
fi \
done
@echo "Assembly examples build complete!"
# Clean build artifacts
clean:
@echo "Cleaning build directory..."
@rm -rf build
@echo "Clean complete!"
# Show help
help:
@echo "Available targets:"
@echo " all - Build all BASIC and assembly source files (default)"
@echo " build - Build all BASIC source files in src/"
@echo " build-asm - Build all assembly source files in src/asm/"
@echo " examples - Build all BASIC example files in examples/"
@echo " examples-asm- Build all assembly example files in examples/asm/"
@echo " clean - Remove all build artifacts"
@echo " help - Show this help message"