source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile@ 608

Last change on this file since 608 was 606, checked in by Krister Nordvall, 4 years ago

Changes:

  • RESERVE_DIAGNOSTIC_CYLINDER has been completely removed as it wasted hard drive space, caused a compatibility problem with 32-bit disk access drivers under Windows 3.x and most importantly, it was in fact not needed since the same thing can be accomplished using the "User specified CHS" feature in XTIDECFG which is better because that applies only to that specific drive instead of all drives under XUB control.
  • In BIOS builds containing MODULE_EBIOS (i.e. all official builds except the Tiny build), drives with a cylinder count less than or equal to 1024 had CHS translation applied to them unnecessarily if CHS translation method was set to Auto (which is the default). This bug has been present for a long time and, as a side effect, made RESERVE_DIAGNOSTIC_CYLINDER useless since the idea behind that was to provide compatibility with other old BIOSes using NORMAL addressing mode. WARNING! With this bug now being fixed, upgrading to this revision of the BIOS will require repartitioning and reformatting any drives affected by this (BIOSDRVS.COM can be helpful in determining which drives are affected).
File size: 14.7 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 (requires USE_386) #
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_INIT Initialize on INT 13h if our INT 19h handler is not called #
30# MODULE_POWER_MANAGEMENT Power Management support #
31# MODULE_WIN9X_CMOS_HACK Hack for Windows 9x compatibility #
32# MODULE_MFM_COMPATIBILITY Restores BDA drive count for MFM controllers that expect to be the #
33# only hard drive controller on the system #
34# #
35# Not modules but these affect the assembly: #
36# ELIMINATE_CGA_SNOW Prevents CGA snowing at the cost of a few bytes #
37# RELOCATE_INT13H_STACK ** Relocates INT 13h stack to beginning of stolen conventional memory #
38# NO_ATAID_VALIDATION *** Excludes code that tries to ensure proper communication with drives #
39# USE_186 Use instructions supported by 80188/80186 and V20/V30 and later #
40# USE_286 Use instructions supported by 286 and later (defines USE_UNDOC_INTEL)#
41# USE_386 Use instructions supported by 386 and later (defines USE_286) #
42# USE_AT Use features supported on AT and later systems (not available on XT) #
43# USE_UNDOC_INTEL Optimizations for Intel CPU:s - do NOT use on NEC V20/V30/Sony CPU:s #
44# USE_NEC_V Optimizations for use with NEC V20/V30 processors only #
45# CLD_NEEDED Only needed for compatibility with buggy software/BIOSes #
46# #
47# ** AT Builds only (when USE_AT is defined) #
48# *** Use this only when certain known good drives are not being detected (eg WD Caviars) #
49####################################################################################################
50
51###########################################
52# Source files and destination executable #
53###########################################
54
55# Assembly source code file (*.asm):
56SRC_ASM = Src/Main.asm
57
58# Program executable file name without extension:
59PROG = ide
60
61
62#######################################
63# Destination and include directories #
64#######################################
65
66# Directory where binary file will be compiled to
67BUILD_DIR = Build
68
69# Subdirectories where included files are:
70HEADERS = Inc/
71HEADERS += Inc/Controllers/
72HEADERS += Src/
73HEADERS += Src/Handlers/
74HEADERS += Src/Handlers/Int13h/
75HEADERS += Src/Handlers/Int13h/EBIOS/
76HEADERS += Src/Handlers/Int13h/Tools/
77HEADERS += Src/Handlers/Int19h/
78HEADERS += Src/Device/
79HEADERS += Src/Device/IDE/
80HEADERS += Src/Device/MemoryMappedIDE/
81HEADERS += Src/Device/Serial/
82HEADERS += Src/Initialization/
83HEADERS += Src/Initialization/AdvancedAta/
84HEADERS += Src/Menus/
85HEADERS += Src/Menus/BootMenu/
86HEADERS += Src/Libraries/
87HEADERS += Src/VariablesAndDPTs/
88
89# Subdirectories where library files are:
90LIBS = ../Assembly_Library/Inc/
91LIBS += ../Assembly_Library/Src/
92LIBS += ../Assembly_Library/Src/Display/
93LIBS += ../Assembly_Library/Src/File/
94LIBS += ../Assembly_Library/Src/Keyboard/
95LIBS += ../Assembly_Library/Src/Menu/
96LIBS += ../Assembly_Library/Src/Menu/Dialog/
97LIBS += ../Assembly_Library/Src/String/
98LIBS += ../Assembly_Library/Src/Time/
99LIBS += ../Assembly_Library/Src/Util/
100LIBS += ../Assembly_Library/Src/Serial/
101LIBS += ../XTIDE_Universal_BIOS/Inc/
102HEADERS += $(LIBS)
103
104
105#################################################################
106# Assembler preprocessor defines. #
107#################################################################
108DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_POWER_MANAGEMENT NO_ATAID_VALIDATION CLD_NEEDED
109DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED MODULE_COMPATIBLE_TABLES
110
111DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
112DEFINES_XTPLUS = $(DEFINES_XT) USE_186
113DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_COMPATIBLE_TABLES
114
115DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
116DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
117DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
118
119DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION CLD_NEEDED
120DEFINES_386 = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA MODULE_WIN9X_CMOS_HACK
121DEFINES_386_LARGE = $(DEFINES_386) $(DEFINES_COMMON_LARGE)
122
123
124###################
125# Other variables #
126###################
127
128# Target size of the BIOS, used in Main.asm for number of 512B blocks (CNT_ROM_BLOCKS) and by checksum Perl script below ('make checksum').
129# Note! The size must be a multiple of 2 KB for compatibility reasons.
130BIOS_SIZE_TINY = 4096
131BIOS_SIZE_SMALL = 8192
132BIOS_SIZE_LARGE = 10240
133
134# Add -D in front of every preprocessor define declaration
135DEFS_XT = $(DEFINES_XT:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
136DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
137DEFS_AT = $(DEFINES_AT:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
138DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
139DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
140DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
141DEFS_XT_TINY = $(DEFINES_XT_TINY:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_TINY)
142DEFS_386 = $(DEFINES_386:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
143DEFS_386_LARGE = $(DEFINES_386_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
144
145# Add -I in front of all header directories
146IHEADERS = $(HEADERS:%=-I%)
147
148# Path + target file to be built
149TARGET = $(BUILD_DIR)/$(PROG)
150
151#########################
152# Compilers and linkers #
153#########################
154
155# Make
156MAKE = mingw32-make.exe
157
158# Assembler
159AS = nasm.exe
160
161# use this command to erase files.
162RM = -del /Q
163
164
165#############################
166# Compiler and linker flags #
167#############################
168
169# Assembly compiler flags
170ASFLAGS = -f bin # Produce binary object files
171ASFLAGS += $(IHEADERS) # Set header file directory paths
172ASFLAGS += -Worphan-labels # Warn about labels without colon
173ASFLAGS += -Ox # Optimize operands to their shortest forms
174
175
176############################################
177# Build process. Actual work is done here. #
178############################################
179
180all: clean small large
181 @echo All done!
182
183small: xt_tiny xt xtplus at 386
184 @echo All small binaries built!
185
186large: xt_large xtplus_large at_large 386_large
187 @echo All large binaries built!
188
189at:
190 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
191 @echo * Small AT version "$(TARGET)_at.bin" built.
192
193at_large:
194 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
195 @echo * Large AT version "$(TARGET)_atl.bin" built.
196
197xtplus:
198 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
199 @echo * Small XT Plus version "$(TARGET)_xtp.bin" built.
200
201xtplus_large:
202 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
203 @echo * Large XT Plus version "$(TARGET)_xtpl.bin" built.
204
205xt:
206 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
207 @echo * Small XT version "$(TARGET)_xt.bin" built.
208
209xt_large:
210 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
211 @echo * Large XT version "$(TARGET)_xtl.bin" built.
212
213xt_tiny:
214 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -l"$(TARGET)_tiny.lst" -o"$(TARGET)_tiny.bin"
215 @echo * Tiny XT version "$(TARGET)_tiny.bin" built.
216
217386:
218 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386) -l"$(TARGET)_386.lst" -o"$(TARGET)_386.bin"
219 @echo * Small 386 version "$(TARGET)_386.bin" built.
220
221386_large:
222 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_LARGE) -l"$(TARGET)_386l.lst" -o"$(TARGET)_386l.bin"
223 @echo * Large 386 version "$(TARGET)_386l.bin" built.
224
225strings: src\Strings.asm
226 @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_AT_LARGE) -DCHECK_FOR_UNUSED_ENTRYPOINTS -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
227 @perl ..\Tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
228 @echo StringsCompressed.asm updated!
229
230clean:
231 @$(RM) $(BUILD_DIR)\*.*
232 @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
233
234checksum: all
235 @perl ..\Tools\checksum.pl $(TARGET)_tiny.bin $(BIOS_SIZE_TINY)
236 @perl ..\Tools\checksum.pl $(TARGET)_xt.bin $(BIOS_SIZE_SMALL)
237 @perl ..\Tools\checksum.pl $(TARGET)_xtp.bin $(BIOS_SIZE_SMALL)
238 @perl ..\Tools\checksum.pl $(TARGET)_at.bin $(BIOS_SIZE_SMALL)
239 @perl ..\Tools\checksum.pl $(TARGET)_xtl.bin $(BIOS_SIZE_LARGE)
240 @perl ..\Tools\checksum.pl $(TARGET)_xtpl.bin $(BIOS_SIZE_LARGE)
241 @perl ..\Tools\checksum.pl $(TARGET)_atl.bin $(BIOS_SIZE_LARGE)
242 @perl ..\Tools\checksum.pl $(TARGET)_386.bin $(BIOS_SIZE_SMALL)
243 @perl ..\Tools\checksum.pl $(TARGET)_386l.bin $(BIOS_SIZE_LARGE)
244
245unused:
246 @echo "XT Tiny"
247 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -o"$(TARGET)_unused_tiny.asm" -l"$(TARGET)_unused_tiny.lst"
248 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -o"$(TARGET)_unused_tiny.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
249 @perl ..\Tools\unused.pl $(TARGET)_unused_tiny.lst $(TARGET)_unused_tiny.asm
250 @echo "XT Small"
251 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -l"$(TARGET)_unused_xt.lst"
252 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
253 @perl ..\Tools\unused.pl $(TARGET)_unused_xt.lst $(TARGET)_unused_xt.asm
254 @echo "XT Large"
255 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -l"$(TARGET)_unused_xtl.lst"
256 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
257 @perl ..\Tools\unused.pl $(TARGET)_unused_xtl.lst $(TARGET)_unused_xtl.asm
258 @echo "XT Plus Small"
259 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -o"$(TARGET)_unused_xtp.asm" -l"$(TARGET)_unused_xtp.lst"
260 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -o"$(TARGET)_unused_xtp.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
261 @perl ..\Tools\unused.pl $(TARGET)_unused_xtp.lst $(TARGET)_unused_xtp.asm
262 @echo "XT Plus Large"
263 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -o"$(TARGET)_unused_xtpl.asm" -l"$(TARGET)_unused_xtpl.lst"
264 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -o"$(TARGET)_unused_xtpl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
265 @perl ..\Tools\unused.pl $(TARGET)_unused_xtpl.lst $(TARGET)_unused_xtpl.asm
266 @echo "AT Small"
267 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -l"$(TARGET)_unused_at.lst"
268 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
269 @perl ..\Tools\unused.pl $(TARGET)_unused_at.lst $(TARGET)_unused_at.asm
270 @echo "AT Large"
271 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -l"$(TARGET)_unused_atl.lst"
272 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
273 @perl ..\Tools\unused.pl $(TARGET)_unused_atl.lst $(TARGET)_unused_atl.asm
274 @echo "386 Small"
275 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386) -o"$(TARGET)_unused_386.asm" -l"$(TARGET)_unused_386.lst"
276 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386) -o"$(TARGET)_unused_386.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
277 @perl ..\Tools\unused.pl $(TARGET)_unused_386.lst $(TARGET)_unused_386.asm
278 @echo "386 Large"
279 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_LARGE) -o"$(TARGET)_unused_386l.asm" -l"$(TARGET)_unused_386l.lst"
280 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_LARGE) -o"$(TARGET)_unused_386l.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
281 @perl ..\Tools\unused.pl $(TARGET)_unused_386l.lst $(TARGET)_unused_386l.asm
282
Note: See TracBrowser for help on using the repository browser.