source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile@ 591

Last change on this file since 591 was 589, checked in by Krister Nordvall, 9 years ago

Changes:

  • BIOS: Fixed a purely cosmetic bug from r542 where, in builds containing MODULE_EBIOS, the boot menu would display an incorrect drive size (0.4 kB with MODULE_STRINGS_COMPRESSED or 0.5 kB without) for old drives with no support for LBA.
  • Fixed a bug from r392 where Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent would return the ID in AL instead of AH (if DANGEROUS_DETECTION had been defined).
  • Fixed a bug from r587 in AdvAtaInit.asm that would prevent detection of QDI Vision controllers.
  • Also changed how the QDI Vision IDs are defined (removed the need for shifting) to avoid confusion. This fixed a potential bug from r587 in AdvAtaInit.asm where some IDs were not being shifted.
  • Fixed a bug in PDC20x30.asm from r587 where GetPdcIDtoAX would not return with the IDE base port in DX so DisablePdcProgrammingMode would fail.
  • Made some changes to ModuleDependency.inc and other files so that MODULE_ADVANCED_ATA now requires USE_386. Consequently it is no longer included in the regular AT-builds, only in the 386_8k-build.
  • Moved the UNROLL_SECTORS_IN_CX_TO_xWORDS macros from IDE_8bit.inc to IdeIO.inc which means it's now possible to build a BIOS without MODULE_8BIT_IDE.
  • XTIDECFG: Added a minimum DOS version check (since it needs DOS version 2+) to allow the program to quit gracefully in the unlikely scenario where someone tries to run it under DOS version 1.
  • Made some changes to Drive.asm to improve drive enumeration. The old method using GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE worked well in Windows XP but not in Windows 98 SE (in Windows or in DOS mode). The two problems were; 1) The function call would access the drives which on single floppy drive systems would cause Windows to swap between A: and B: (throwing a blue screen asking the user to insert a disk etc). 2) Only floppy drives and FAT16 drives would be available in the list of drives, no FAT32/optical/network drives.
  • Improved code in IdeControllerMenu.asm so that the default port addresses for all IDE interfaces are now restored when (re-)selecting the (same) type of IDE device.
  • Also made it impossible to select a device type unless the required module is included in the loaded BIOS.
  • The version check done when loading a BIOS now uses the FLASH_SIGNATURE definition from Version.inc. Any changes affecting RomVars now only requires updating that definition. This means that changes to RomVars must be implemented in both the BIOS and XTIDECFG before being committed to the repository.
  • Added a compatibility fix for 3Com 3C503 cards to the ROM checksumming code in Buffers.asm (Buffers_GenerateChecksum).
  • SerDrive: Made some minor changes to file names and paths to improve compatibility with case sensitive environments.
  • BIOSDRVS: Made a minor size optimization which as a side effect also makes it compatible with all DOS versions including DOS version 1.
  • Library: Renamed the WAIT_RETRACE_IF_NECESSARY_THEN macro to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN and made a tail-call-optimized version of it (JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN).
  • A speed optimization to the eRCL_IM macro for 386 and higher. This change breaks emulation in the sense that the macro will fail when given a memory operand as the first parameter.
  • Other minor optimizations and fixes.
File size: 13.4 KB
RevLine 
[445]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) #
[511]7# large Builds 12 kiB binaries only (without checksum) #
[445]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 #
[511]11# unused* Checks if there are any unused functions that can be removed to save space #
[445]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 #
[505]19# MODULE_8BIT_IDE_ADVANCED Support for memory mapped and DMA based cards like JRIDE and XTCF #
[589]20# MODULE_ADVANCED_ATA Native support for some VLB IDE controllers (requires USE_386) #
[550]21# MODULE_COMPATIBLE_TABLES Support for ill behaving software that tries to access DPT directly #
[445]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 #
[567]29# MODULE_VERY_LATE_INIT Initialize on INT 13h if our INT 19h handler is not called #
30# MODULE_POWER_MANAGEMENT Power Management support #
[445]31# #
32# Not modules but these affect the assembly: #
33# ELIMINATE_CGA_SNOW Prevents CGA snowing at the cost of a few bytes #
[522]34# RELOCATE_INT13H_STACK ** Relocates INT 13h stack to beginning of stolen conventional memory #
[445]35# RESERVE_DIAGNOSTIC_CYLINDER Reserve one L-CHS cylinder for compatibility with old BIOSes #
[543]36# DANGEROUS_DETECTION Scans Advanced Controllers from dangerous ports like mirrored PIC #
[580]37# NO_ATAID_VALIDATION *** Excludes code that tries to ensure proper communication with drives #
[445]38# USE_186 Use instructions supported by 80188/80186 and V20/V30 and later #
[511]39# USE_286 Use instructions supported by 286 and later (defines USE_UNDOC_INTEL)#
40# USE_386 Use instructions supported by 386 and later (defines USE_286) #
[445]41# USE_AT Use features supported on AT and later systems (not available on XT) #
[491]42# USE_UNDOC_INTEL Optimizations for Intel CPU:s - do NOT use on NEC V20/V30/Sony CPU:s #
[445]43# #
[522]44# ** AT Builds only (when USE_AT is defined) #
[580]45# *** Use this only when certain known good drives are not being detected (eg WD Caviars) #
[445]46####################################################################################################
[3]47
48###########################################
49# Source files and destination executable #
50###########################################
51
52# Assembly source code file (*.asm):
53SRC_ASM = Src/Main.asm
54
55# Program executable file name without extension:
56PROG = ide
57
58
59#######################################
60# Destination and include directories #
61#######################################
62
63# Directory where binary file will be compiled to
64BUILD_DIR = Build
65
66# Subdirectories where included files are:
67HEADERS = Inc/
[363]68HEADERS += Inc/Controllers/
[3]69HEADERS += Src/
70HEADERS += Src/Handlers/
71HEADERS += Src/Handlers/Int13h/
[165]72HEADERS += Src/Handlers/Int13h/EBIOS/
73HEADERS += Src/Handlers/Int13h/Tools/
[392]74HEADERS += Src/Handlers/Int19h/
[150]75HEADERS += Src/Device/
76HEADERS += Src/Device/IDE/
[238]77HEADERS += Src/Device/MemoryMappedIDE/
[150]78HEADERS += Src/Device/Serial/
[3]79HEADERS += Src/Initialization/
[392]80HEADERS += Src/Initialization/AdvancedAta/
81HEADERS += Src/Menus/
82HEADERS += Src/Menus/BootMenu/
[3]83HEADERS += Src/Libraries/
84HEADERS += Src/VariablesAndDPTs/
85
[88]86# Subdirectories where library files are:
87LIBS = ../Assembly_Library/Inc/
88LIBS += ../Assembly_Library/Src/
89LIBS += ../Assembly_Library/Src/Display/
90LIBS += ../Assembly_Library/Src/File/
91LIBS += ../Assembly_Library/Src/Keyboard/
92LIBS += ../Assembly_Library/Src/Menu/
93LIBS += ../Assembly_Library/Src/Menu/Dialog/
94LIBS += ../Assembly_Library/Src/String/
95LIBS += ../Assembly_Library/Src/Time/
96LIBS += ../Assembly_Library/Src/Util/
[277]97LIBS += ../Assembly_Library/Src/Serial/
[88]98LIBS += ../XTIDE_Universal_BIOS/Inc/
99HEADERS += $(LIBS)
[3]100
[88]101
[3]102#################################################################
103# Assembler preprocessor defines. #
104#################################################################
[580]105DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_8BIT_IDE MODULE_EBIOS MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_POWER_MANAGEMENT RESERVE_DIAGNOSTIC_CYLINDER NO_ATAID_VALIDATION
[550]106DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED MODULE_COMPATIBLE_TABLES
[389]107
[567]108DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
[580]109DEFINES_XTPLUS = $(DEFINES_XT) USE_186
[589]110DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_COMPATIBLE_TABLES
[389]111
[397]112DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
113DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
[482]114DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
[389]115
[580]116DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION
[589]117DEFINES_386_8K = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA
[3]118
[567]119DEFINES_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_POWER_MANAGEMENT MODULE_COMPATIBLE_TABLES
[530]120DEFINES_ALL_FEATURES += ELIMINATE_CGA_SNOW RELOCATE_INT13H_STACK RESERVE_DIAGNOSTIC_CYLINDER
[3]121
[489]122
[3]123###################
124# Other variables #
125###################
126
[239]127# Target size of the ROM, used in main.asm for number of 512B blocks and by checksum Perl script below
[506]128BIOS_SIZE = 8192 # For BIOS header (use even multiplier!)
129ROMSIZE = $(BIOS_SIZE) # Size of binary to build when building with make checksum
[511]130BIOS_SIZE_LARGE = 12288
[506]131ROMSIZE_LARGE = $(BIOS_SIZE_LARGE)
[239]132
[3]133# Add -D in front of every preprocessor define declaration
[506]134DEFS_XT = $(DEFINES_XT:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE)
135DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE)
136DEFS_AT = $(DEFINES_AT:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE)
137DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
138DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
139DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
140DEFS_XT_TINY = $(DEFINES_XT_TINY:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE)
141DEFS_386_8K = $(DEFINES_386_8K:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE)
[489]142DEFS_ALL_FEATURES = $(DEFINES_ALL_FEATURES:%=-D%)
[3]143
144# Add -I in front of all header directories
145IHEADERS = $(HEADERS:%=-I%)
146
[145]147# Path + target file to be built
[3]148TARGET = $(BUILD_DIR)/$(PROG)
149
150#########################
151# Compilers and linkers #
152#########################
153
154# Make
155MAKE = mingw32-make.exe
156
157# Assembler
[188]158AS = nasm.exe
[3]159
160# use this command to erase files.
161RM = -del /Q
162
163
164#############################
165# Compiler and linker flags #
166#############################
167
168# Assembly compiler flags
169ASFLAGS = -f bin # Produce binary object files
170ASFLAGS += $(IHEADERS) # Set header file directory paths
171ASFLAGS += -Worphan-labels # Warn about labels without colon
[379]172ASFLAGS += -Ox # Optimize operands to their shortest forms
[3]173
174
175############################################
176# Build process. Actual work is done here. #
177############################################
178
[272]179all: clean small large
[145]180 @echo All done!
[3]181
[397]182small: xt_tiny xt xtplus at 386_8k
[506]183 @echo All small binaries built!
[272]184
[397]185large: xt_large xtplus_large at_large
[506]186 @echo All large binaries built!
[272]187
[3]188at:
[80]189 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
[506]190 @echo * Small AT version "$(TARGET)_at.bin" built.
[3]191
[238]192at_large:
193 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
[558]194 @echo * Large AT version "$(TARGET)_atl.bin" built.
[238]195
[3]196xtplus:
[80]197 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
[506]198 @echo * Small XT Plus version "$(TARGET)_xtp.bin" built.
[3]199
[238]200xtplus_large:
201 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
[558]202 @echo * Large XT Plus version "$(TARGET)_xtpl.bin" built.
[238]203
[3]204xt:
[80]205 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
[506]206 @echo * Small XT version "$(TARGET)_xt.bin" built.
[3]207
[238]208xt_large:
209 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
[558]210 @echo * Large XT version "$(TARGET)_xtl.bin" built.
[277]211
[397]212xt_tiny:
213 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -l"$(TARGET)_tiny.lst" -o"$(TARGET)_tiny.bin"
214 @echo * Tiny XT version "$(TARGET)_tiny.bin" built.
[238]215
[366]216386_8k:
217 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_8K) -l"$(TARGET)_386.lst" -o"$(TARGET)_386.bin"
[506]218 @echo * Small 386 version "$(TARGET)_386.bin" built.
[366]219
[322]220strings: src\Strings.asm
[415]221 @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_AT_LARGE) -DCHECK_FOR_UNUSED_ENTRYPOINTS -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
[322]222 @perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
223 @echo StringsCompressed.asm updated!
[252]224
[3]225clean:
226 @$(RM) $(BUILD_DIR)\*.*
227 @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
[186]228
[294]229checksum: all
[397]230 @perl ..\tools\checksum.pl $(TARGET)_tiny.bin $(ROMSIZE)
231 @perl ..\tools\checksum.pl $(TARGET)_xt.bin $(ROMSIZE)
232 @perl ..\tools\checksum.pl $(TARGET)_xtp.bin $(ROMSIZE)
233 @perl ..\tools\checksum.pl $(TARGET)_at.bin $(ROMSIZE)
234 @perl ..\tools\checksum.pl $(TARGET)_xtl.bin $(ROMSIZE_LARGE)
235 @perl ..\tools\checksum.pl $(TARGET)_xtpl.bin $(ROMSIZE_LARGE)
[240]236 @perl ..\tools\checksum.pl $(TARGET)_atl.bin $(ROMSIZE_LARGE)
[369]237 @perl ..\tools\checksum.pl $(TARGET)_386.bin $(ROMSIZE)
[203]238
[491]239unused:
[489]240 @echo "All Features"
241 @$(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"
242 @$(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
243 @perl ..\tools\unused.pl $(TARGET)_unused.lst $(TARGET)_unused.asm
244 @echo "XT Small"
245 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -l"$(TARGET)_unused_xt.lst"
246 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
247 @perl ..\tools\unused.pl $(TARGET)_unused_xt.lst $(TARGET)_unused_xt.asm
248 @echo "XT Large"
249 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -l"$(TARGET)_unused_xtl.lst"
250 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
251 @perl ..\tools\unused.pl $(TARGET)_unused_xtl.lst $(TARGET)_unused_xtl.asm
252 @echo "AT Small"
253 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -l"$(TARGET)_unused_at.lst"
254 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
255 @perl ..\tools\unused.pl $(TARGET)_unused_at.lst $(TARGET)_unused_at.asm
256 @echo "AT Large"
257 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -l"$(TARGET)_unused_atl.lst"
258 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
259 @perl ..\tools\unused.pl $(TARGET)_unused_atl.lst $(TARGET)_unused_atl.asm
[194]260
[489]261
Note: See TracBrowser for help on using the repository browser.