3 # Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 PATH_TO_TOP
= ..
/..
/..
26 # Debugging information on (bigger binary)
28 # Debugging information off (smaller binary)
34 BOOTCD_DIR
= $(PATH_TO_TOP
)/bootcd
36 TOOLSDIR
= $(SRCDIR
)/..
/tools
38 DEPTOOL
= $(subst /,$(SEP
),$(FREELDR_TOOLS_PATH
))$(SEP
)deptool
45 @
$(MAKE
) --no-print-directory
-C
$(FREELDR_TOOLS_PATH
)
47 #############################################
52 @
-$(RM
) $(ALL_OBJS
:.o
=.d
)
59 @
$(MAKE
) --no-print-directory
-C
$(FREELDR_TOOLS_PATH
)
60 @echo freeldr
: Clean ALL done.
62 #############################################
65 bootcd
: bootcd_dirs setup_loader boot_loader
69 $(MKDIR
) $(BOOTCD_DIR
)
70 $(MKDIR
) $(BOOTCD_DIR
)/disk
71 $(MKDIR
) $(BOOTCD_DIR
)/disk
/reactos
72 $(MKDIR
) $(BOOTCD_DIR
)/disk
/install
73 $(MKDIR
) $(BOOTCD_DIR
)/disk
/bootdisk
74 $(MKDIR
) $(BOOTCD_DIR
)/disk
/loader
77 boot_loader
: freeldr.sys
78 $(CP
) freeldr.sys
$(BOOTCD_DIR
)/disk
/loader
/freeldr.sys
79 $(CP
) ..
/freeldr.ini
$(BOOTCD_DIR
)/disk
/loader
/freeldr.ini
82 setup_loader
: setupldr.sys
83 $(CP
) setupldr.sys
$(BOOTCD_DIR
)/disk
/loader
/setupldr.sys
86 COMPILER_OPTIONS
= -Wall
-Werror
-nostdlib
-ffreestanding
-fno-builtin
-fno-inline \
87 -fno-zero-initialized-in-bss
-O1
-MD
88 # FreeLoader does not use any of the standard libraries, includes, or built-in functions
91 COMPILER_DEBUG_DEFINES
= -DDEBUG
93 COMPILER_DEBUG_DEFINES
=
96 COMPILER_DEFINES
= -D__
$(TARGET
)__
$(COMPILER_DEBUG_DEFINES
)
98 COMPILER_INCLUDES
= -I
$(SRCDIR
)/include -I
$(PATH_TO_TOP
)/w32api
/include -I
$(PATH_TO_TOP
)/include -I
$(PATH_TO_TOP
)/ntoskrnl
/include
100 CFLAGS
= $(COMPILER_OPTIONS
) \
101 $(COMPILER_DEFINES
) \
104 LINKER_OPTIONS
= -N
-Ttext
=0x8000
106 LFLAGS
= $(LINKER_OPTIONS
)
108 ifeq ($(HOST
),mingw32-linux
)
114 # fathelp.o must come first in the link line because it contains bootsector helper code
115 # arch.o must come second in the link line because it contains the startup code
116 ARCH_I386_OBJS
= fathelp.o \
151 _alloca.o
# For Mingw32 builds
153 ARCH_OBJS
= $(addprefix i386
/,$(ARCH_I386_OBJS
))
176 REACTOS_OBJS
= arcname.o \
188 CACHE_OBJS
= cache.o \
191 INIFILE_OBJS
= inifile.o \
195 INFFILE_OBJS
= inffile.o
197 VIDEO_OBJS
= video.o \
203 # libgcc2.o contains code (__udivdi3, __umoddi3) necessary to do
204 # 64-bit division on the i386 (and other 32-bit) architectures
205 # This code was taken from the GCC v3.1 source
206 MATH_OBJS
= libgcc2.o
208 BASE_OBJS
= freeldr.o \
215 FREELDR_OBJS
= bootmgr.o \
223 ROSLDR_OBJS
= reactos.o
225 SETUPLDR_OBJS
= setupldr.o
227 COMMON_OBJS
= $(addprefix arch
/,$(ARCH_OBJS
)) \
228 $(addprefix rtl
/,$(RTL_OBJS
)) \
229 $(addprefix fs
/,$(FS_OBJS
)) \
230 $(addprefix ui
/,$(UI_OBJS
)) \
231 $(addprefix reactos
/,$(REACTOS_OBJS
)) \
232 $(addprefix comm
/,$(COMM_OBJS
)) \
233 $(addprefix disk
/,$(DISK_OBJS
)) \
234 $(addprefix mm
/,$(MM_OBJS
)) \
235 $(addprefix cache
/,$(CACHE_OBJS
)) \
236 $(addprefix video
/,$(VIDEO_OBJS
)) \
237 $(addprefix math
/,$(MATH_OBJS
)) \
240 SPECIAL_OBJS
= $(addprefix inifile
/,$(INIFILE_OBJS
)) \
241 $(addprefix inffile
/,$(INFFILE_OBJS
)) \
243 $(addprefix reactos
/,$(ROSLDR_OBJS
)) \
244 $(addprefix reactos
/,$(SETUPLDR_OBJS
))
246 F_OBJS
= $(COMMON_OBJS
) \
247 $(addprefix inifile
/,$(INIFILE_OBJS
)) \
248 $(addprefix reactos
/,$(ROSLDR_OBJS
)) \
251 S_OBJS
= $(COMMON_OBJS
) \
252 $(addprefix inifile
/,$(INIFILE_OBJS
)) \
253 $(addprefix inffile
/,$(INFFILE_OBJS
)) \
254 $(addprefix reactos
/,$(SETUPLDR_OBJS
))
257 ALL_OBJS
= $(COMMON_OBJS
) \
261 all : freeldr.sys setupldr.sys
262 @echo freeldr
: Make ALL done.
265 freeldr.sys
: $(ALL_OBJS
) $(PATH_TO_TOP
)/dk
/w32
/lib
/librossym.a
266 @echo freeldr
: LINKING
$@
267 @
$(LD
) $(LFLAGS
) -o freeldr.exe
$(F_OBJS
) $(PATH_TO_TOP
)/dk
/w32
/lib
/librossym.a
268 ifeq ($(FULL_MAP
),yes
)
269 @
$(OBJDUMP
) -d
-S freeldr.exe
> freeldr.map
271 @
$(NM
) --numeric-sort freeldr.exe
> freeldr.map
273 @
$(OBJCOPY
) -O binary freeldr.exe freeldr.sys
276 setupldr.sys
: $(ALL_OBJS
)
277 @echo freeldr
: LINKING
$@
278 @
$(LD
) $(LFLAGS
) -Map setupldr.map
-o setupldr.exe
$(S_OBJS
)
279 ifeq ($(FULL_MAP
),yes
)
280 @
$(OBJDUMP
) -d
-S setupldr.exe
> setupldr.map
282 @
$(NM
) --numeric-sort setupldr.exe
> setupldr.map
284 @
$(OBJCOPY
) -O binary setupldr.exe setupldr.sys
288 @echo freeldr
: Compiling
$*
289 @
$(CC
) $(CFLAGS
) -o
$@
-c
$<
293 @echo freeldr
: Assembling
$*
294 @
$(CC
) $(CFLAGS
) -o
$@
-c
$<
298 @echo freeldr
: Assembling
$*
299 @
$(NASM_CMD
) $(NASMFLAGS
) -o
$@
$<