-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Makefile
77 lines (54 loc) · 1.76 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
# Makefile for the command line tools written in assembler.
# The list of files to process is in the COMS variable.
# The generated files are copied to the bin/tools directory.
ifeq ($(strip $(N80)),)
N80=N80
endif
export N80_ARGS=--no-string-escapes --no-show-banner --build-type rel --verbosity 0 --output-file-case upper --include-directory ../kernel
ifeq ($(strip $(LK80)),)
LK80=LK80
endif
export LK80_ARGS=--no-show-banner --verbosity 0 --output-file-case lower --output-format bin
define copy_to_bin
cp $(1) ../../bin/tools/$(2)
endef
define assemble
@printf "\n\033[0;36mAssembling %s\033[0m\n\n" $(1)
@$(N80) $(1) $(2)
endef
COMS := CONCLUS.COM DELALL.COM DEVINFO.COM DRIVERS.COM DRVINFO.COM FASTOUT.COM LOCK.COM MAPDRV.COM NSYSVER.COM RALLOC.COM
INCS := ../kernel/macros.inc ../kernel/const.inc
RELS := CODES.REL DATA.REL SHARED.REL
asm-tools: $(COMS)
.phony: prerequisites
TOOLS := N80 LK80
prerequisites:
@mkdir -p ../../bin/tools
$(foreach exec,$(TOOLS),\
$(if $(shell which $(exec)),,$(error "ERROR: can't execute $(exec), is it installed/in PATH?")))
-include prerequisites
.SECONDEXPANSION:
$(COMS): \
$$(patsubst %.COM,%.MAC,$$@) \
$(INCS) \
CODES.REL \
DATA.REL \
SHARED.REL
$(call assemble,$(patsubst %.COM,%.MAC,$@))
@$(LK80) --output-file $@ --code 0100h CODES.REL DATA.REL $(patsubst %.COM,%.REL,$@) SHARED.REL
$(call copy_to_bin,$@)
SHARED.REL: \
SHARED.MAC \
$(INCS)
$(call assemble,SHARED.MAC)
CODES.REL: \
../kernel/codes.mac \
$(INCS)
$(call assemble,../kernel/codes.mac)
DATA.REL: \
../kernel/data.mac \
$(INCS)
$(call assemble,../kernel/data.mac)
.PHONY: clean
clean:
for ext in REL rel SYM sym HEX COM; do find . -type f -name "*.$$ext" -delete; done