[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/
|
---|
| 40 | HEADERS += Src/Handlers/Int13h/Common/
|
---|
| 41 | HEADERS += Src/Initialization/
|
---|
| 42 | HEADERS += Src/Libraries/
|
---|
| 43 | HEADERS += Src/Libraries/menu/
|
---|
| 44 | HEADERS += Src/VariablesAndDPTs/
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | #################################################################
|
---|
| 48 | # Assembler preprocessor defines. #
|
---|
| 49 | #################################################################
|
---|
| 50 | DEFINES =
|
---|
| 51 | DEFINES_XT =
|
---|
| 52 | DEFINES_XTPLUS = USE_186
|
---|
| 53 | DEFINES_AT = USE_186 USE_286 USE_AT
|
---|
| 54 |
|
---|
| 55 |
|
---|
| 56 | ###################
|
---|
| 57 | # Other variables #
|
---|
| 58 | ###################
|
---|
| 59 |
|
---|
| 60 | # Add -D in front of every preprocessor define declaration
|
---|
| 61 | DEFS = $(DEFINES:%=-D%)
|
---|
| 62 | DEFS_XT = $(DEFINES_XT:%=-D%)
|
---|
| 63 | DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%)
|
---|
| 64 | DEFS_AT = $(DEFINES_AT:%=-D%)
|
---|
| 65 |
|
---|
| 66 | # Add -I in front of all header directories
|
---|
| 67 | IHEADERS = $(HEADERS:%=-I%)
|
---|
| 68 |
|
---|
| 69 | # Path + target file to be build
|
---|
| 70 | TARGET = $(BUILD_DIR)/$(PROG)
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 | #########################
|
---|
| 74 | # Compilers and linkers #
|
---|
| 75 | #########################
|
---|
| 76 |
|
---|
| 77 | # Make
|
---|
| 78 | MAKE = mingw32-make.exe
|
---|
| 79 |
|
---|
| 80 | # Assembler
|
---|
[80] | 81 | AS = nasm.exe
|
---|
[3] | 82 |
|
---|
| 83 | # use this command to erase files.
|
---|
| 84 | RM = -del /Q
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | #############################
|
---|
| 88 | # Compiler and linker flags #
|
---|
| 89 | #############################
|
---|
| 90 |
|
---|
| 91 | # Assembly compiler flags
|
---|
| 92 | ASFLAGS = -f bin # Produce binary object files
|
---|
| 93 | ASFLAGS += $(DEFS) # Preprocessor defines
|
---|
| 94 | ASFLAGS += $(IHEADERS) # Set header file directory paths
|
---|
| 95 | ASFLAGS += -Worphan-labels # Warn about labels without colon
|
---|
| 96 | ASFLAGS += -O9 # Optimize operands to their shortest forms
|
---|
| 97 |
|
---|
| 98 |
|
---|
| 99 | ############################################
|
---|
| 100 | # Build process. Actual work is done here. #
|
---|
| 101 | ############################################
|
---|
| 102 |
|
---|
| 103 | .PHONY: all at xtplus xt clean
|
---|
| 104 |
|
---|
| 105 | # Make clean debug and release versions
|
---|
[61] | 106 | all: clean at xtplus xt
|
---|
[3] | 107 | @echo All build!
|
---|
| 108 |
|
---|
| 109 | at:
|
---|
[80] | 110 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
|
---|
[3] | 111 | @echo AT version "$(TARGET)_at.bin" build.
|
---|
| 112 |
|
---|
| 113 | xtplus:
|
---|
[80] | 114 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
|
---|
[3] | 115 | @echo XT plus version "$(TARGET)_xtp.bin" build.
|
---|
| 116 |
|
---|
| 117 | xt:
|
---|
[80] | 118 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
|
---|
[3] | 119 | @echo XT version "$(TARGET)_xt.bin" build.
|
---|
| 120 |
|
---|
| 121 | clean:
|
---|
| 122 | @$(RM) $(BUILD_DIR)\*.*
|
---|
| 123 | @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
|
---|