source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile@ 560

Last change on this file since 560 was 560, checked in by aitotat@…, 11 years ago

Changes to XTIDE Universal BIOS:

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