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