source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile@ 593

Last change on this file since 593 was 593, checked in by Tomi Tilli, 6 years ago

Flashing now works again.
Hack to get Windows 95 to work properly (MODULE_WIN95_CMOS_HACK included for 386 builds by default).
Edited makefile to produce large 386 build.
Fixed recovery time for QDI Vision VLB-IDE controllers.
No more warnings with Nasm 2.13.xx and later.
File dialog now properly restores default drive when file selection is cancelled.

File size: 14.1 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 #
[593]31# MODULE_WIN95_CMOS_HACK Hack for Windows 95 compatibility #
[445]32# #
33# Not modules but these affect the assembly: #
34# ELIMINATE_CGA_SNOW Prevents CGA snowing at the cost of a few bytes #
[522]35# RELOCATE_INT13H_STACK ** Relocates INT 13h stack to beginning of stolen conventional memory #
[445]36# RESERVE_DIAGNOSTIC_CYLINDER Reserve one L-CHS cylinder for compatibility with old BIOSes #
[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 #
[593]43# USE_NEC_V Optimizations for use with NEC V20/V30 processors only #
[592]44# CLD_NEEDED Only needed for compatibility with buggy software/BIOSes #
[445]45# #
[522]46# ** AT Builds only (when USE_AT is defined) #
[580]47# *** Use this only when certain known good drives are not being detected (eg WD Caviars) #
[445]48####################################################################################################
[3]49
50###########################################
51# Source files and destination executable #
52###########################################
53
54# Assembly source code file (*.asm):
55SRC_ASM = Src/Main.asm
56
57# Program executable file name without extension:
58PROG = ide
59
60
61#######################################
62# Destination and include directories #
63#######################################
64
65# Directory where binary file will be compiled to
66BUILD_DIR = Build
67
68# Subdirectories where included files are:
69HEADERS = Inc/
[363]70HEADERS += Inc/Controllers/
[3]71HEADERS += Src/
72HEADERS += Src/Handlers/
73HEADERS += Src/Handlers/Int13h/
[165]74HEADERS += Src/Handlers/Int13h/EBIOS/
75HEADERS += Src/Handlers/Int13h/Tools/
[392]76HEADERS += Src/Handlers/Int19h/
[150]77HEADERS += Src/Device/
78HEADERS += Src/Device/IDE/
[238]79HEADERS += Src/Device/MemoryMappedIDE/
[150]80HEADERS += Src/Device/Serial/
[3]81HEADERS += Src/Initialization/
[392]82HEADERS += Src/Initialization/AdvancedAta/
83HEADERS += Src/Menus/
84HEADERS += Src/Menus/BootMenu/
[3]85HEADERS += Src/Libraries/
86HEADERS += Src/VariablesAndDPTs/
87
[88]88# Subdirectories where library files are:
89LIBS = ../Assembly_Library/Inc/
90LIBS += ../Assembly_Library/Src/
91LIBS += ../Assembly_Library/Src/Display/
92LIBS += ../Assembly_Library/Src/File/
93LIBS += ../Assembly_Library/Src/Keyboard/
94LIBS += ../Assembly_Library/Src/Menu/
95LIBS += ../Assembly_Library/Src/Menu/Dialog/
96LIBS += ../Assembly_Library/Src/String/
97LIBS += ../Assembly_Library/Src/Time/
98LIBS += ../Assembly_Library/Src/Util/
[277]99LIBS += ../Assembly_Library/Src/Serial/
[88]100LIBS += ../XTIDE_Universal_BIOS/Inc/
101HEADERS += $(LIBS)
[3]102
[88]103
[3]104#################################################################
105# Assembler preprocessor defines. #
106#################################################################
[592]107DEFINES_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 CLD_NEEDED
[550]108DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED MODULE_COMPATIBLE_TABLES
[389]109
[567]110DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
[580]111DEFINES_XTPLUS = $(DEFINES_XT) USE_186
[589]112DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_COMPATIBLE_TABLES
[389]113
[397]114DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
115DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
[482]116DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
[389]117
[592]118DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE NO_ATAID_VALIDATION CLD_NEEDED
[593]119DEFINES_386 = $(DEFINES_AT) USE_386 MODULE_ADVANCED_ATA MODULE_WIN95_CMOS_HACK
120DEFINES_386_LARGE = $(DEFINES_AT_LARGE) USE_386 MODULE_ADVANCED_ATA MODULE_WIN95_CMOS_HACK
[3]121
[567]122DEFINES_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
[593]123DEFINES_ALL_FEATURES += ELIMINATE_CGA_SNOW RELOCATE_INT13H_STACK RESERVE_DIAGNOSTIC_CYLINDER MODULE_WIN95_CMOS_HACK
[3]124
[489]125
[3]126###################
127# Other variables #
128###################
129
[592]130# 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').
131# Note! The size must be a multiple of 2 KB for compatibility reasons.
132BIOS_SIZE_TINY = 4096
133BIOS_SIZE_SMALL = 8192
134BIOS_SIZE_LARGE = 10240
[239]135
[3]136# Add -D in front of every preprocessor define declaration
[592]137DEFS_XT = $(DEFINES_XT:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
138DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
139DEFS_AT = $(DEFINES_AT:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
[506]140DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
141DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
142DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
[592]143DEFS_XT_TINY = $(DEFINES_XT_TINY:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_TINY)
[593]144DEFS_386 = $(DEFINES_386:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_SMALL)
145DEFS_386_LARGE = $(DEFINES_386_LARGE:%=-D%) -DBIOS_SIZE=$(BIOS_SIZE_LARGE)
[489]146DEFS_ALL_FEATURES = $(DEFINES_ALL_FEATURES:%=-D%)
[3]147
148# Add -I in front of all header directories
149IHEADERS = $(HEADERS:%=-I%)
150
[145]151# Path + target file to be built
[3]152TARGET = $(BUILD_DIR)/$(PROG)
153
154#########################
155# Compilers and linkers #
156#########################
157
158# Make
159MAKE = mingw32-make.exe
160
161# Assembler
[188]162AS = nasm.exe
[3]163
164# use this command to erase files.
165RM = -del /Q
166
167
168#############################
169# Compiler and linker flags #
170#############################
171
172# Assembly compiler flags
173ASFLAGS = -f bin # Produce binary object files
174ASFLAGS += $(IHEADERS) # Set header file directory paths
175ASFLAGS += -Worphan-labels # Warn about labels without colon
[379]176ASFLAGS += -Ox # Optimize operands to their shortest forms
[3]177
178
179############################################
180# Build process. Actual work is done here. #
181############################################
182
[272]183all: clean small large
[145]184 @echo All done!
[3]185
[593]186small: xt_tiny xt xtplus at 386
[506]187 @echo All small binaries built!
[272]188
[593]189large: xt_large xtplus_large at_large 386_large
[506]190 @echo All large binaries built!
[272]191
[3]192at:
[80]193 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
[506]194 @echo * Small AT version "$(TARGET)_at.bin" built.
[3]195
[238]196at_large:
197 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
[558]198 @echo * Large AT version "$(TARGET)_atl.bin" built.
[238]199
[3]200xtplus:
[80]201 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
[506]202 @echo * Small XT Plus version "$(TARGET)_xtp.bin" built.
[3]203
[238]204xtplus_large:
205 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
[558]206 @echo * Large XT Plus version "$(TARGET)_xtpl.bin" built.
[238]207
[3]208xt:
[80]209 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
[506]210 @echo * Small XT version "$(TARGET)_xt.bin" built.
[3]211
[238]212xt_large:
213 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
[558]214 @echo * Large XT version "$(TARGET)_xtl.bin" built.
[277]215
[397]216xt_tiny:
217 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -l"$(TARGET)_tiny.lst" -o"$(TARGET)_tiny.bin"
218 @echo * Tiny XT version "$(TARGET)_tiny.bin" built.
[238]219
[593]220386:
221 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386) -l"$(TARGET)_386.lst" -o"$(TARGET)_386.bin"
[506]222 @echo * Small 386 version "$(TARGET)_386.bin" built.
[366]223
[593]224386_large:
225 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_LARGE) -l"$(TARGET)_386l.lst" -o"$(TARGET)_386l.bin"
226 @echo * Large 386 version "$(TARGET)_386l.bin" built.
227
[322]228strings: src\Strings.asm
[415]229 @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_AT_LARGE) -DCHECK_FOR_UNUSED_ENTRYPOINTS -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
[592]230 @perl ..\Tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
[322]231 @echo StringsCompressed.asm updated!
[252]232
[3]233clean:
234 @$(RM) $(BUILD_DIR)\*.*
235 @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
[186]236
[294]237checksum: all
[592]238 @perl ..\Tools\checksum.pl $(TARGET)_tiny.bin $(BIOS_SIZE_TINY)
239 @perl ..\Tools\checksum.pl $(TARGET)_xt.bin $(BIOS_SIZE_SMALL)
240 @perl ..\Tools\checksum.pl $(TARGET)_xtp.bin $(BIOS_SIZE_SMALL)
241 @perl ..\Tools\checksum.pl $(TARGET)_at.bin $(BIOS_SIZE_SMALL)
242 @perl ..\Tools\checksum.pl $(TARGET)_xtl.bin $(BIOS_SIZE_LARGE)
243 @perl ..\Tools\checksum.pl $(TARGET)_xtpl.bin $(BIOS_SIZE_LARGE)
244 @perl ..\Tools\checksum.pl $(TARGET)_atl.bin $(BIOS_SIZE_LARGE)
245 @perl ..\Tools\checksum.pl $(TARGET)_386.bin $(BIOS_SIZE_SMALL)
[593]246 @perl ..\Tools\checksum.pl $(TARGET)_386l.bin $(BIOS_SIZE_LARGE)
[203]247
[491]248unused:
[489]249 @echo "All Features"
250 @$(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"
251 @$(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
[592]252 @perl ..\Tools\unused.pl $(TARGET)_unused.lst $(TARGET)_unused.asm
[489]253 @echo "XT Small"
254 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -l"$(TARGET)_unused_xt.lst"
255 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
[592]256 @perl ..\Tools\unused.pl $(TARGET)_unused_xt.lst $(TARGET)_unused_xt.asm
[489]257 @echo "XT Large"
258 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -l"$(TARGET)_unused_xtl.lst"
259 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
[592]260 @perl ..\Tools\unused.pl $(TARGET)_unused_xtl.lst $(TARGET)_unused_xtl.asm
[489]261 @echo "AT Small"
262 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -l"$(TARGET)_unused_at.lst"
263 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
[592]264 @perl ..\Tools\unused.pl $(TARGET)_unused_at.lst $(TARGET)_unused_at.asm
[489]265 @echo "AT Large"
266 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -l"$(TARGET)_unused_atl.lst"
267 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
[592]268 @perl ..\Tools\unused.pl $(TARGET)_unused_atl.lst $(TARGET)_unused_atl.asm
[194]269
[489]270
Note: See TracBrowser for help on using the repository browser.