source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/makefile @ 272

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

Changes to XTIDE Universal BIOS:

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