source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile@ 524

Last change on this file since 524 was 524, checked in by aitotat@…, 12 years ago

Changes to XTIDE Universal BIOS:

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