[41] | 1 | ###############################################################################
|
---|
| 2 | # Generic makefile for building BIOS binary file. #
|
---|
| 3 | # v. 1.0.0 (28.7.2007 ... 27.6.2010) #
|
---|
| 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):
|
---|
[256] | 21 | #SRC_ASM = Src/LibraryTests.asm
|
---|
[527] | 22 | #SRC_ASM = Src/TimerTest.asm
|
---|
| 23 | SRC_ASM = Src/LibSizeCheck.asm
|
---|
[41] | 24 |
|
---|
| 25 | # Program executable file name without extension:
|
---|
| 26 | PROG = test
|
---|
| 27 | EXTENSION = com
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | #######################################
|
---|
| 31 | # Destination and include directories #
|
---|
| 32 | #######################################
|
---|
| 33 |
|
---|
| 34 | # Directory where binary file will be compiled to
|
---|
| 35 | BUILD_DIR = Build
|
---|
| 36 |
|
---|
| 37 | # Subdirectories where included files are:
|
---|
| 38 | HEADERS = Inc/
|
---|
| 39 | HEADERS += Src/
|
---|
| 40 | HEADERS += Src/Display/
|
---|
| 41 | HEADERS += Src/File/
|
---|
| 42 | HEADERS += Src/Keyboard/
|
---|
| 43 | HEADERS += Src/Menu/
|
---|
| 44 | HEADERS += Src/Menu/Dialog/
|
---|
| 45 | HEADERS += Src/String/
|
---|
| 46 | HEADERS += Src/Time/
|
---|
| 47 | HEADERS += Src/Util/
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | #################################################################
|
---|
| 51 | # Assembler preprocessor defines. #
|
---|
| 52 | #################################################################
|
---|
[145] | 53 | DEFINES =
|
---|
[47] | 54 | DEFINES_XT = ELIMINATE_CGA_SNOW
|
---|
| 55 | DEFINES_XTPLUS = USE_186 ELIMINATE_CGA_SNOW
|
---|
[41] | 56 | DEFINES_AT = USE_186 USE_286 USE_AT
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | ###################
|
---|
| 60 | # Other variables #
|
---|
| 61 | ###################
|
---|
| 62 |
|
---|
| 63 | # Add -D in front of every preprocessor define declaration
|
---|
| 64 | DEFS = $(DEFINES:%=-D%)
|
---|
| 65 | DEFS_XT = $(DEFINES_XT:%=-D%)
|
---|
| 66 | DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%)
|
---|
| 67 | DEFS_AT = $(DEFINES_AT:%=-D%)
|
---|
| 68 |
|
---|
| 69 | # Add -I in front of all header directories
|
---|
| 70 | IHEADERS = $(HEADERS:%=-I%)
|
---|
| 71 |
|
---|
[145] | 72 | # Path + target file to be built
|
---|
[41] | 73 | TARGET = $(BUILD_DIR)/$(PROG)
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 | #########################
|
---|
| 77 | # Compilers and linkers #
|
---|
| 78 | #########################
|
---|
| 79 |
|
---|
| 80 | # Make
|
---|
| 81 | MAKE = mingw32-make.exe
|
---|
| 82 |
|
---|
| 83 | # Assembler
|
---|
[79] | 84 | AS = nasm.exe
|
---|
[41] | 85 |
|
---|
| 86 | # use this command to erase files.
|
---|
| 87 | RM = -del /Q
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | #############################
|
---|
| 91 | # Compiler and linker flags #
|
---|
| 92 | #############################
|
---|
| 93 |
|
---|
| 94 | # Assembly compiler flags
|
---|
| 95 | ASFLAGS = -f bin # Produce binary object files
|
---|
| 96 | ASFLAGS += $(DEFS) # Preprocessor defines
|
---|
| 97 | ASFLAGS += $(IHEADERS) # Set header file directory paths
|
---|
| 98 | ASFLAGS += -Worphan-labels # Warn about labels without colon
|
---|
| 99 | ASFLAGS += -O9 # Optimize operands to their shortest forms
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 | ############################################
|
---|
| 103 | # Build process. Actual work is done here. #
|
---|
| 104 | ############################################
|
---|
| 105 |
|
---|
| 106 | .PHONY: all at xtplus xt clean
|
---|
| 107 |
|
---|
| 108 | # Make clean debug and release versions
|
---|
| 109 | all: clean at xtplus xt
|
---|
[145] | 110 | @echo All done!
|
---|
[41] | 111 |
|
---|
| 112 | at:
|
---|
[79] | 113 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.$(EXTENSION)"
|
---|
[145] | 114 | @echo AT version "$(TARGET)_at.$(EXTENSION)" built.
|
---|
[41] | 115 |
|
---|
| 116 | xtplus:
|
---|
[79] | 117 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.$(EXTENSION)"
|
---|
[145] | 118 | @echo XT plus version "$(TARGET)_xtp.$(EXTENSION)" built.
|
---|
[41] | 119 |
|
---|
| 120 | xt:
|
---|
[79] | 121 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.$(EXTENSION)"
|
---|
[145] | 122 | @echo XT version "$(TARGET)_xt.$(EXTENSION)" built.
|
---|
[41] | 123 |
|
---|
| 124 | clean:
|
---|
| 125 | @$(RM) $(BUILD_DIR)\*.*
|
---|
| 126 | @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
|
---|