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