25d1b0977e7c4c310ff69dda6d58daa23e55e86b
[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 = rtl fs ui reactos comm disk mm cache
29 LIB_FILES = rtl/rtl.a fs/fs.a ui/ui.a reactos/reactos.a comm/comm.a disk/disk.a mm/mm.a cache/cache.a
30
31 .PHONY : clean
32
33 all: freeldr.sys
34
35 freeldr.sys: asmcode.a c_code.a
36 $(LD) -N -Ttext=0x8000 --oformat=binary -s -o f.sys asmcode.a c_code.a
37 ../bootsect/stubit ../bootsect/fatstub.bin f.sys freeldr.sys
38
39 freeldr.exe: asmcode.a c_code.a
40 $(LD) -o freeldr.exe asmcode.a c_code.a
41
42 asmcode.a: $(ASM_OBJS)
43 $(LD) -r -o asmcode.a $(ASM_OBJS)
44
45 c_code.a: c_code1.a $(LIBS)
46 $(LD) -r -o c_code.a c_code1.a $(LIB_FILES)
47
48 c_code1.a: $(OBJS)
49 $(LD) -r -o c_code1.a $(OBJS)
50
51 asmcode.o: asmcode.S asmcode.h
52 $(CC) $(FLAGS) -o asmcode.o -c asmcode.S
53
54 mb.o: mb.S asmcode.h multiboot.h
55 $(CC) $(FLAGS) -o mb.o -c mb.S
56
57 boot.o: boot.S asmcode.h
58 $(CC) $(FLAGS) -o boot.o -c boot.S
59
60 mem.o: mem.S asmcode.h
61 $(CC) $(FLAGS) -o mem.o -c mem.S
62
63 freeldr.o: freeldr.c freeldr.h rtl.h fs.h reactos.h ui.h asmcode.h miscboot.h
64 $(CC) $(FLAGS) -o freeldr.o -c freeldr.c
65
66 miscboot.o: miscboot.c freeldr.h asmcode.h rtl.h fs.h ui.h miscboot.h
67 $(CC) $(FLAGS) -o miscboot.o -c miscboot.c
68
69 options.o: options.c freeldr.h rtl.h ui.h options.h
70 $(CC) $(FLAGS) -o options.o -c options.c
71
72 linux.o: linux.c freeldr.h rtl.h ui.h linux.h
73 $(CC) $(FLAGS) -o linux.o -c linux.c
74
75 multiboot.o: multiboot.c freeldr.h rtl.h fs.h multiboot.h ui.h
76 $(CC) $(FLAGS) -o multiboot.o -c multiboot.c
77
78 debug.o: debug.c debug.h Makefile
79 $(CC) $(FLAGS) -o debug.o -c debug.c
80
81 parseini.o: parseini.c parseini.h Makefile
82 $(CC) $(FLAGS) -o parseini.o -c parseini.c
83
84 oslist.o: oslist.c oslist.h Makefile
85 $(CC) $(FLAGS) -o oslist.o -c oslist.c
86
87 rtl:
88 $(MAKE) -C rtl
89
90 fs:
91 $(MAKE) -C fs
92
93 ui:
94 $(MAKE) -C ui
95
96 reactos:
97 $(MAKE) -C reactos
98
99 comm:
100 $(MAKE) -C comm
101
102 disk:
103 $(MAKE) -C disk
104
105 mm:
106 $(MAKE) -C mm
107
108 cache:
109 $(MAKE) -C cache
110
111 .PHONY : $(LIBS)
112
113 clean:
114 - $(RM) *.o
115 - $(RM) *.a
116 - $(RM) *.sys
117 $(MAKE) -C reactos clean
118 $(MAKE) -C comm clean
119 $(MAKE) -C disk clean
120 $(MAKE) -C mm clean
121 $(MAKE) -C ui clean
122 $(MAKE) -C fs clean
123 $(MAKE) -C rtl clean
124 $(MAKE) -C cache clean