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