[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/
|
---|
| 44 | HEADERS += Src/Device/Serial/
|
---|
[3] | 45 | HEADERS += Src/Initialization/
|
---|
| 46 | HEADERS += Src/Libraries/
|
---|
| 47 | HEADERS += Src/VariablesAndDPTs/
|
---|
| 48 |
|
---|
[88] | 49 | # Subdirectories where library files are:
|
---|
| 50 | LIBS = ../Assembly_Library/Inc/
|
---|
| 51 | LIBS += ../Assembly_Library/Src/
|
---|
| 52 | LIBS += ../Assembly_Library/Src/Display/
|
---|
| 53 | LIBS += ../Assembly_Library/Src/File/
|
---|
| 54 | LIBS += ../Assembly_Library/Src/Keyboard/
|
---|
| 55 | LIBS += ../Assembly_Library/Src/Menu/
|
---|
| 56 | LIBS += ../Assembly_Library/Src/Menu/Dialog/
|
---|
| 57 | LIBS += ../Assembly_Library/Src/String/
|
---|
| 58 | LIBS += ../Assembly_Library/Src/Time/
|
---|
| 59 | LIBS += ../Assembly_Library/Src/Util/
|
---|
| 60 | LIBS += ../XTIDE_Universal_BIOS/Inc/
|
---|
| 61 | HEADERS += $(LIBS)
|
---|
[3] | 62 |
|
---|
[88] | 63 |
|
---|
[3] | 64 | #################################################################
|
---|
| 65 | # Assembler preprocessor defines. #
|
---|
| 66 | #################################################################
|
---|
[186] | 67 | DEFINES = INCLUDE_MENU_LIBRARY EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS MODULE_EBIOS MODULE_SERIAL MODULE_STRINGS_COMPRESSED
|
---|
[88] | 68 | DEFINES_XT = ELIMINATE_CGA_SNOW
|
---|
| 69 | DEFINES_XTPLUS = ELIMINATE_CGA_SNOW USE_186
|
---|
[3] | 70 | DEFINES_AT = USE_186 USE_286 USE_AT
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 | ###################
|
---|
| 74 | # Other variables #
|
---|
| 75 | ###################
|
---|
| 76 |
|
---|
| 77 | # Add -D in front of every preprocessor define declaration
|
---|
| 78 | DEFS = $(DEFINES:%=-D%)
|
---|
| 79 | DEFS_XT = $(DEFINES_XT:%=-D%)
|
---|
| 80 | DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%)
|
---|
| 81 | DEFS_AT = $(DEFINES_AT:%=-D%)
|
---|
| 82 |
|
---|
| 83 | # Add -I in front of all header directories
|
---|
| 84 | IHEADERS = $(HEADERS:%=-I%)
|
---|
| 85 |
|
---|
[145] | 86 | # Path + target file to be built
|
---|
[3] | 87 | TARGET = $(BUILD_DIR)/$(PROG)
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | #########################
|
---|
| 91 | # Compilers and linkers #
|
---|
| 92 | #########################
|
---|
| 93 |
|
---|
| 94 | # Make
|
---|
| 95 | MAKE = mingw32-make.exe
|
---|
| 96 |
|
---|
| 97 | # Assembler
|
---|
[188] | 98 | AS = nasm.exe
|
---|
[3] | 99 |
|
---|
| 100 | # use this command to erase files.
|
---|
| 101 | RM = -del /Q
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | #############################
|
---|
| 105 | # Compiler and linker flags #
|
---|
| 106 | #############################
|
---|
| 107 |
|
---|
| 108 | # Assembly compiler flags
|
---|
| 109 | ASFLAGS = -f bin # Produce binary object files
|
---|
| 110 | ASFLAGS += $(DEFS) # Preprocessor defines
|
---|
| 111 | ASFLAGS += $(IHEADERS) # Set header file directory paths
|
---|
| 112 | ASFLAGS += -Worphan-labels # Warn about labels without colon
|
---|
| 113 | ASFLAGS += -O9 # Optimize operands to their shortest forms
|
---|
| 114 |
|
---|
| 115 |
|
---|
| 116 | ############################################
|
---|
| 117 | # Build process. Actual work is done here. #
|
---|
| 118 | ############################################
|
---|
| 119 |
|
---|
| 120 | .PHONY: all at xtplus xt clean
|
---|
| 121 |
|
---|
| 122 | # Make clean debug and release versions
|
---|
[61] | 123 | all: clean at xtplus xt
|
---|
[145] | 124 | @echo All done!
|
---|
[3] | 125 |
|
---|
| 126 | at:
|
---|
[80] | 127 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
|
---|
[145] | 128 | @echo AT version "$(TARGET)_at.bin" built.
|
---|
[3] | 129 |
|
---|
| 130 | xtplus:
|
---|
[80] | 131 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
|
---|
[145] | 132 | @echo XT plus version "$(TARGET)_xtp.bin" built.
|
---|
[3] | 133 |
|
---|
| 134 | xt:
|
---|
[80] | 135 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
|
---|
[145] | 136 | @echo XT version "$(TARGET)_xt.bin" built.
|
---|
[3] | 137 |
|
---|
| 138 | clean:
|
---|
| 139 | @$(RM) $(BUILD_DIR)\*.*
|
---|
| 140 | @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
|
---|
[186] | 141 |
|
---|
[197] | 142 | src\StringsCompressed.asm: src\Strings.asm
|
---|
[186] | 143 | $(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
|
---|
[197] | 144 | perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
|
---|
[186] | 145 |
|
---|
[194] | 146 | $(SRC_ASM): src\StringsCompressed.asm
|
---|
| 147 |
|
---|
| 148 | xt_unused: xt
|
---|
| 149 | $(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
| 150 | perl ..\tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
|
---|
| 151 |
|
---|