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