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