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