source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile @ 530

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

Changes to XTIDE Universal BIOS:

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