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