source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile@ 399

Last change on this file since 399 was 399, checked in by krille_n_@…, 13 years ago

Changes:

  • Added Power Management (Standby Timer) support to the BIOS and made it part of an optional module (MODULE_FEATURE_SETS). The total amount of ROM space used by this feature is 37 bytes. UNTESTED
  • Size optimizations (mostly inlining of procedures) and fixed a few bugs in AH9h_HInit.asm:
    1. DPT_ATA.bInitError would be cleared only if MODULE_SERIAL was not defined.
    2. The FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE flag could never be set.
    3. InitializeBlockMode could potentially loop forever if there was an error.
  • Removed some odd looking code in .PushResetStatus in BootMenuPrintCfg.asm
  • Made some changes to XTIDECFG so it can be built.
File size: 10.0 KB
RevLine 
[379]1##################################################################################################
2# Makefile to build XTIDE Universal BIOS. #
3# #
4# Valid makefile targets are: #
[389]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 #
[379]11# #
12# * at the end of target name means that Perl is required for the job. #
13# Build directory must be created manually if it does not exist. #
14# #
15# #
16# Following modules can be included or excluded: #
17# MODULE_ADVANCED_ATA Native support for some VLB IDE controllers #
[380]18# MODULE_BOOT_MENU Boot Menu for selection of drive to boot from #
19# MODULE_EBIOS Enhanced functions for accessing drives over 8.4 GB #
[395]20# MODULE_HOTKEYS Hotkey Bar to boot from any drive #
[398]21# MODULE_IRQ IDE IRQ support #
[379]22# MODULE_JRIDE Support for JR-IDE/ISA #
23# MODULE_SERIAL Virtual hard disks using serial port #
[380]24# MODULE_SERIAL_FLOPPY Virtual floppy drives using serial port (requires MODULE_SERIAL) #
25# MODULE_STRINGS_COMPRESSED Use compressed strings to save space #
[399]26# MODULE_FEATURE_SETS Power Management support #
[379]27# #
28# Not modules but these affect the assembly: #
[380]29# ELIMINATE_CGA_SNOW Prevents CGA snowing at the cost of a few bytes #
[379]30# USE_186 Use instructions supported by 80188/80186 and V20/V30 and later #
31# USE_286 Use instructions supported by 286 and later #
32# USE_386 Use instructions supported by 386 and later #
33# USE_AT Use features supported on AT and later systems (not available on XT) #
34# #
35##################################################################################################
[3]36
37###########################################
38# Source files and destination executable #
39###########################################
40
41# Assembly source code file (*.asm):
42SRC_ASM = Src/Main.asm
43
44# Program executable file name without extension:
45PROG = ide
46
47
48#######################################
49# Destination and include directories #
50#######################################
51
52# Directory where binary file will be compiled to
53BUILD_DIR = Build
54
55# Subdirectories where included files are:
56HEADERS = Inc/
[363]57HEADERS += Inc/Controllers/
[3]58HEADERS += Src/
59HEADERS += Src/Handlers/
60HEADERS += Src/Handlers/Int13h/
[165]61HEADERS += Src/Handlers/Int13h/EBIOS/
62HEADERS += Src/Handlers/Int13h/Tools/
[392]63HEADERS += Src/Handlers/Int19h/
[150]64HEADERS += Src/Device/
65HEADERS += Src/Device/IDE/
[238]66HEADERS += Src/Device/MemoryMappedIDE/
[150]67HEADERS += Src/Device/Serial/
[3]68HEADERS += Src/Initialization/
[392]69HEADERS += Src/Initialization/AdvancedAta/
70HEADERS += Src/Menus/
71HEADERS += Src/Menus/BootMenu/
[3]72HEADERS += Src/Libraries/
73HEADERS += Src/VariablesAndDPTs/
74
[88]75# Subdirectories where library files are:
76LIBS = ../Assembly_Library/Inc/
77LIBS += ../Assembly_Library/Src/
78LIBS += ../Assembly_Library/Src/Display/
79LIBS += ../Assembly_Library/Src/File/
80LIBS += ../Assembly_Library/Src/Keyboard/
81LIBS += ../Assembly_Library/Src/Menu/
82LIBS += ../Assembly_Library/Src/Menu/Dialog/
83LIBS += ../Assembly_Library/Src/String/
84LIBS += ../Assembly_Library/Src/Time/
85LIBS += ../Assembly_Library/Src/Util/
[277]86LIBS += ../Assembly_Library/Src/Serial/
[88]87LIBS += ../XTIDE_Universal_BIOS/Inc/
88HEADERS += $(LIBS)
[3]89
[88]90
[3]91#################################################################
92# Assembler preprocessor defines. #
93#################################################################
[399]94DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_EBIOS MODULE_FEATURE_SETS
[397]95DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
[389]96
[397]97DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
98DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186
[398]99DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_ADVANCED_ATA
[389]100
[397]101DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
102DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
103DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
[389]104
[397]105DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED
106DEFINES_386_8K = $(DEFINES_AT) USE_386
[3]107
108
109###################
110# Other variables #
111###################
112
[239]113# Target size of the ROM, used in main.asm for number of 512B blocks and by checksum Perl script below
114ROMSIZE = 8192
115ROMSIZE_LARGE = 15360
116
[3]117# Add -D in front of every preprocessor define declaration
[239]118DEFS_XT = $(DEFINES_XT:%=-D%) -DROMSIZE=$(ROMSIZE)
119DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) -DROMSIZE=$(ROMSIZE)
120DEFS_AT = $(DEFINES_AT:%=-D%) -DROMSIZE=$(ROMSIZE)
121DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
122DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
123DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
[397]124DEFS_XT_TINY = $(DEFINES_XT_TINY:%=-D%) -DROMSIZE=$(ROMSIZE)
[366]125DEFS_386_8K = $(DEFINES_386_8K:%=-D%) -DROMSIZE=$(ROMSIZE)
[3]126
127# Add -I in front of all header directories
128IHEADERS = $(HEADERS:%=-I%)
129
[145]130# Path + target file to be built
[3]131TARGET = $(BUILD_DIR)/$(PROG)
132
133#########################
134# Compilers and linkers #
135#########################
136
137# Make
138MAKE = mingw32-make.exe
139
140# Assembler
[188]141AS = nasm.exe
[3]142
143# use this command to erase files.
144RM = -del /Q
145
146
147#############################
148# Compiler and linker flags #
149#############################
150
151# Assembly compiler flags
152ASFLAGS = -f bin # Produce binary object files
153ASFLAGS += $(IHEADERS) # Set header file directory paths
154ASFLAGS += -Worphan-labels # Warn about labels without colon
[379]155ASFLAGS += -Ox # Optimize operands to their shortest forms
[3]156
157
158############################################
159# Build process. Actual work is done here. #
160############################################
161
[272]162all: clean small large
[145]163 @echo All done!
[3]164
[397]165small: xt_tiny xt xtplus at 386_8k
[294]166 @echo All 8 kiB binaries built!
[272]167
[397]168large: xt_large xtplus_large at_large
[294]169 @echo All 15 kiB binaries built!
[272]170
[3]171at:
[80]172 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
[272]173 @echo * 8k AT version "$(TARGET)_at.bin" built.
[3]174
[238]175at_large:
176 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
[272]177 @echo *15k AT version "$(TARGET)_atl.bin" built.
[238]178
[3]179xtplus:
[80]180 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
[294]181 @echo * 8k XT Plus version "$(TARGET)_xtp.bin" built.
[3]182
[238]183xtplus_large:
184 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
[294]185 @echo *15k XT Plus version "$(TARGET)_xtpl.bin" built.
[238]186
[3]187xt:
[80]188 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
[272]189 @echo * 8k XT version "$(TARGET)_xt.bin" built.
[3]190
[238]191xt_large:
192 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
[272]193 @echo *15k XT version "$(TARGET)_xtl.bin" built.
[277]194
[397]195xt_tiny:
196 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -l"$(TARGET)_tiny.lst" -o"$(TARGET)_tiny.bin"
197 @echo * Tiny XT version "$(TARGET)_tiny.bin" built.
[238]198
[366]199386_8k:
200 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_8K) -l"$(TARGET)_386.lst" -o"$(TARGET)_386.bin"
201 @echo * 8k 386 version "$(TARGET)_386.bin" built.
202
[322]203strings: src\Strings.asm
204 @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DCHECK_FOR_UNUSED_ENTRYPOINTS -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
205 @perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
206 @echo StringsCompressed.asm updated!
[252]207
[3]208clean:
209 @$(RM) $(BUILD_DIR)\*.*
210 @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
[186]211
[294]212checksum: all
[397]213 @perl ..\tools\checksum.pl $(TARGET)_tiny.bin $(ROMSIZE)
214 @perl ..\tools\checksum.pl $(TARGET)_xt.bin $(ROMSIZE)
215 @perl ..\tools\checksum.pl $(TARGET)_xtp.bin $(ROMSIZE)
216 @perl ..\tools\checksum.pl $(TARGET)_at.bin $(ROMSIZE)
217 @perl ..\tools\checksum.pl $(TARGET)_xtl.bin $(ROMSIZE_LARGE)
218 @perl ..\tools\checksum.pl $(TARGET)_xtpl.bin $(ROMSIZE_LARGE)
[240]219 @perl ..\tools\checksum.pl $(TARGET)_atl.bin $(ROMSIZE_LARGE)
[369]220 @perl ..\tools\checksum.pl $(TARGET)_386.bin $(ROMSIZE)
[203]221
[252]222xt_unused: xt
[370]223 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
224 @perl ..\tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
[194]225
Note: See TracBrowser for help on using the repository browser.