source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile@ 523

Last change on this file since 523 was 522, checked in by aitotat@…, 12 years ago

Changes to XTIDE Universal BIOS:

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