source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile @ 489

Last change on this file since 489 was 489, checked in by gregli@…, 11 years ago

Added version string to initial title banner, for cases where there is not a boot menu (just hotkeys, or no hotkeys). Also ifdef'd out some unused code.

File size: 12.1 KB
Line 
1####################################################################################################
2# Makefile to build XTIDE Universal BIOS.                                                          #
3#                                                                                                  #
4# Valid makefile targets are:                                                                      #
5# all       Removes existing files and builds binary files in \Build                               #
6# small     Builds 8 kiB binaries only (without checksum)                                          #
7# large     Builds 15 kiB binaries only (without checksum)                                         #
8# clean     Removes all files from \Build                                                          #
9# checksum* Builds all and then generates checksum byte to all binary files                        #
10# strings*  Compress src\Strings.asm to src\StringsCompressed.asm                                  #
11#                                                                                                  #
12# * at the end of target name means that Perl is required for the job.                             #
13# Build directory must be created manually if it does not exist.                                   #
14#                                                                                                  #
15#                                                                                                  #
16# Following modules can be included or excluded:                                                   #
17# MODULE_8BIT_IDE             Support for 8-BIT IDE cards like XTIDE                               #
18# MODULE_ADVANCED_ATA         Native support for some VLB IDE controllers                          #
19# MODULE_BOOT_MENU            Boot Menu for selection of drive to boot from                        #
20# MODULE_EBIOS                Enhanced functions for accessing drives over 8.4 GB                  #
21# MODULE_HOTKEYS              Hotkey Bar to boot from any drive                                    #
22# MODULE_IRQ                  IDE IRQ support                                                      #
23# MODULE_SERIAL               Virtual hard disks using serial port                                 #
24# MODULE_SERIAL_FLOPPY        Virtual floppy drives using serial port (requires MODULE_SERIAL)     #
25# MODULE_STRINGS_COMPRESSED   Use compressed strings to save space                                 #
26# MODULE_FEATURE_SETS         Power Management support                                             #
27#                                                                                                  #
28# Not modules but these affect the assembly:                                                       #
29# ELIMINATE_CGA_SNOW          Prevents CGA snowing at the cost of a few bytes                      #
30# RELOCATE_INT13H_STACK       Relocates INT 13h stack to top of stolen conventional memory         #
31# RESERVE_DIAGNOSTIC_CYLINDER Reserve one L-CHS cylinder for compatibility with old BIOSes         #
32# USE_186                     Use instructions supported by 80188/80186 and V20/V30 and later      #
33# USE_286                     Use instructions supported by 286 and later                          #
34# USE_386                     Use instructions supported by 386 and later                          #
35# USE_AT                      Use features supported on AT and later systems (not available on XT) #
36#                                                                                                  #
37####################################################################################################
38
39###########################################
40# Source files and destination executable #
41###########################################
42
43# Assembly source code file (*.asm):
44SRC_ASM = Src/Main.asm
45
46# Program executable file name without extension:
47PROG = ide
48
49
50#######################################
51# Destination and include directories #
52#######################################
53
54# Directory where binary file will be compiled to
55BUILD_DIR = Build
56
57# Subdirectories where included files are:
58HEADERS = Inc/
59HEADERS += Inc/Controllers/
60HEADERS += Src/
61HEADERS += Src/Handlers/
62HEADERS += Src/Handlers/Int13h/
63HEADERS += Src/Handlers/Int13h/EBIOS/
64HEADERS += Src/Handlers/Int13h/Tools/
65HEADERS += Src/Handlers/Int19h/
66HEADERS += Src/Device/
67HEADERS += Src/Device/IDE/
68HEADERS += Src/Device/MemoryMappedIDE/
69HEADERS += Src/Device/Serial/
70HEADERS += Src/Initialization/
71HEADERS += Src/Initialization/AdvancedAta/
72HEADERS += Src/Menus/
73HEADERS += Src/Menus/BootMenu/
74HEADERS += Src/Libraries/
75HEADERS += Src/VariablesAndDPTs/
76
77# Subdirectories where library files are:
78LIBS = ../Assembly_Library/Inc/
79LIBS += ../Assembly_Library/Src/
80LIBS += ../Assembly_Library/Src/Display/
81LIBS += ../Assembly_Library/Src/File/
82LIBS += ../Assembly_Library/Src/Keyboard/
83LIBS += ../Assembly_Library/Src/Menu/
84LIBS += ../Assembly_Library/Src/Menu/Dialog/
85LIBS += ../Assembly_Library/Src/String/
86LIBS += ../Assembly_Library/Src/Time/
87LIBS += ../Assembly_Library/Src/Util/
88LIBS += ../Assembly_Library/Src/Serial/
89LIBS += ../XTIDE_Universal_BIOS/Inc/
90HEADERS += $(LIBS)
91
92
93#################################################################
94# Assembler preprocessor defines.                               #
95#################################################################
96DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_EBIOS MODULE_FEATURE_SETS RESERVE_DIAGNOSTIC_CYLINDER
97DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE
98
99DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
100DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186
101DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 RELOCATE_INT13H_STACK MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_ADVANCED_ATA
102
103DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
104DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
105DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
106
107DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE
108DEFINES_386_8K = $(DEFINES_AT) USE_386
109
110DEFINES_ALL_FEATURES = MODULE_8BIT_IDE MODULE_ADVANCED_ATA MODULE_BOOT_MENU MODULE_EBIOS MODULE_HOTKEYS MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_STRINGS_COMPRESSED MODULE_FEATURE_SETS
111
112
113###################
114# Other variables #
115###################
116
117# Target size of the ROM, used in main.asm for number of 512B blocks and by checksum Perl script below
118ROMSIZE = 8192
119ROMSIZE_LARGE = 15360
120
121# Add -D in front of every preprocessor define declaration
122DEFS_XT = $(DEFINES_XT:%=-D%) -DROMSIZE=$(ROMSIZE)
123DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) -DROMSIZE=$(ROMSIZE)
124DEFS_AT = $(DEFINES_AT:%=-D%) -DROMSIZE=$(ROMSIZE)
125DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
126DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
127DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
128DEFS_XT_TINY = $(DEFINES_XT_TINY:%=-D%) -DROMSIZE=$(ROMSIZE)
129DEFS_386_8K = $(DEFINES_386_8K:%=-D%) -DROMSIZE=$(ROMSIZE)
130DEFS_ALL_FEATURES = $(DEFINES_ALL_FEATURES:%=-D%)
131
132# Add -I in front of all header directories
133IHEADERS = $(HEADERS:%=-I%)
134
135# Path + target file to be built
136TARGET = $(BUILD_DIR)/$(PROG)
137
138#########################
139# Compilers and linkers #
140#########################
141
142# Make
143MAKE = mingw32-make.exe
144
145# Assembler
146AS = nasm.exe
147
148# use this command to erase files.
149RM = -del /Q
150
151
152#############################
153# Compiler and linker flags #
154#############################
155
156# Assembly compiler flags
157ASFLAGS = -f bin                # Produce binary object files
158ASFLAGS += $(IHEADERS)          # Set header file directory paths
159ASFLAGS += -Worphan-labels      # Warn about labels without colon
160ASFLAGS += -Ox                  # Optimize operands to their shortest forms
161
162
163############################################
164# Build process. Actual work is done here. #
165############################################
166
167all: clean small large
168    @echo All done!
169
170small: xt_tiny xt xtplus at 386_8k
171    @echo All 8 kiB binaries built!
172
173large: xt_large xtplus_large at_large
174    @echo All 15 kiB binaries built!
175
176at:
177    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
178    @echo * 8k AT version "$(TARGET)_at.bin" built.
179
180at_large:
181    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
182    @echo *15k AT version "$(TARGET)_atl.bin" built.
183
184xtplus:
185    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
186    @echo * 8k XT Plus version "$(TARGET)_xtp.bin" built.
187
188xtplus_large:
189    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
190    @echo *15k XT Plus version "$(TARGET)_xtpl.bin" built.
191
192xt:
193    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
194    @echo * 8k XT version "$(TARGET)_xt.bin" built.
195
196xt_large:
197    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
198    @echo *15k XT version "$(TARGET)_xtl.bin" built.
199
200xt_tiny:
201    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -l"$(TARGET)_tiny.lst" -o"$(TARGET)_tiny.bin"
202    @echo * Tiny XT version "$(TARGET)_tiny.bin" built.
203
204386_8k:
205    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_8K) -l"$(TARGET)_386.lst" -o"$(TARGET)_386.bin"
206    @echo * 8k 386 version "$(TARGET)_386.bin" built.
207
208strings: src\Strings.asm
209    @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_AT_LARGE) -DCHECK_FOR_UNUSED_ENTRYPOINTS -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
210    @perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
211    @echo StringsCompressed.asm updated!
212
213clean:
214    @$(RM) $(BUILD_DIR)\*.*
215    @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
216
217checksum: all
218    @perl ..\tools\checksum.pl $(TARGET)_tiny.bin $(ROMSIZE)
219    @perl ..\tools\checksum.pl $(TARGET)_xt.bin $(ROMSIZE)
220    @perl ..\tools\checksum.pl $(TARGET)_xtp.bin $(ROMSIZE)
221    @perl ..\tools\checksum.pl $(TARGET)_at.bin $(ROMSIZE)
222    @perl ..\tools\checksum.pl $(TARGET)_xtl.bin $(ROMSIZE_LARGE)
223    @perl ..\tools\checksum.pl $(TARGET)_xtpl.bin $(ROMSIZE_LARGE)
224    @perl ..\tools\checksum.pl $(TARGET)_atl.bin $(ROMSIZE_LARGE)
225    @perl ..\tools\checksum.pl $(TARGET)_386.bin $(ROMSIZE)
226
227unused: 
228    @echo "All Features"
229    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_ALL_FEATURES) $(DEFS_XT) $(DEFS_XT_PLUS) $(DEFS_AT) $(DEFS_XT_LARGE) $(DEFS_XTPLUS_LARGE) $(DEFS_AT_LARGE) $(DEFS_XT_TINY) $(DEFS_386_8K) -o"$(TARGET)_unused.asm" -l"$(TARGET)_unused.lst"
230    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_ALL_FEATURES) $(DEFS_XT) $(DEFS_XT_PLUS) $(DEFS_AT) $(DEFS_XT_LARGE) $(DEFS_XTPLUS_LARGE) $(DEFS_AT_LARGE) $(DEFS_XT_TINY) $(DEFS_386_8K) -o"$(TARGET)_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
231    @perl ..\tools\unused.pl $(TARGET)_unused.lst $(TARGET)_unused.asm
232    @echo "XT Small"
233    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -l"$(TARGET)_unused_xt.lst"
234    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_unused_xt.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
235    @perl ..\tools\unused.pl $(TARGET)_unused_xt.lst $(TARGET)_unused_xt.asm
236    @echo "XT Large"
237    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -l"$(TARGET)_unused_xtl.lst"
238    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -o"$(TARGET)_unused_xtl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
239    @perl ..\tools\unused.pl $(TARGET)_unused_xtl.lst $(TARGET)_unused_xtl.asm
240    @echo "AT Small"
241    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -l"$(TARGET)_unused_at.lst"
242    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -o"$(TARGET)_unused_at.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
243    @perl ..\tools\unused.pl $(TARGET)_unused_at.lst $(TARGET)_unused_at.asm
244    @echo "AT Large"
245    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -l"$(TARGET)_unused_atl.lst"
246    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -o"$(TARGET)_unused_atl.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
247    @perl ..\tools\unused.pl $(TARGET)_unused_atl.lst $(TARGET)_unused_atl.asm
248
249
Note: See TracBrowser for help on using the repository browser.