source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile @ 506

Last change on this file since 506 was 506, checked in by aitotat@…, 11 years ago

Changes to XTIDE Universal BIOS:

Preparing for v2.0.0 beta 3 release:

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