-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMakefile
More file actions
200 lines (161 loc) · 4.83 KB
/
Makefile
File metadata and controls
200 lines (161 loc) · 4.83 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# Makefile for F256 SuperBASIC
ifeq ($(OS),Windows_NT)
include ..\documents\common.make
else
include ../documents/common.make
endif
#
# Current version
#
MAJOR_VERSION = 1
MINOR_VERSION = 2
VERSION ?= $(MAJOR_VERSION).$(MINOR_VERSION)
LANGUAGE = en
DOLLAR = $$
ASFLAGS += '-D MONITOR_ADDRESS=$(DOLLAR)$(LMONITOR)' '-D LOCKOUT_ADDRESS=$(DOLLAR)$(LLOCKOUT)' \
'-D BASIC_ADDRESS=$(DOLLAR)$(LBASIC)' '-D SOURCE_ADDRESS=$(DOLLAR)$(LSOURCE)' \
'-D SPRITE_ADDRESS=$(DOLLAR)$(LSPRITES)' '-D TILEMAP_ADDRESS=$(DOLLAR)$(LTILEMAP)' \
'-D TILEIMAGES_ADDRESS=$(DOLLAR)$(LTILEIMAGES)' \
-L $(BUILDDIR)debug$(S)basic.lst -l $(BUILDDIR)debug$(S)basic.lbl
MODULES = +hardware +tokeniser +graphics +kernel:2 +sound:2
BUILD_OUT = $(BUILDDIR)basic.rom
SCRIPTDIR = scripts$(S)
MAME_PATH=../../mame
KERNEL_PATH=../../F256_MicroKernel
BASIC_TESTS_PATH=$(PWD)/../test
IMAGE := $(BASIC_TESTS_PATH)/.output/tests.img
all: build
#
# Update api.asm
#
updatekernel:
$(call updatekernel,common$(S)api)
@echo "Updated kernel"
#
# Create sprites
#
sprites:
$(Q)$(MAKE) -B -C ..$(S)spritebuild
#
# Build and download tools
#
tools: fnxmgr
#
# Update FoenixMgr "binary"
#
fnxmgr:
$(Q)$(CURL) -o $(BINDIR)fnxmgr.zip $(LDR_REPO)/raw/refs/heads/master/FoenixMgr.zip
#
# Show various things
#
stack:
$(Q)$(PYTHON) $(SCRIPTDIR)showstack.py
strings:
$(Q)$(PYTHON) $(SCRIPTDIR)showstring.py
vars:
$(Q)$(PYTHON) $(SCRIPTDIR)showvar.py
#
# Regular build
#
build: ASFLAGS += -D AUTORUN=0
build: prelim
$(call cleandir,$(BUILDDIR))
$(call cleandir,$(BUILDDIR)debug$(S))
@echo "Compiling assembly"
$(Q)$(ASM) $(ASFLAGS) _basic.asm -o $(BUILD_OUT)
@echo "Splitting ROM"
$(Q)$(PYTHON) $(SCRIPTDIR)splitrom.py $(BUILDDIR)
#
# Scripts run in advance generating tables etc.
#
prelim:
@echo "Generating assembly sources"
$(Q)$(PYTHON) $(SCRIPTDIR)errors.py $(LANGUAGE)
$(Q)$(PYTHON) $(SCRIPTDIR)opcodes.py >common$(S)generated$(S)asmcore.asm
$(Q)$(PYTHON) $(SCRIPTDIR)makebuild.py $(MODULES)
@echo "Building submodules"
$(Q)$(MAKE) -B -C ..$(S)modules clean all
$(Q)$(PYTHON) $(SCRIPTDIR)tokens.py
$(Q)$(PYTHON) $(SCRIPTDIR)constants.py
$(Q)$(PYTHON) $(SCRIPTDIR)version.py $(VERSION)
#
# Print base version to console
#
baseversion:
@: $(info $(MAJOR_VERSION).$(MINOR_VERSION))
#
# Make sure a release with the current version does not already exist
#
versioncheck:
@$(GIT) fetch --tags --quiet
$(if $(strip $(shell $(GIT) rev-parse -q --verify refs/tags/v$(VERSION))), \
$(error Release tag v$(VERSION) already exists. See README for how to prepare a new release),)
log_step = @echo "> $1"
#
# Build a release, copy to the corresponding release dir
#
build_release: OUTPUTDIR := $(RELEASEDIR)$(S)
build_release:
$(call log_step, "Building release build")
$(Q)$(MAKE) -C . build VERSION=$(VERSION)
$(call cleandir,$(OUTPUTDIR))
$(call cleandir,$(OUTPUTDIR)debug$(S))
@echo "Copying build artifacts"
$(Q)$(CCOPY) $(BUILDDIR)*.* $(OUTPUTDIR)
$(Q)$(CCOPY) $(BUILDDIR)debug$(S)*.* $(OUTPUTDIR)debug
#
# Create a versioned release
#
release: VERSION := $(shell $(PYTHON) $(SCRIPTDIR)version.py)
release: versioncheck
$(call log_step, "Creating v$(VERSION) release binaries")
$(Q)$(MAKE) -C . build_release VERSION=$(VERSION)
$(call cleandir,$(RELEASEDIR))
$(call cleandir,$(RELEASEDIR)syntax$(S))
$(call cleandir,$(RELEASEDIR)manual$(S))
$(call log_step, "Copying common release artifacts")
$(Q)$(CCOPY) ..$(S)reference$(S)source$(S)*.pdf $(RELEASEDIR)manual
$(Q)$(CCOPY) ..$(S)documents$(S)superbasic.sublime-syntax $(RELEASEDIR)syntax
$(Q)$(PYTHON) -c "with open('$(RELEASEDIR)VERSION', 'w') as f: f.write('$(VERSION)')"
$(call log_step, "Done")
#
# Run various tests.
#
test:
$(PYTHON) $(SCRIPTDIR)simpletests.py
astest:
$(PYTHON) $(SCRIPTDIR)assign.py
sastest:
$(PYTHON) $(SCRIPTDIR)assign.py all
artest:
$(PYTHON) $(SCRIPTDIR)array.py
benchmark:
$(CCOPY) ..$(S)documents$(S)benchmarks$(S)bm$(ID).bas storage$(S)load.dat
paging:
$(PYTHON) $(SCRIPTDIR)checkpaging.py
#
# Test on real hardware
#
run: build
foenixmgr binary --address 5000 $(BUILD_OUT)
flash: build
foenixmgr flash-bulk build/basic.csv
#
# Build kernel and copy ROMs to MAME
#
kernel:
$(Q)$(MAKE) -C $(KERNEL_PATH)
$(Q)$(CCOPY) $(KERNEL_PATH)/bin/*.bin $(MAME_PATH)/roms/f256k
$(Q)$(CDEL) $(MAME_PATH)/nvram/f256k/flash
#
# Test in emulator
#
emu: build $(IMAGE)
$(Q)$(CCOPY) $(BUILDDIR)/sb*.bin $(MAME_PATH)/roms/f256k
$(Q)$(CDEL) $(MAME_PATH)/nvram/f256k/flash
cd $(MAME_PATH) && ./f256k f256k -window -resolution 1280x720 -skip_gameinfo -harddisk $(BASIC_TESTS_PATH)/.output/tests.img -rompath roms
emu2: build $(IMAGE)
$(Q)$(CDEL) $(MAME_PATH)/nvram/f256k/flash
cd $(MAME_PATH) && ./f256k f256k -window -resolution 1280x720 -skip_gameinfo -harddisk $(BASIC_TESTS_PATH)/.output/tests.img -rompath roms
$(IMAGE): $(BASIC_TESTS_PATH)/ashanghai
$(PYTHON) $(BASIC_TESTS_PATH)/prepare-disk.py -t $<