-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
266 lines (214 loc) · 13.2 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
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
include build_options.mk
BOSOS_BUILD_FLAGS += -i $(call QUOTE_ARG,NUM_RANDOM_ADDRESS_TESTS:=$(NUM_RANDOM_ADDRESS_TESTS))
ifeq ($(ENABLE_THREADING_ON_BOOT),YES)
BOSOS_BUILD_FLAGS += -i $(call QUOTE_ARG,ENABLE_THREADING_ON_BOOT:=1)
endif
# common/os specific things copied from CE toolchain /meta/makefile.mk
ifeq ($(OS),Windows_NT)
SHELL = cmd.exe
NATIVEPATH = $(subst /,\,$1)
DIRNAME = $(filter-out %:,$(patsubst %\,%,$(dir $1)))
RM = del /f 2>nul
RMDIR = call && (if exist $1 rmdir /s /q $1)
MKDIR = call && (if not exist $1 mkdir $1)
PREFIX ?= C:
INSTALLLOC := $(call NATIVEPATH,$(DESTDIR)$(PREFIX))
CP = copy /y
EXMPL_DIR = $(call NATIVEPATH,$(INSTALLLOC)/CEdev/examples)
CPDIR = xcopy /e /i /q /r /y /b
CP_EXMPLS = $(call MKDIR,$(EXMPL_DIR)) && $(CPDIR) $(call NATIVEPATH,$(CURDIR)/examples) $(EXMPL_DIR)
ARCH = $(call MKDIR,release) && cd tools\installer && ISCC.exe /DAPP_VERSION=8.4 /DDIST_PATH=$(call NATIVEPATH,$(DESTDIR)$(PREFIX)/CEdev) installer.iss && \
cd ..\.. && move /y tools\installer\CEdev.exe release\\
QUOTE_ARG = "$(subst ",',$1)"#'
APPEND = @echo.$(subst ",^",$(subst \,^\,$(subst &,^&,$(subst |,^|,$(subst >,^>,$(subst <,^<,$(subst ^,^^,$1))))))) >>$@
else
NATIVEPATH = $(subst \,/,$1)
DIRNAME = $(patsubst %/,%,$(dir $1))
RM = rm -f
RMDIR = rm -rf $1
MKDIR = mkdir -p $1
PREFIX ?= $(HOME)
INSTALLLOC := $(call NATIVEPATH,$(DESTDIR)$(PREFIX))
CP = cp
CPDIR = cp -r
CP_EXMPLS = $(CPDIR) $(call NATIVEPATH,$(CURDIR)/examples) $(call NATIVEPATH,$(INSTALLLOC)/CEdev)
ARCH = cd $(INSTALLLOC) && tar -czf $(RELEASE_NAME).tar.gz $(RELEASE_NAME) ; \
cd $(CURDIR) && $(call MKDIR,release) && mv -f $(INSTALLLOC)/$(RELEASE_NAME).tar.gz release
CHMOD = find $(BIN) -name "*.exe" -exec chmod +x {} \;
QUOTE_ARG = '$(subst ','\'',$1)'#'
APPEND = @echo $(call QUOTE_ARG,$1) >>$@
endif
# source: http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
rwildcard = $(strip $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2) $(filter $(subst %%,%,%$(subst *,%,$2)),$d)))
FSOBJ ?= $(call NATIVEPATH,src/data/adrive/obj)
FSSRC ?= $(call NATIVEPATH,src/data/adrive/src)
#build rules
all: objdirs includes noti filesystem internal_includes bosos bosbin bos8xp bosrom
artifact:
python buildutil.py artifact
version:
python buildutil.py version add 0.0.1
version-minor:
python buildutil.py version add 0.0.100
version-major:
python buildutil.py version add 0.1.0
# Rule to build OS data
bosos: $(call rwildcard,src,*.asm) $(call rwildcard,src,*.inc)
fasmg $(call NATIVEPATH,src/main.asm) $(call NATIVEPATH,obj/bosos.bin) $(BOSOS_BUILD_FLAGS)
# Rule to build documentation
documentation:
python build_docs.py
# Rule to build syscall libs (optional)
syslibs: $(call rwildcard,syslib,*.asm)
python build_syslibs.py
$(call MKDIR,$(call NATIVEPATH,obj/syslib))
fasmg syslib/fs.asm obj/syslib/fs.bin
fasmg syslib/gfx.asm obj/syslib/gfx.bin
fasmg syslib/gui.asm obj/syslib/gui.bin
fasmg syslib/os.asm obj/syslib/os.bin
fasmg syslib/sys.asm obj/syslib/sys.bin
fasmg syslib/str.asm obj/syslib/str.bin
fasmg syslib/th.asm obj/syslib/th.bin
fasmg syslib/util.asm obj/syslib/util.bin
python add_file_to_rom.py --rom bin/BOSOSInited.rom obj/syslib/fs.bin /sys/fs obj/syslib/gfx.bin /sys/gfx obj/syslib/gui.bin /sys/gui obj/syslib/os.bin /sys/os obj/syslib/str.bin /sys/str obj/syslib/sys.bin /sys/sys obj/syslib/th.bin /sys/th obj/syslib/util.bin /sys/util
# Rule to build include files
includes:
python build_bos_inc.py
$(CP) bos.inc $(call NATIVEPATH,src/include)
$(CPDIR) $(call NATIVEPATH,src/include) $(call NATIVEPATH,$(FSSRC)/)
$(CPDIR) $(call NATIVEPATH,src/include) $(call NATIVEPATH,$(FSSRC)/fs/bin/)
$(CPDIR) $(call NATIVEPATH,src/include) $(call NATIVEPATH,$(FSSRC)/fs/lib/)
fasmg $(call NATIVEPATH,src/data/adrive/osrt.asm) $(call NATIVEPATH,src/data/adrive/osrt.tmp)
$(CP) $(call NATIVEPATH,src/data/adrive/osrt.inc) $(call NATIVEPATH,src/include/osrt.inc)
$(CP) $(call NATIVEPATH,src/data/adrive/osrt.inc) $(call NATIVEPATH,$(FSSRC)/include/osrt.inc)
$(CP) $(call NATIVEPATH,src/data/adrive/osrt.inc) $(call NATIVEPATH,$(FSSRC)/fs/bin/include/osrt.inc)
$(CP) $(call NATIVEPATH,src/data/adrive/osrt.inc) $(call NATIVEPATH,$(FSSRC)/fs/lib/include/osrt.inc)
python build_bos_src.py
internal_includes:
python build_bos_internal_inc.py $(BOSOS_BUILD_FLAGS)
# Rule to create object and binary directories
objdirs:
$(call MKDIR,bin)
$(call MKDIR,obj)
$(call MKDIR,$(call NATIVEPATH,noti-ez80/bin))
$(call MKDIR,$(call NATIVEPATH,src/data/adrive/obj))
# LibLoad Library build rules
$(call NATIVEPATH,$(FSOBJ)/libload.bin): $(call NATIVEPATH,$(FSSRC)/fs/lib/libload/libload.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/lib/libload/libload.asm) $(call NATIVEPATH,$(FSOBJ)/libload.bin)
$(call NATIVEPATH,$(FSOBJ)/fatdrvce.bin): $(call NATIVEPATH,$(FSSRC)/fs/lib/fatdrvce/fatdrvce.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/lib/fatdrvce/fatdrvce.asm) $(call NATIVEPATH,$(FSOBJ)/fatdrvce.bin)
$(call NATIVEPATH,$(FSOBJ)/fileioc.bin): $(call NATIVEPATH,$(FSSRC)/fs/lib/fileioc/fileioc.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/lib/fileioc/fileioc.asm) $(call NATIVEPATH,$(FSOBJ)/fileioc.bin)
$(call NATIVEPATH,$(FSOBJ)/fontlibc.bin): $(call NATIVEPATH,$(FSSRC)/fs/lib/fontlibc/fontlibc.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/lib/fontlibc/fontlibc.asm) $(call NATIVEPATH,$(FSOBJ)/fontlibc.bin)
$(call NATIVEPATH,$(FSOBJ)/graphx.bin): $(call NATIVEPATH,$(FSSRC)/fs/lib/graphx/graphx.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/lib/graphx/graphx.asm) $(call NATIVEPATH,$(FSOBJ)/graphx.bin)
$(call NATIVEPATH,$(FSOBJ)/keypadc.bin): $(call NATIVEPATH,$(FSSRC)/fs/lib/keypadc/keypadc.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/lib/keypadc/keypadc.asm) $(call NATIVEPATH,$(FSOBJ)/keypadc.bin)
$(call NATIVEPATH,$(FSOBJ)/msddrvce.bin): $(call NATIVEPATH,$(FSSRC)/fs/lib/msddrvce/msddrvce.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/lib/msddrvce/msddrvce.asm) $(call NATIVEPATH,$(FSOBJ)/msddrvce.bin)
$(call NATIVEPATH,$(FSOBJ)/srldrvce.bin): $(call NATIVEPATH,$(FSSRC)/fs/lib/srldrvce/srldrvce.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/lib/srldrvce/srldrvce.asm) $(call NATIVEPATH,$(FSOBJ)/srldrvce.bin)
$(call NATIVEPATH,$(FSOBJ)/usbdrvce.bin): $(call NATIVEPATH,$(FSSRC)/fs/lib/usbdrvce/usbdrvce.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/lib/usbdrvce/usbdrvce.asm) $(call NATIVEPATH,$(FSOBJ)/usbdrvce.bin)
# OS Files build rules
$(call NATIVEPATH,$(FSOBJ)/explorer.bin): $(call rwildcard,$(call NATIVEPATH,$(FSSRC)/fs/bin/explorer),*.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/bin/explorer/explorer.asm) $(call NATIVEPATH,$(FSOBJ)/explorer.bin)
$(call NATIVEPATH,$(FSOBJ)/memedit.bin): $(call NATIVEPATH,$(FSSRC)/fs/bin/memedit.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/bin/memedit.asm) $(call NATIVEPATH,$(FSOBJ)/memedit.bin)
#$(call NATIVEPATH,$(FSOBJ)/cfg.bin): $(call NATIVEPATH,$(FSSRC)/fs/sys/cfg.asm)
# fasmg $(call NATIVEPATH,$(FSSRC)/fs/sys/cfg.asm) $(call NATIVEPATH,$(FSOBJ)/cfg.bin)
# convbin -i $(call NATIVEPATH,$(FSOBJ)/cfg.bin) -o $(call NATIVEPATH,$(FSOBJ)/cfg.zx7.bin) -j bin -k bin -c zx7
$(call NATIVEPATH,$(FSOBJ)/cedit.zx7.bin): $(call rwildcard,$(call NATIVEPATH,$(FSSRC)/fs/bin/cedit/src),*)
$(Q)make -f bos.makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/cedit/)
convbin -i $(call NATIVEPATH,$(FSSRC)/fs/bin/cedit/bosbin/CEDIT.bin) -o $(call NATIVEPATH,$(FSOBJ)/cedit.zx7.bin) -j bin -k bin -c zx7
#$(call NATIVEPATH,$(FSOBJ)/edit.zx7.bin): $(call rwildcard,$(call NATIVEPATH,$(FSSRC)/fs/bin/edit/src),*)
# $(Q)make -f makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/edit/)
# convbin -i $(call NATIVEPATH,$(FSSRC)/fs/bin/edit/bosbin/edit.bin) -o $(call NATIVEPATH,$(FSOBJ)/edit.zx7.bin) -j bin -k bin -c zx7
$(call NATIVEPATH,$(FSOBJ)/msd.zx7.bin): $(call rwildcard,$(call NATIVEPATH,$(FSSRC)/fs/bin/msd/src),*)
$(Q)make -f makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/msd/)
convbin -i $(call NATIVEPATH,$(FSSRC)/fs/bin/msd/bosbin/MSD.bin) -o $(call NATIVEPATH,$(FSOBJ)/msd.zx7.bin) -j bin -k bin -c zx7
$(call NATIVEPATH,$(FSOBJ)/serial.zx7.bin): $(call rwildcard,$(call NATIVEPATH,$(FSSRC)/fs/bin/serial/src),*)
$(Q)make -f makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/serial/)
convbin -i $(call NATIVEPATH,$(FSSRC)/fs/bin/serial/bosbin/serial.bin) -o $(call NATIVEPATH,$(FSOBJ)/serial.zx7.bin) -j bin -k bin -c zx7
# filesystem var build rules
$(call NATIVEPATH,$(FSOBJ)/LIB.bin): $(call NATIVEPATH,$(FSSRC)/fs/var/LIB.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/var/LIB.asm) $(call NATIVEPATH,$(FSOBJ)/LIB.bin)
convbin -i $(call NATIVEPATH,$(FSOBJ)/LIB.bin) -o $(call NATIVEPATH,$(FSOBJ)/LIB.zx7.bin) -j bin -k bin -c zx7
$(call NATIVEPATH,$(FSOBJ)/PATH.bin): $(call NATIVEPATH,$(FSSRC)/fs/var/PATH.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/var/PATH.asm) $(call NATIVEPATH,$(FSOBJ)/PATH.bin)
convbin -i $(call NATIVEPATH,$(FSOBJ)/PATH.bin) -o $(call NATIVEPATH,$(FSOBJ)/PATH.zx7.bin) -j bin -k bin -c zx7
$(call NATIVEPATH,$(FSOBJ)/TIVARS.bin): $(call NATIVEPATH,$(FSSRC)/fs/var/TIVARS.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/var/TIVARS.asm) $(call NATIVEPATH,$(FSOBJ)/TIVARS.bin)
convbin -i $(call NATIVEPATH,$(FSOBJ)/TIVARS.bin) -o $(call NATIVEPATH,$(FSOBJ)/TIVARS.zx7.bin) -j bin -k bin -c zx7
$(call NATIVEPATH,$(FSOBJ)/SYSCALLS.bin): $(call NATIVEPATH,$(FSSRC)/fs/var/SYSCALLS.asm)
fasmg $(call NATIVEPATH,$(FSSRC)/fs/var/SYSCALLS.asm) $(call NATIVEPATH,$(FSOBJ)/SYSCALLS.bin)
convbin -i $(call NATIVEPATH,$(FSOBJ)/SYSCALLS.bin) -o $(call NATIVEPATH,$(FSOBJ)/SYSCALLS.zx7.bin) -j bin -k bin -c zx7
# Rule to build Filesytem and compress it
filesystem: $(call rwildcard,$(call NATIVEPATH,$(FSSRC)),*) $(call NATIVEPATH,$(FSOBJ)/libload.bin) $(call NATIVEPATH,$(FSOBJ)/fontlibc.bin) \
$(call NATIVEPATH,$(FSOBJ)/fatdrvce.bin) $(call NATIVEPATH,$(FSOBJ)/fileioc.bin) $(call NATIVEPATH,$(FSOBJ)/graphx.bin) \
$(call NATIVEPATH,$(FSOBJ)/keypadc.bin) $(call NATIVEPATH,$(FSOBJ)/msddrvce.bin) $(call NATIVEPATH,$(FSOBJ)/srldrvce.bin) \
$(call NATIVEPATH,$(FSOBJ)/usbdrvce.bin) $(call NATIVEPATH,$(FSOBJ)/memedit.bin) $(call NATIVEPATH,$(FSOBJ)/cedit.zx7.bin) \
$(call NATIVEPATH,$(FSOBJ)/LIB.bin) $(call NATIVEPATH,$(FSOBJ)/msd.zx7.bin) \
$(call NATIVEPATH,$(FSOBJ)/serial.zx7.bin) $(call NATIVEPATH,$(FSOBJ)/PATH.bin) \
$(call NATIVEPATH,$(FSOBJ)/TIVARS.bin) $(call NATIVEPATH,$(FSOBJ)/SYSCALLS.bin) $(call NATIVEPATH,$(FSOBJ)/explorer.bin)
convbin -i $(call NATIVEPATH,$(FSSRC)/fs/etc/fontlibc/DrMono.dat) -o $(call NATIVEPATH,$(FSOBJ)/DrMono.zx7.dat) -j bin -k bin -c zx7
fasmg $(call NATIVEPATH,$(FSSRC)/main.asm) $(call NATIVEPATH,src/data/adrive/main.bin)
convbin -i $(call NATIVEPATH,src/data/adrive/main.bin) -o $(call NATIVEPATH,src/data/adrive/data.bin) -j bin -k bin -c zx7
convbin -i $(call NATIVEPATH,src/data/adrive/data.bin) -o $(call NATIVEPATH,bin/BOSOSpt2.8xv) -j bin -k 8xv -n BOSOSpt2
$(CP) $(call NATIVEPATH,src/data/adrive/data.bin) $(call NATIVEPATH,bin/BOSOSPT2.BIN)
# Rule to build noti-ez80 submodule required for standalone ROM image
noti: $(call NATIVEPATH,noti-ez80/bin/NOTI.rom)
$(call NATIVEPATH,noti-ez80/bin/NOTI.rom): $(call rwildcard,$(call NATIVEPATH,noti-ez80/src),*)
$(Q)make autostart -f makefile -C $(call NATIVEPATH,noti-ez80/)
# Rule to build Updater binary
bosbin:
fasmg $(call NATIVEPATH,src/updater.asm) $(call NATIVEPATH,bin/BOSUPDTR.BIN)
# Rule to build Installer 8xp
bos8xp:
fasmg $(call NATIVEPATH,src/installer8xp.asm) $(call NATIVEPATH,bin/BOSOS.8xp)
# Rule to build ROM image
bosrom: $(call NATIVEPATH,noti-ez80/bin/NOTI.rom)
fasmg $(call NATIVEPATH,src/rom.asm) $(call NATIVEPATH,bin/BOSOS.rom)
# Rule to clean noti-ez80 submodule
clean-noti:
$(Q)make clean -f makefile -C $(call NATIVEPATH,noti-ez80/)
# Rule to clean cedit submodule
clean-cedit:
$(Q)make clean -f bos.makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/cedit/)
$(Q)echo Removed CEdit objects and binaries.
# Rule to clean edit submodule
clean-edit:
$(Q)make clean -f makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/edit/)
$(Q)echo Removed Edit objects and binaries.
# Rule to clean msd program
clean-msd:
$(Q)make clean -f makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/msd/)
$(Q)echo Removed msd objects and binaries.
# Rule to clean serial program
clean-serial:
$(Q)make clean -f makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/serial/)
$(Q)echo Removed serial objects and binaries.
clean-libs:
$(RM) $(call NATIVEPATH,$(FSOBJ)/libload.bin)
$(RM) $(call NATIVEPATH,$(FSOBJ)/fontlibc.bin)
$(RM) $(call NATIVEPATH,$(FSOBJ)/fatdrvce.bin)
$(RM) $(call NATIVEPATH,$(FSOBJ)/fileioc.bin)
$(RM) $(call NATIVEPATH,$(FSOBJ)/graphx.bin)
$(RM) $(call NATIVEPATH,$(FSOBJ)/keypadc.bin)
$(RM) $(call NATIVEPATH,$(FSOBJ)/msddrvce.bin)
$(RM) $(call NATIVEPATH,$(FSOBJ)/srldrvce.bin)
$(RM) $(call NATIVEPATH,$(FSOBJ)/usbdrvce.bin)
#make clean
clean:
$(call RMDIR,bin)
$(call RMDIR,obj)
$(call RMDIR,$(call NATIVEPATH,src/data/adrive/obj))
$(RM) $(call NATIVEPATH,src/data/adrive/data.bin)
$(RM) $(call NATIVEPATH,src/data/adrive/main.bin)
$(Q)make clean -f makefile -C $(call NATIVEPATH,noti-ez80/)
$(Q)make clean -f bos.makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/cedit/)
$(Q)make clean -f makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/edit/)
$(Q)make clean -f makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/msd/)
$(Q)make clean -f makefile -C $(call NATIVEPATH,$(FSSRC)/fs/bin/serial/)
$(Q)echo Removed objects and binaries.