source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile @ 397

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

Changes to XTIDE Universal BIOS:

  • Cleaned some code concerning recent module changes.
  • Removed drive number translation flag from ROMVARS.
  • BOOTMENUINFO is now DRVDETECTINFO.
  • Makefile now builds tiny binary (XT build with minimal features).
File size: 9.7 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_ADVANCED_ATA       Native support for some VLB IDE controllers                          #
18# MODULE_BOOT_MENU          Boot Menu for selection of drive to boot from                        #
19# MODULE_EBIOS              Enhanced functions for accessing drives over 8.4 GB                  #
20# MODULE_HOTKEYS            Hotkey Bar to boot from any drive                                    #
21# MODULE_JRIDE              Support for JR-IDE/ISA                                               #
22# MODULE_SERIAL             Virtual hard disks using serial port                                 #
23# MODULE_SERIAL_FLOPPY      Virtual floppy drives using serial port (requires MODULE_SERIAL)     #
24# MODULE_STRINGS_COMPRESSED Use compressed strings to save space                                 #
25#                                                                                                #
26# Not modules but these affect the assembly:                                                     #
27# ELIMINATE_CGA_SNOW        Prevents CGA snowing at the cost of a few bytes                      #
28# USE_186                   Use instructions supported by 80188/80186 and V20/V30 and later      #
29# USE_286                   Use instructions supported by 286 and later                          #
30# USE_386                   Use instructions supported by 386 and later                          #
31# USE_AT                    Use features supported on AT and later systems (not available on XT) #
32#                                                                                                #
33##################################################################################################
34
35###########################################
36# Source files and destination executable #
37###########################################
38
39# Assembly source code file (*.asm):
40SRC_ASM = Src/Main.asm
41
42# Program executable file name without extension:
43PROG = ide
44
45
46#######################################
47# Destination and include directories #
48#######################################
49
50# Directory where binary file will be compiled to
51BUILD_DIR = Build
52
53# Subdirectories where included files are:
54HEADERS = Inc/
55HEADERS += Inc/Controllers/
56HEADERS += Src/
57HEADERS += Src/Handlers/
58HEADERS += Src/Handlers/Int13h/
59HEADERS += Src/Handlers/Int13h/EBIOS/
60HEADERS += Src/Handlers/Int13h/Tools/
61HEADERS += Src/Handlers/Int19h/
62HEADERS += Src/Device/
63HEADERS += Src/Device/IDE/
64HEADERS += Src/Device/MemoryMappedIDE/
65HEADERS += Src/Device/Serial/
66HEADERS += Src/Initialization/
67HEADERS += Src/Initialization/AdvancedAta/
68HEADERS += Src/Menus/
69HEADERS += Src/Menus/BootMenu/
70HEADERS += Src/Libraries/
71HEADERS += Src/VariablesAndDPTs/
72
73# Subdirectories where library files are:
74LIBS = ../Assembly_Library/Inc/
75LIBS += ../Assembly_Library/Src/
76LIBS += ../Assembly_Library/Src/Display/
77LIBS += ../Assembly_Library/Src/File/
78LIBS += ../Assembly_Library/Src/Keyboard/
79LIBS += ../Assembly_Library/Src/Menu/
80LIBS += ../Assembly_Library/Src/Menu/Dialog/
81LIBS += ../Assembly_Library/Src/String/
82LIBS += ../Assembly_Library/Src/Time/
83LIBS += ../Assembly_Library/Src/Util/
84LIBS += ../Assembly_Library/Src/Serial/
85LIBS += ../XTIDE_Universal_BIOS/Inc/
86HEADERS += $(LIBS)
87
88
89#################################################################
90# Assembler preprocessor defines.                               #
91#################################################################
92DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_EBIOS
93DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
94
95DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY
96DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186
97DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_ADVANCED_ATA
98
99DEFINES_XT_LARGE = $(DEFINES_XT) $(DEFINES_COMMON_LARGE)
100DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) $(DEFINES_COMMON_LARGE)
101DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE)
102
103DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED
104DEFINES_386_8K = $(DEFINES_AT) USE_386
105
106
107###################
108# Other variables #
109###################
110
111# Target size of the ROM, used in main.asm for number of 512B blocks and by checksum Perl script below
112ROMSIZE = 8192
113ROMSIZE_LARGE = 15360
114
115# Add -D in front of every preprocessor define declaration
116DEFS_XT = $(DEFINES_XT:%=-D%) -DROMSIZE=$(ROMSIZE)
117DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) -DROMSIZE=$(ROMSIZE)
118DEFS_AT = $(DEFINES_AT:%=-D%) -DROMSIZE=$(ROMSIZE)
119DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
120DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
121DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
122DEFS_XT_TINY = $(DEFINES_XT_TINY:%=-D%) -DROMSIZE=$(ROMSIZE)
123DEFS_386_8K = $(DEFINES_386_8K:%=-D%) -DROMSIZE=$(ROMSIZE)
124
125# Add -I in front of all header directories
126IHEADERS = $(HEADERS:%=-I%)
127
128# Path + target file to be built
129TARGET = $(BUILD_DIR)/$(PROG)
130
131#########################
132# Compilers and linkers #
133#########################
134
135# Make
136MAKE = mingw32-make.exe
137
138# Assembler
139AS = nasm.exe
140
141# use this command to erase files.
142RM = -del /Q
143
144
145#############################
146# Compiler and linker flags #
147#############################
148
149# Assembly compiler flags
150ASFLAGS = -f bin                # Produce binary object files
151ASFLAGS += $(IHEADERS)          # Set header file directory paths
152ASFLAGS += -Worphan-labels      # Warn about labels without colon
153ASFLAGS += -Ox                  # Optimize operands to their shortest forms
154
155
156############################################
157# Build process. Actual work is done here. #
158############################################
159
160all: clean small large
161    @echo All done!
162
163small: xt_tiny xt xtplus at 386_8k
164    @echo All 8 kiB binaries built!
165
166large: xt_large xtplus_large at_large
167    @echo All 15 kiB binaries built!
168
169at:
170    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
171    @echo * 8k AT version "$(TARGET)_at.bin" built.
172
173at_large:
174    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
175    @echo *15k AT version "$(TARGET)_atl.bin" built.
176
177xtplus:
178    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
179    @echo * 8k XT Plus version "$(TARGET)_xtp.bin" built.
180
181xtplus_large:
182    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
183    @echo *15k XT Plus version "$(TARGET)_xtpl.bin" built.
184
185xt:
186    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
187    @echo * 8k XT version "$(TARGET)_xt.bin" built.
188
189xt_large:
190    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
191    @echo *15k XT version "$(TARGET)_xtl.bin" built.
192
193xt_tiny:
194    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_TINY) -l"$(TARGET)_tiny.lst" -o"$(TARGET)_tiny.bin"
195    @echo * Tiny XT version "$(TARGET)_tiny.bin" built.
196
197386_8k:
198    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_386_8K) -l"$(TARGET)_386.lst" -o"$(TARGET)_386.bin"
199    @echo * 8k 386 version "$(TARGET)_386.bin" built.
200
201strings: src\Strings.asm
202    @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DCHECK_FOR_UNUSED_ENTRYPOINTS -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
203    @perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
204    @echo StringsCompressed.asm updated!
205
206clean:
207    @$(RM) $(BUILD_DIR)\*.*
208    @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
209
210checksum: all
211    @perl ..\tools\checksum.pl $(TARGET)_tiny.bin $(ROMSIZE)
212    @perl ..\tools\checksum.pl $(TARGET)_xt.bin $(ROMSIZE)
213    @perl ..\tools\checksum.pl $(TARGET)_xtp.bin $(ROMSIZE)
214    @perl ..\tools\checksum.pl $(TARGET)_at.bin $(ROMSIZE)
215    @perl ..\tools\checksum.pl $(TARGET)_xtl.bin $(ROMSIZE_LARGE)
216    @perl ..\tools\checksum.pl $(TARGET)_xtpl.bin $(ROMSIZE_LARGE)
217    @perl ..\tools\checksum.pl $(TARGET)_atl.bin $(ROMSIZE_LARGE)
218    @perl ..\tools\checksum.pl $(TARGET)_386.bin $(ROMSIZE)
219
220xt_unused: xt
221    @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
222    @perl ..\tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
223
Note: See TracBrowser for help on using the repository browser.