2b095141d580815d3f1364158328e500f01a703b
[reactos.git] / freeldr / freeldr / Makefile
1 #
2 # FreeLoader
3 # Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>
4 #
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.
9 #
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.
14 #
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.
18 #
19
20 include rules.mk
21
22 # asmcode.o has to be first in the link line because it contains the startup code
23 #OBJS = asmcode.a asmcode.o mb.o boot.o freeldr.o rtl.o fs.a fs.o fat.o \
24 # reactos.o tui.o menu.o miscboot.o options.o linux.o multiboot.o arcname.o \
25 # mem.o memory.o debug.o parseini.o registry.o import.o
26 #ASM_OBJS = asmcode.o mb.o boot.o mem.o
27 OBJS = freeldr.o miscboot.o options.o linux.o multiboot.o debug.o parseini.o oslist.o
28 LIBS = arch rtl fs ui reactos comm disk mm cache
29 LIB_FILES = arch/arch.a rtl/rtl.a fs/fs.a ui/ui.a reactos/reactos.a
30 LIB_FILES2 = comm/comm.a disk/disk.a mm/mm.a cache/cache.a
31
32 .PHONY : clean
33
34 all: freeldr.sys
35
36 freeldr.sys: c_code.a
37 $(LD) -N -Ttext=0x8000 --oformat=binary -s -o f.sys c_code.a
38 ../bootsect/stubit ../bootsect/fatstub.bin f.sys freeldr.sys
39
40 freeldr.exe: asmcode.a c_code.a
41 $(LD) -o freeldr.exe asmcode.a c_code.a
42
43 c_code.a: $(LIBS) c_code1.a c_code2.a
44 $(LD) -r -o c_code.a $(LIB_FILES) c_code1.a c_code2.a
45
46 c_code1.a: $(LIBS)
47 $(LD) -r -o c_code1.a $(LIB_FILES2)
48
49 c_code2.a: $(OBJS)
50 $(LD) -r -o c_code2.a $(OBJS)
51
52 freeldr.o: freeldr.c freeldr.h rtl.h fs.h reactos.h ui.h arch.h miscboot.h
53 $(CC) $(FLAGS) -o freeldr.o -c freeldr.c
54
55 miscboot.o: miscboot.c freeldr.h arch.h rtl.h fs.h ui.h miscboot.h
56 $(CC) $(FLAGS) -o miscboot.o -c miscboot.c
57
58 options.o: options.c freeldr.h rtl.h ui.h options.h
59 $(CC) $(FLAGS) -o options.o -c options.c
60
61 linux.o: linux.c freeldr.h rtl.h ui.h linux.h
62 $(CC) $(FLAGS) -o linux.o -c linux.c
63
64 multiboot.o: multiboot.c freeldr.h rtl.h fs.h multiboot.h ui.h
65 $(CC) $(FLAGS) -o multiboot.o -c multiboot.c
66
67 debug.o: debug.c debug.h
68 $(CC) $(FLAGS) -o debug.o -c debug.c
69
70 parseini.o: parseini.c parseini.h
71 $(CC) $(FLAGS) -o parseini.o -c parseini.c
72
73 oslist.o: oslist.c oslist.h
74 $(CC) $(FLAGS) -o oslist.o -c oslist.c
75
76 arch:
77 $(MAKE) -C arch
78
79 rtl:
80 $(MAKE) -C rtl
81
82 fs:
83 $(MAKE) -C fs
84
85 ui:
86 $(MAKE) -C ui
87
88 reactos:
89 $(MAKE) -C reactos
90
91 comm:
92 $(MAKE) -C comm
93
94 disk:
95 $(MAKE) -C disk
96
97 mm:
98 $(MAKE) -C mm
99
100 cache:
101 $(MAKE) -C cache
102
103 .PHONY : $(LIBS)
104
105 clean:
106 - $(RM) *.o
107 - $(RM) *.a
108 - $(RM) *.sys
109 $(MAKE) -C arch clean
110 $(MAKE) -C reactos clean
111 $(MAKE) -C comm clean
112 $(MAKE) -C disk clean
113 $(MAKE) -C mm clean
114 $(MAKE) -C ui clean
115 $(MAKE) -C fs clean
116 $(MAKE) -C rtl clean
117 $(MAKE) -C cache clean