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