Browse code

Add a binary compilation script

Pawel Jablonski authored on 11/06/2024 09:36:39
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,142 @@
1
+TOOLS_UROM_DIR = ../tools/urom
2
+TOOLS_ASM_DIR = ../tools/asm
3
+TOOLS_EMU_DIR = ../tools/emu
4
+TOOLS_FONTS_DIR = ../tools/fonts
5
+
6
+ifeq ($(OS),Windows_NT)
7
+	TOOLS_UROM_EXE = urom.exe
8
+	TOOLS_ASM_EXE = asm.exe
9
+	TOOLS_EMU_EXE = emu.exe
10
+	
11
+	TOOLS_LIB_DIR = ../tools/lib
12
+else
13
+	TOOLS_UROM_EXE = urom
14
+	TOOLS_ASM_EXE = asm
15
+	TOOLS_EMU_EXE = emu
16
+endif
17
+
18
+CPU_BIOS_DIR = ../cpu/bios
19
+CPU_BIOS_BIN = bios.bin
20
+CPU_BIOS_MAP = bios.map
21
+
22
+SYS_OS_DIR = ../sys/os
23
+SYS_OS_BIN = os.bin
24
+SYS_OS_MAP = os.map
25
+
26
+SYS_FS_DIR = ../sys/fs
27
+SYS_FS_APP = app
28
+SYS_FS_FILE = file
29
+
30
+IO_FW_DIR = ../io/fw
31
+IO_FW_HEX = Objects/io.hex
32
+
33
+.PHONY: all
34
+all: cpu_urom cpu_bios sys_fs io_fw tools
35
+
36
+.PHONY: cpu_urom
37
+cpu_urom: cpu tools
38
+	rm -rf cpu/urom
39
+	mkdir -p cpu/urom
40
+
41
+ifeq ($(OS),Windows_NT)
42
+ifdef WINE
43
+	cd cpu/urom; \
44
+	$(WINE) ../../tools/$(TOOLS_UROM_EXE)
45
+else
46
+	cd cpu/urom; \
47
+	../../tools/$(TOOLS_UROM_EXE)
48
+endif
49
+else
50
+	cd cpu/urom; \
51
+	../../tools/$(TOOLS_UROM_EXE)
52
+endif
53
+
54
+.PHONY: cpu_bios
55
+cpu_bios: cpu tools sys_map
56
+	rm -rf cpu/bios
57
+	$(MAKE) -C $(CPU_BIOS_DIR)
58
+	mkdir -p cpu/bios
59
+	cp $(CPU_BIOS_DIR)/$(CPU_BIOS_BIN) cpu/bios
60
+	cp $(CPU_BIOS_DIR)/$(CPU_BIOS_MAP) sys/map
61
+	
62
+.PHONY: sys_os
63
+sys_os: sys tools sys_fs_dirs cpu_bios sys_map
64
+	$(MAKE) -C $(SYS_OS_DIR)
65
+	cp $(SYS_OS_DIR)/$(SYS_OS_BIN) sys/fs
66
+	cp $(SYS_OS_DIR)/$(SYS_OS_MAP) sys/map
67
+
68
+.PHONY: sys_map
69
+sys_map: sys
70
+	rm -rf sys/map
71
+	mkdir -p sys/map
72
+
73
+.PHONY: sys_fs_dirs
74
+sys_fs_dirs:
75
+	rm -rf sys/fs
76
+	mkdir -p sys/fs
77
+
78
+.PHONY: sys_fs
79
+sys_fs: sys tools sys_fs_dirs cpu_bios sys_os
80
+	$(MAKE) -C $(SYS_FS_DIR)
81
+	
82
+	cp -r $(SYS_FS_DIR)/$(SYS_FS_APP) sys/fs
83
+	cp -r $(SYS_FS_DIR)/$(SYS_FS_FILE) sys/fs
84
+
85
+.PHONY: io_fw
86
+io_fw: io
87
+	rm -rf io/fw
88
+	$(MAKE) -C $(IO_FW_DIR) src
89
+	mkdir -p io/fw
90
+	cp -f $(IO_FW_DIR)/src/$(IO_FW_HEX) io/fw | true
91
+
92
+tools: tools_urom tools_asm tools_emu
93
+	rm -rf tools
94
+	mkdir -p tools
95
+	cp $(TOOLS_UROM_DIR)/src/$(TOOLS_UROM_EXE) tools
96
+	cp $(TOOLS_ASM_DIR)/src/$(TOOLS_ASM_EXE) tools
97
+	cp $(TOOLS_EMU_DIR)/src/$(TOOLS_EMU_EXE) tools
98
+	
99
+	cp -r $(TOOLS_FONTS_DIR) tools
100
+	
101
+ifeq ($(OS),Windows_NT)
102
+	cp -r $(TOOLS_LIB_DIR)/* tools
103
+endif
104
+
105
+cpu:
106
+	rm -rf cpu
107
+	mkdir -p cpu
108
+
109
+sys:
110
+	rm -rf sys
111
+	mkdir -p sys
112
+
113
+io:
114
+	rm -rf io
115
+	mkdir -p io
116
+
117
+.PHONY: tools_asm
118
+tools_asm:
119
+	$(MAKE) -C $(TOOLS_ASM_DIR) src
120
+
121
+.PHONY: tools_emu
122
+tools_emu:
123
+	$(MAKE) -C $(TOOLS_EMU_DIR) src
124
+
125
+.PHONY: tools_urom
126
+tools_urom:
127
+	$(MAKE) -C $(TOOLS_UROM_DIR) src
128
+
129
+.PHONY: clean
130
+clean:
131
+	$(MAKE) -C $(CPU_BIOS_DIR) clean
132
+	$(MAKE) -C $(SYS_OS_DIR) clean
133
+	$(MAKE) -C $(SYS_FS_DIR) clean
134
+	$(MAKE) -C $(IO_FW_DIR) clean
135
+	$(MAKE) -C $(TOOLS_UROM_DIR) clean
136
+	$(MAKE) -C $(TOOLS_ASM_DIR) clean
137
+	$(MAKE) -C $(TOOLS_EMU_DIR) clean
138
+	
139
+	rm -rf cpu
140
+	rm -rf sys
141
+	rm -rf io
142
+	rm -rf tools