[2] | 1 | ###############################################################################
|
---|
| 2 | # Generic makefile for building Assembly 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 = idecfg
|
---|
| 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/Libraries/
|
---|
| 38 | HEADERS += Src/Libraries/menu/
|
---|
| 39 | HEADERS += Src/Menupages/
|
---|
| 40 | HEADERS += Src/Menupages/Values/
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 | #################################################################
|
---|
| 44 | # Assembler preprocessor defines. #
|
---|
| 45 | #################################################################
|
---|
| 46 | DEFINES =
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | ###################
|
---|
| 50 | # Other variables #
|
---|
| 51 | ###################
|
---|
| 52 |
|
---|
| 53 | # Add -D in front of every preprocessor define declaration
|
---|
| 54 | DEFS = $(DEFINES:%=-D%)
|
---|
| 55 |
|
---|
| 56 | # Add -I in front of all header directories
|
---|
| 57 | # and also set to search headers from current directory
|
---|
| 58 | IHEADERS = $(HEADERS:%=-I%)
|
---|
| 59 | IHEADERS += -I.
|
---|
| 60 |
|
---|
| 61 | # Path + target file to be build
|
---|
| 62 | TARGET = $(BUILD_DIR)\$(PROG).com
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | #########################
|
---|
| 66 | # Compilers and linkers #
|
---|
| 67 | #########################
|
---|
| 68 |
|
---|
| 69 | # Make
|
---|
| 70 | MAKE = mingw32-make.exe
|
---|
| 71 |
|
---|
| 72 | # Assembler
|
---|
| 73 | AS = nasm.exe
|
---|
| 74 |
|
---|
| 75 | # use this command to erase files.
|
---|
| 76 | RM = -del /Q
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | #############################
|
---|
| 80 | # Compiler and linker flags #
|
---|
| 81 | #############################
|
---|
| 82 |
|
---|
| 83 | # Assembly compiler flags
|
---|
| 84 | ASFLAGS = -f bin # Produce binary object files
|
---|
| 85 | ASFLAGS += $(DEFS) # Preprocessor defines
|
---|
| 86 | ASFLAGS += $(IHEADERS) # Set header file directory paths
|
---|
| 87 | ASFLAGS += -Worphan-labels # Warn about labels without colon
|
---|
| 88 | ASFLAGS += -O9 # Optimize operands to their shortest forms
|
---|
| 89 |
|
---|
| 90 |
|
---|
| 91 | ############################################
|
---|
| 92 | # Build process. Actual work is done here. #
|
---|
| 93 | ############################################
|
---|
| 94 |
|
---|
| 95 | .PHONY: all clean build
|
---|
| 96 |
|
---|
| 97 | # Make clean debug and release versions
|
---|
| 98 | all:
|
---|
| 99 | @$(MAKE) clean
|
---|
| 100 | @$(MAKE) build
|
---|
| 101 | @echo All build!
|
---|
| 102 |
|
---|
| 103 | # Clean
|
---|
| 104 | clean:
|
---|
| 105 | @$(RM) $(BUILD_DIR)\*.*
|
---|
| 106 | @echo Deleted "(*.*)" from "$(BUILD_DIR)\"
|
---|
| 107 |
|
---|
| 108 | # Build
|
---|
| 109 | build:
|
---|
| 110 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) -o"$(TARGET)"
|
---|
| 111 | @echo "$(TARGET)" build.
|
---|