[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 |
---|
[9] | 73 | #AS = nasm.exe |
---|
| 74 | AS = yasm.exe |
---|
[2] | 75 | |
---|
| 76 | # use this command to erase files. |
---|
| 77 | RM = -del /Q |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | ############################# |
---|
| 81 | # Compiler and linker flags # |
---|
| 82 | ############################# |
---|
| 83 | |
---|
| 84 | # Assembly compiler flags |
---|
| 85 | ASFLAGS = -f bin # Produce binary object files |
---|
| 86 | ASFLAGS += $(DEFS) # Preprocessor defines |
---|
| 87 | ASFLAGS += $(IHEADERS) # Set header file directory paths |
---|
| 88 | ASFLAGS += -Worphan-labels # Warn about labels without colon |
---|
| 89 | ASFLAGS += -O9 # Optimize operands to their shortest forms |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | ############################################ |
---|
| 93 | # Build process. Actual work is done here. # |
---|
| 94 | ############################################ |
---|
| 95 | |
---|
| 96 | .PHONY: all clean build |
---|
| 97 | |
---|
| 98 | # Make clean debug and release versions |
---|
| 99 | all: |
---|
| 100 | @$(MAKE) clean |
---|
| 101 | @$(MAKE) build |
---|
| 102 | @echo All build! |
---|
| 103 | |
---|
| 104 | # Clean |
---|
| 105 | clean: |
---|
| 106 | @$(RM) $(BUILD_DIR)\*.* |
---|
| 107 | @echo Deleted "(*.*)" from "$(BUILD_DIR)\" |
---|
| 108 | |
---|
| 109 | # Build |
---|
| 110 | build: |
---|
| 111 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) -o"$(TARGET)" |
---|
| 112 | @echo "$(TARGET)" build. |
---|