-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
43 lines (31 loc) · 1.18 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
SHELL := /bin/bash
SRCS = main.asm model.asm view.asm
BIN = zepto.bin
# Directory where source files are and where the binaries will be put
INPUT_DIR = src
OUTPUT_DIR = bin
# Include directory containing Zeal 8-bit OS header file.
ifndef ZOS_PATH
$(error "Please define ZOS_PATH environment variable. It must point to Zeal 8-bit OS source code path.")
endif
ZOS_INCLUDE = $(ZOS_PATH)/kernel_headers/z88dk-z80asm/
# Assembler binary name
ASM = z88dk-z80asm
# Assembler flags
ASMFLAGS = -m -b -I$(ZOS_INCLUDE) -O$(OUTPUT_DIR)
# If z88dk has been install through snap, the binary may be prefixed with "z88dk"
# So choose any of z88dk-dis or z88dk.z88dk-dis, as long as one exists
DISASSEMBLER=$(shell which z88dk-dis z88dk.z88dk-dis | head -1)
# Mark version.txt as PHONY to force generating it every time
.PHONY: all version.txt
all: version.txt $(OUTPUT_DIR) $(BIN)
version.txt:
git describe --always | tr "\n" " " > $@
$(BIN): $(addprefix $(INPUT_DIR)/, $(SRCS))
$(ASM) $(ASMFLAGS) -o$@ $^
mv $(OUTPUT_DIR)/*_TEXT.bin $(OUTPUT_DIR)/$@
$(DISASSEMBLER) -mz80 -o 0x4000 -x $(OUTPUT_DIR)/zepto.map $(OUTPUT_DIR)/$@ > $(OUTPUT_DIR)/zepto.dump
$(OUTPUT_DIR):
mkdir -p $@
clean:
rm -rf bin/ version.txt