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