source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile @ 461

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

Changes to XTIDE Universal BIOS:

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