1 | ####################################################################################################
|
---|
2 | # Makefile to build XTIDE Universal BIOS. #
|
---|
3 | # #
|
---|
4 | # Valid makefile targets are: #
|
---|
5 | # all Removes existing files and builds binary files in \Build #
|
---|
6 | # small Builds 8 kiB binaries only (without checksum) #
|
---|
7 | # large Builds 15 kiB binaries only (without checksum) #
|
---|
8 | # clean Removes all files from \Build #
|
---|
9 | # checksum* Builds all and then generates checksum byte to all binary files #
|
---|
10 | # strings* Compress src\Strings.asm to src\StringsCompressed.asm #
|
---|
11 | # unused* Checks if there are any unused functions that can be removed to save space #
|
---|
12 | # #
|
---|
13 | # * at the end of target name means that Perl is required for the job. #
|
---|
14 | # Build directory must be created manually if it does not exist. #
|
---|
15 | # #
|
---|
16 | # #
|
---|
17 | # Following modules can be included or excluded: #
|
---|
18 | # MODULE_8BIT_IDE Support for 8-BIT IDE cards like XTIDE #
|
---|
19 | # MODULE_8BIT_IDE_ADVANCED Support for memory mapped and DMA based cards like JRIDE and XTCF #
|
---|
20 | # MODULE_ADVANCED_ATA Native support for some VLB IDE controllers #
|
---|
21 | # MODULE_BOOT_MENU Boot Menu for selection of drive to boot from #
|
---|
22 | # MODULE_EBIOS Enhanced functions for accessing drives over 8.4 GB #
|
---|
23 | # MODULE_HOTKEYS Hotkey Bar to boot from any drive #
|
---|
24 | # MODULE_IRQ IDE IRQ support #
|
---|
25 | # MODULE_SERIAL Virtual hard disks using serial port #
|
---|
26 | # MODULE_SERIAL_FLOPPY Virtual floppy drives using serial port (requires MODULE_SERIAL) #
|
---|
27 | # MODULE_STRINGS_COMPRESSED Use compressed strings to save space #
|
---|
28 | # MODULE_FEATURE_SETS Power Management support #
|
---|
29 | # #
|
---|
30 | # Not modules but these affect the assembly: #
|
---|
31 | # ELIMINATE_CGA_SNOW Prevents CGA snowing at the cost of a few bytes #
|
---|
32 | # RELOCATE_INT13H_STACK Relocates INT 13h stack to top of stolen conventional memory #
|
---|
33 | # RESERVE_DIAGNOSTIC_CYLINDER Reserve one L-CHS cylinder for compatibility with old BIOSes #
|
---|
34 | # USE_186 Use instructions supported by 80188/80186 and V20/V30 and later #
|
---|
35 | # USE_286 Use instructions supported by 286 and later #
|
---|
36 | # USE_386 Use instructions supported by 386 and later #
|
---|
37 | # USE_AT Use features supported on AT and later systems (not available on XT) #
|
---|
38 | # USE_UNDOC_INTEL Optimizations for Intel CPU:s - do NOT use on NEC V20/V30/Sony CPU:s #
|
---|
39 | # #
|
---|
40 | ####################################################################################################
|
---|
41 |
|
---|
42 | ###########################################
|
---|
43 | # Source files and destination executable #
|
---|
44 | ###########################################
|
---|
45 |
|
---|
46 | # Assembly source code file (*.asm):
|
---|
47 | SRC_ASM = Src/Main.asm
|
---|
48 |
|
---|
49 | # Program executable file name without extension:
|
---|
50 | PROG = ide
|
---|
51 |
|
---|
52 |
|
---|
53 | #######################################
|
---|
54 | # Destination and include directories #
|
---|
55 | #######################################
|
---|
56 |
|
---|
57 | # Directory where binary file will be compiled to
|
---|
58 | BUILD_DIR = Build
|
---|
59 |
|
---|
60 | # Subdirectories where included files are:
|
---|
61 | HEADERS = Inc/
|
---|
62 | HEADERS += Inc/Controllers/
|
---|
63 | HEADERS += Src/
|
---|
64 | HEADERS += Src/Handlers/
|
---|
65 | HEADERS += Src/Handlers/Int13h/
|
---|
66 | HEADERS += Src/Handlers/Int13h/EBIOS/
|
---|
67 | HEADERS += Src/Handlers/Int13h/Tools/
|
---|
68 | HEADERS += Src/Handlers/Int19h/
|
---|
69 | HEADERS += Src/Device/
|
---|
70 | HEADERS += Src/Device/IDE/
|
---|
71 | HEADERS += Src/Device/MemoryMappedIDE/
|
---|
72 | HEADERS += Src/Device/Serial/
|
---|
73 | HEADERS += Src/Initialization/
|
---|
74 | HEADERS += Src/Initialization/AdvancedAta/
|
---|
75 | HEADERS += Src/Menus/
|
---|
76 | HEADERS += Src/Menus/BootMenu/
|
---|
77 | HEADERS += Src/Libraries/
|
---|
78 | HEADERS += Src/VariablesAndDPTs/
|
---|
79 |
|
---|
80 | # Subdirectories where library files are:
|
---|
81 | LIBS = ../Assembly_Library/Inc/
|
---|
82 | LIBS += ../Assembly_Library/Src/
|
---|
83 | LIBS += ../Assembly_Library/Src/Display/
|
---|
84 | LIBS += ../Assembly_Library/Src/File/
|
---|
85 | LIBS += ../Assembly_Library/Src/Keyboard/
|
---|
86 | LIBS += ../Assembly_Library/Src/Menu/
|
---|
87 | LIBS += ../Assembly_Library/Src/Menu/Dialog/
|
---|
88 | LIBS += ../Assembly_Library/Src/String/
|
---|
89 | LIBS += ../Assembly_Library/Src/Time/
|
---|
90 | LIBS += ../Assembly_Library/Src/Util/
|
---|
91 | LIBS += ../Assembly_Library/Src/Serial/
|
---|
92 | LIBS += ../XTIDE_Universal_BIOS/Inc/
|
---|
93 | HEADERS += $(LIBS)
|
---|
94 |
|
---|
95 |
|
---|
96 | #################################################################
|
---|
97 | # Assembler preprocessor defines. #
|
---|
98 | #################################################################
|
---|
99 | DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_EBIOS MODULE_FEATURE_SETS RESERVE_DIAGNOSTIC_CYLINDER
|
---|
100 | DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED
|
---|
101 |
|
---|
102 | DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
|
---|
103 | DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186
|
---|
104 | DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 USE_UNDOC_INTEL RELOCATE_INT13H_STACK MODULE_IRQ MODULE_ADVANCED_ATA
|
---|
105 |
|
---|
106 | DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
|
---|
107 | DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
|
---|
108 | DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
|
---|
109 |
|
---|
110 | DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE
|
---|
111 | DEFINES_386_8K = $(DEFINES_AT) USE_386
|
---|
112 |
|
---|
113 | DEFINES_ALL_FEATURES = MODULE_8BIT_IDE MODULE_ADVANCED_ATA MODULE_BOOT_MENU MODULE_EBIOS MODULE_HOTKEYS MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_STRINGS_COMPRESSED MODULE_FEATURE_SETS MODULE_8BIT_IDE_ADVANCED
|
---|
114 |
|
---|
115 |
|
---|
116 | ###################
|
---|
117 | # Other variables #
|
---|
118 | ###################
|
---|
119 |
|
---|
120 | # Target size of the ROM, used in main.asm for number of 512B blocks and by checksum Perl script below
|
---|
121 | BIOS_SIZE = 8192 # For BIOS header (use even multiplier!)
|
---|
122 | ROMSIZE = $(BIOS_SIZE) # Size of binary to build when building with make checksum
|
---|
123 | BIOS_SIZE_LARGE = 10240
|
---|
124 | ROMSIZE_LARGE = $(BIOS_SIZE_LARGE)
|
---|
125 |
|
---|
126 | # Add -D in front of every preprocessor define declaration
|
---|
127 | DEFS_XT = $(DEFINES_XT:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE)
|
---|
128 | DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE)
|
---|
129 | DEFS_AT = $(DEFINES_AT:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE)
|
---|
130 | DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
|
---|
131 | DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
|
---|
132 | DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
|
---|
133 | DEFS_XT_TINY = $(DEFINES_XT_TINY:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE)
|
---|
134 | DEFS_386_8K = $(DEFINES_386_8K:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE)
|
---|
135 | DEFS_ALL_FEATURES = $(DEFINES_ALL_FEATURES:%=-D%)
|
---|
136 |
|
---|
137 | # Add -I in front of all header directories
|
---|
138 | IHEADERS = $(HEADERS:%=-I%)
|
---|
139 |
|
---|
140 | # Path + target file to be built
|
---|
141 | TARGET = $(BUILD_DIR)/$(PROG)
|
---|
142 |
|
---|
143 | #########################
|
---|
144 | # Compilers and linkers #
|
---|
145 | #########################
|
---|
146 |
|
---|
147 | # Make
|
---|
148 | MAKE = mingw32-make.exe
|
---|
149 |
|
---|
150 | # Assembler
|
---|
151 | AS = nasm.exe
|
---|
152 |
|
---|
153 | # use this command to erase files.
|
---|
154 | RM = -del /Q
|
---|
155 |
|
---|
156 |
|
---|
157 | #############################
|
---|
158 | # Compiler and linker flags #
|
---|
159 | #############################
|
---|
160 |
|
---|
161 | # Assembly compiler flags
|
---|
162 | ASFLAGS = -f bin # Produce binary object files
|
---|
163 | ASFLAGS += $(IHEADERS) # Set header file directory paths
|
---|
164 | ASFLAGS += -Worphan-labels # Warn about labels without colon
|
---|
165 | ASFLAGS += -Ox # Optimize operands to their shortest forms
|
---|
166 |
|
---|
167 |
|
---|
168 | ############################################
|
---|
169 | # Build process. Actual work is done here. #
|
---|
170 | ############################################
|
---|
171 |
|
---|
172 | all: clean small large
|
---|
173 | @echo All done!
|
---|
174 |
|
---|
175 | small: xt_tiny xt xtplus at 386_8k
|
---|
176 | @echo All small binaries built!
|
---|
177 |
|
---|
178 | large: xt_large xtplus_large at_large
|
---|
179 | @echo All large binaries built!
|
---|
180 |
|
---|
181 | at:
|
---|
182 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
|
---|
183 | @echo * Small AT version "$(TARGET)_at.bin" built.
|
---|
184 |
|
---|
185 | at_large:
|
---|
186 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
|
---|
187 | @echo *Large AT version "$(TARGET)_atl.bin" built.
|
---|
188 |
|
---|
189 | xtplus:
|
---|
190 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
|
---|
191 | @echo * Small XT Plus version "$(TARGET)_xtp.bin" built.
|
---|
192 |
|
---|
193 | xtplus_large:
|
---|
194 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
|
---|
195 | @echo *Large XT Plus version "$(TARGET)_xtpl.bin" built.
|
---|
196 |
|
---|
197 | xt:
|
---|
198 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
|
---|
199 | @echo * Small XT version "$(TARGET)_xt.bin" built.
|
---|
200 |
|
---|
201 | xt_large:
|
---|
202 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
|
---|
203 | @echo *Large XT version "$(TARGET)_xtl.bin" built.
|
---|
204 |
|
---|
205 | xt_tiny:
|
---|
206 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -l"$(TARGET)_tiny.lst" -o"$(TARGET)_tiny.bin"
|
---|
207 | @echo * Tiny XT version "$(TARGET)_tiny.bin" built.
|
---|
208 |
|
---|
209 | 386_8k:
|
---|
210 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_8K) -l"$(TARGET)_386.lst" -o"$(TARGET)_386.bin"
|
---|
211 | @echo * Small 386 version "$(TARGET)_386.bin" built.
|
---|
212 |
|
---|
213 | strings: src\Strings.asm
|
---|
214 | @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_AT_LARGE) -DCHECK_FOR_UNUSED_ENTRYPOINTS -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
|
---|
215 | @perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
|
---|
216 | @echo StringsCompressed.asm updated!
|
---|
217 |
|
---|
218 | clean:
|
---|
219 | @$(RM) $(BUILD_DIR)\*.*
|
---|
220 | @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
|
---|
221 |
|
---|
222 | checksum: all
|
---|
223 | @perl ..\tools\checksum.pl $(TARGET)_tiny.bin $(ROMSIZE)
|
---|
224 | @perl ..\tools\checksum.pl $(TARGET)_xt.bin $(ROMSIZE)
|
---|
225 | @perl ..\tools\checksum.pl $(TARGET)_xtp.bin $(ROMSIZE)
|
---|
226 | @perl ..\tools\checksum.pl $(TARGET)_at.bin $(ROMSIZE)
|
---|
227 | @perl ..\tools\checksum.pl $(TARGET)_xtl.bin $(ROMSIZE_LARGE)
|
---|
228 | @perl ..\tools\checksum.pl $(TARGET)_xtpl.bin $(ROMSIZE_LARGE)
|
---|
229 | @perl ..\tools\checksum.pl $(TARGET)_atl.bin $(ROMSIZE_LARGE)
|
---|
230 | @perl ..\tools\checksum.pl $(TARGET)_386.bin $(ROMSIZE)
|
---|
231 |
|
---|
232 | unused:
|
---|
233 | @echo "All Features"
|
---|
234 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_ALL_FEATURES) $(DEFS_XT) $(DEFS_XT_PLUS) $(DEFS_AT) $(DEFS_XT_LARGE) $(DEFS_XTPLUS_LARGE) $(DEFS_AT_LARGE) $(DEFS_XT_TINY) $(DEFS_386_8K) -o"$(TARGET)_unused.asm" -l"$(TARGET)_unused.lst"
|
---|
235 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_ALL_FEATURES) $(DEFS_XT) $(DEFS_XT_PLUS) $(DEFS_AT) $(DEFS_XT_LARGE) $(DEFS_XTPLUS_LARGE) $(DEFS_AT_LARGE) $(DEFS_XT_TINY) $(DEFS_386_8K) -o"$(TARGET)_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
236 | @perl ..\tools\unused.pl $(TARGET)_unused.lst $(TARGET)_unused.asm
|
---|
237 | @echo "XT Small"
|
---|
238 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -l"$(TARGET)_unused_xt.lst"
|
---|
239 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
240 | @perl ..\tools\unused.pl $(TARGET)_unused_xt.lst $(TARGET)_unused_xt.asm
|
---|
241 | @echo "XT Large"
|
---|
242 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -l"$(TARGET)_unused_xtl.lst"
|
---|
243 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
244 | @perl ..\tools\unused.pl $(TARGET)_unused_xtl.lst $(TARGET)_unused_xtl.asm
|
---|
245 | @echo "AT Small"
|
---|
246 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -l"$(TARGET)_unused_at.lst"
|
---|
247 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
248 | @perl ..\tools\unused.pl $(TARGET)_unused_at.lst $(TARGET)_unused_at.asm
|
---|
249 | @echo "AT Large"
|
---|
250 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -l"$(TARGET)_unused_atl.lst"
|
---|
251 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
252 | @perl ..\tools\unused.pl $(TARGET)_unused_atl.lst $(TARGET)_unused_atl.asm
|
---|
253 |
|
---|
254 |
|
---|