1 | ############################################################################### |
---|
2 | # Generic makefile for building BIOS 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 = ide |
---|
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/Boot/ |
---|
38 | HEADERS += Src/Handlers/ |
---|
39 | HEADERS += Src/Handlers/Int13h/ |
---|
40 | HEADERS += Src/Handlers/Int13h/Common/ |
---|
41 | HEADERS += Src/Initialization/ |
---|
42 | HEADERS += Src/Libraries/ |
---|
43 | HEADERS += Src/Libraries/menu/ |
---|
44 | HEADERS += Src/VariablesAndDPTs/ |
---|
45 | |
---|
46 | |
---|
47 | ################################################################# |
---|
48 | # Assembler preprocessor defines. # |
---|
49 | ################################################################# |
---|
50 | DEFINES = |
---|
51 | DEFINES_XT = |
---|
52 | DEFINES_XTPLUS = USE_186 |
---|
53 | DEFINES_AT = USE_186 USE_286 USE_AT |
---|
54 | |
---|
55 | |
---|
56 | ################### |
---|
57 | # Other variables # |
---|
58 | ################### |
---|
59 | |
---|
60 | # Add -D in front of every preprocessor define declaration |
---|
61 | DEFS = $(DEFINES:%=-D%) |
---|
62 | DEFS_XT = $(DEFINES_XT:%=-D%) |
---|
63 | DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) |
---|
64 | DEFS_AT = $(DEFINES_AT:%=-D%) |
---|
65 | |
---|
66 | # Add -I in front of all header directories |
---|
67 | IHEADERS = $(HEADERS:%=-I%) |
---|
68 | |
---|
69 | # Path + target file to be build |
---|
70 | TARGET = $(BUILD_DIR)/$(PROG) |
---|
71 | |
---|
72 | |
---|
73 | ######################### |
---|
74 | # Compilers and linkers # |
---|
75 | ######################### |
---|
76 | |
---|
77 | # Make |
---|
78 | MAKE = mingw32-make.exe |
---|
79 | |
---|
80 | # Assembler |
---|
81 | AS = yasm.exe |
---|
82 | #AS = nasm.exe |
---|
83 | |
---|
84 | # use this command to erase files. |
---|
85 | RM = -del /Q |
---|
86 | |
---|
87 | |
---|
88 | ############################# |
---|
89 | # Compiler and linker flags # |
---|
90 | ############################# |
---|
91 | |
---|
92 | # Assembly compiler flags |
---|
93 | ASFLAGS = -f bin # Produce binary object files |
---|
94 | ASFLAGS += $(DEFS) # Preprocessor defines |
---|
95 | ASFLAGS += $(IHEADERS) # Set header file directory paths |
---|
96 | ASFLAGS += -Worphan-labels # Warn about labels without colon |
---|
97 | ASFLAGS += -O9 # Optimize operands to their shortest forms |
---|
98 | |
---|
99 | |
---|
100 | ############################################ |
---|
101 | # Build process. Actual work is done here. # |
---|
102 | ############################################ |
---|
103 | |
---|
104 | .PHONY: all at xtplus xt clean |
---|
105 | |
---|
106 | # Make clean debug and release versions |
---|
107 | all: clean at xtplus xt |
---|
108 | @echo All build! |
---|
109 | |
---|
110 | at: |
---|
111 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_at.bin" |
---|
112 | @echo AT version "$(TARGET)_at.bin" build. |
---|
113 | |
---|
114 | xtplus: |
---|
115 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -o"$(TARGET)_xtp.bin" |
---|
116 | @echo XT plus version "$(TARGET)_xtp.bin" build. |
---|
117 | |
---|
118 | xt: |
---|
119 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt.bin" |
---|
120 | @echo XT version "$(TARGET)_xt.bin" build. |
---|
121 | |
---|
122 | clean: |
---|
123 | @$(RM) $(BUILD_DIR)\*.* |
---|
124 | @echo Deleted "(*.*)" from "$(BUILD_DIR)/" |
---|