source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile@ 261

Last change on this file since 261 was 258, checked in by gregli@…, 13 years ago

Added floppy drive emulation over the serial connection (MODULE_SERIAL_FLOPPY). Along the way, various optimizations were made to stay within the 8K ROM size target. Also, serial code now returns the number of sectors transferred.

File size: 6.7 KB
RevLine 
[3]1###############################################################################
[252]2# Makefile to build XTIDE Universal BIOS. #
[3]3# #
4# Valid makefile targets are: #
5# all Removes existing files and builds binary file in \Build #
6# build Builds binary file in \Build #
7# clean Removes all files from \Build #
[252]8# checksum* Builds all and then generates checksum byte to all binary files #
9# strings* Compress src\strings.asm to src\StringsCompressed.asm #
[3]10# #
[252]11# * at the end of target name means that Perl is required for the job. #
[3]12# Build directory must be created manually if it does not exist. #
13# #
14###############################################################################
15
16###########################################
17# Source files and destination executable #
18###########################################
19
20# Assembly source code file (*.asm):
21SRC_ASM = Src/Main.asm
22
23# Program executable file name without extension:
24PROG = ide
25
26
27#######################################
28# Destination and include directories #
29#######################################
30
31# Directory where binary file will be compiled to
32BUILD_DIR = Build
33
34# Subdirectories where included files are:
35HEADERS = Inc/
36HEADERS += Src/
37HEADERS += Src/Boot/
38HEADERS += Src/Handlers/
39HEADERS += Src/Handlers/Int13h/
[165]40HEADERS += Src/Handlers/Int13h/EBIOS/
41HEADERS += Src/Handlers/Int13h/Tools/
[150]42HEADERS += Src/Device/
43HEADERS += Src/Device/IDE/
[238]44HEADERS += Src/Device/MemoryMappedIDE/
[150]45HEADERS += Src/Device/Serial/
[3]46HEADERS += Src/Initialization/
47HEADERS += Src/Libraries/
48HEADERS += Src/VariablesAndDPTs/
49
[88]50# Subdirectories where library files are:
51LIBS = ../Assembly_Library/Inc/
52LIBS += ../Assembly_Library/Src/
53LIBS += ../Assembly_Library/Src/Display/
54LIBS += ../Assembly_Library/Src/File/
55LIBS += ../Assembly_Library/Src/Keyboard/
56LIBS += ../Assembly_Library/Src/Menu/
57LIBS += ../Assembly_Library/Src/Menu/Dialog/
58LIBS += ../Assembly_Library/Src/String/
59LIBS += ../Assembly_Library/Src/Time/
60LIBS += ../Assembly_Library/Src/Util/
61LIBS += ../XTIDE_Universal_BIOS/Inc/
62HEADERS += $(LIBS)
[3]63
[88]64
[3]65#################################################################
66# Assembler preprocessor defines. #
67#################################################################
[258]68DEFINES = INCLUDE_MENU_LIBRARY EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS MODULE_EBIOS MODULE_SERIAL MODULE_STRINGS_COMPRESSED MODULE_SERIAL_FLOPPY
[88]69DEFINES_XT = ELIMINATE_CGA_SNOW
70DEFINES_XTPLUS = ELIMINATE_CGA_SNOW USE_186
[3]71DEFINES_AT = USE_186 USE_286 USE_AT
[238]72DEFINES_XT_LARGE = $(DEFINES_XT) MODULE_JRIDE
73DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) MODULE_JRIDE
74DEFINES_AT_LARGE = $(DEFINES_AT) MODULE_JRIDE
[3]75
76
77###################
78# Other variables #
79###################
80
[239]81# Target size of the ROM, used in main.asm for number of 512B blocks and by checksum Perl script below
82ROMSIZE = 8192
83ROMSIZE_LARGE = 15360
84
[3]85# Add -D in front of every preprocessor define declaration
[239]86DEFS = $(DEFINES:%=-D%)
87DEFS_XT = $(DEFINES_XT:%=-D%) -DROMSIZE=$(ROMSIZE)
88DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) -DROMSIZE=$(ROMSIZE)
89DEFS_AT = $(DEFINES_AT:%=-D%) -DROMSIZE=$(ROMSIZE)
90DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
91DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
92DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%) -DROMSIZE=$(ROMSIZE_LARGE)
[3]93
94# Add -I in front of all header directories
95IHEADERS = $(HEADERS:%=-I%)
96
[145]97# Path + target file to be built
[3]98TARGET = $(BUILD_DIR)/$(PROG)
99
100#########################
101# Compilers and linkers #
102#########################
103
104# Make
105MAKE = mingw32-make.exe
106
107# Assembler
[188]108AS = nasm.exe
[3]109
110# use this command to erase files.
111RM = -del /Q
112
113
114#############################
115# Compiler and linker flags #
116#############################
117
118# Assembly compiler flags
119ASFLAGS = -f bin # Produce binary object files
120ASFLAGS += $(DEFS) # Preprocessor defines
121ASFLAGS += $(IHEADERS) # Set header file directory paths
122ASFLAGS += -Worphan-labels # Warn about labels without colon
123ASFLAGS += -O9 # Optimize operands to their shortest forms
124
125
126############################################
127# Build process. Actual work is done here. #
128############################################
129
[238]130.PHONY: all at at_large xtplus xtplus_large xt xt_large clean
[3]131
132# Make clean debug and release versions
[238]133all: clean at at_large xtplus xtplus_large xt xt_large
[145]134 @echo All done!
[3]135
136at:
[80]137 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.bin"
[145]138 @echo AT version "$(TARGET)_at.bin" built.
[3]139
[238]140at_large:
141 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin"
142 @echo Large AT version "$(TARGET)_atl.bin" built.
143
[3]144xtplus:
[80]145 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin"
[145]146 @echo XT plus version "$(TARGET)_xtp.bin" built.
[3]147
[238]148xtplus_large:
149 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin"
150 @echo Large XT plus version "$(TARGET)_xtpl.bin" built.
151
[3]152xt:
[80]153 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin"
[145]154 @echo XT version "$(TARGET)_xt.bin" built.
[3]155
[238]156xt_large:
157 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin"
158 @echo Large XT version "$(TARGET)_xtl.bin" built.
159
[252]160strings: src\StringsCompressed.asm
161
[3]162clean:
163 @$(RM) $(BUILD_DIR)\*.*
164 @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
[186]165
[203]166checksum: all
[240]167 @perl ..\tools\checksum.pl $(TARGET)_atl.bin $(ROMSIZE_LARGE)
168 @perl ..\tools\checksum.pl $(TARGET)_xtpl.bin $(ROMSIZE_LARGE)
169 @perl ..\tools\checksum.pl $(TARGET)_xtl.bin $(ROMSIZE_LARGE)
[203]170 @perl ..\tools\checksum.pl $(TARGET)_at.bin $(ROMSIZE)
171 @perl ..\tools\checksum.pl $(TARGET)_xtp.bin $(ROMSIZE)
172 @perl ..\tools\checksum.pl $(TARGET)_xt.bin $(ROMSIZE)
173
[252]174src\StringsCompressed.asm: src\Strings.asm
[203]175 @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
176 @perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
177 @echo StringsCompressed.asm updated!
[186]178
[252]179xt_unused: xt
[194]180 $(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
181 perl ..\tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
182
Note: See TracBrowser for help on using the repository browser.