Implemented memory detection & BIOS memory map
[reactos.git] / freeldr / freeldr / Makefile
1 #
2 # FreeLoader
3 # Copyright (C) 1999, 2000 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
21 export CC = gcc
22 export LD = ld
23 export AR = ar
24 export RM = cmd /C del
25 export CP = cmd /C copy
26
27 #FLAGS = -Wall -nostdinc -fno-builtin
28 FLAGS = -Wall -fno-builtin
29
30 # asmcode.o has to be first in the link line because it contains the startup code
31 OBJS = asmcode.a asmcode.o mb.o boot.o freeldr.o stdlib.o fs.a fs.o fs_fat.o \
32 reactos.o tui.o menu.o miscboot.o options.o linux.o multiboot.o arcname.o \
33 mem.o memory.o
34 ASM_OBJS = asmcode.o mb.o boot.o mem.o
35 C_OBJS = freeldr.o stdlib.o fs.a reactos.o tui.o menu.o miscboot.o options.o linux.o \
36 multiboot.o arcname.o memory.o
37
38 all: freeldr.sys
39
40 freeldr.sys: asmcode.a c_code.a
41 $(LD) -N -Ttext=0x8000 --oformat=binary -o freeldr.sys asmcode.a c_code.a
42
43 asmcode.a: $(ASM_OBJS)
44 $(LD) -r -o asmcode.a $(ASM_OBJS)
45
46 c_code.a: $(C_OBJS)
47 $(LD) -r -o c_code.a $(C_OBJS)
48
49 asmcode.o: asmcode.S asmcode.h Makefile
50 $(CC) $(FLAGS) -o asmcode.o -c asmcode.S
51
52 freeldr.o: freeldr.c freeldr.h stdlib.h fs.h reactos.h tui.h asmcode.h menu.h miscboot.h Makefile
53 $(CC) $(FLAGS) -o freeldr.o -c freeldr.c
54
55 stdlib.o: stdlib.c freeldr.h stdlib.h Makefile
56 $(CC) $(FLAGS) -o stdlib.o -c stdlib.c
57
58 fs.a: fs.o fs_fat.o Makefile
59 $(LD) -r -o fs.a fs.o fs_fat.o
60
61 fs.o: fs.c freeldr.h fs.h stdlib.h tui.h asmcode.h Makefile
62 $(CC) $(FLAGS) -o fs.o -c fs.c
63
64 fs_fat.o: fs_fat.c freeldr.h fs.h stdlib.h tui.h Makefile
65 $(CC) $(FLAGS) -o fs_fat.o -c fs_fat.c
66
67 reactos.o: reactos.c freeldr.h reactos.h stdlib.h fs.h tui.h multiboot.h Makefile
68 $(CC) $(FLAGS) -o reactos.o -c reactos.c
69
70 multiboot.o: multiboot.c freeldr.h stdlib.h fs.h multiboot.h tui.h Makefile
71 $(CC) $(FLAGS) -o multiboot.o -c multiboot.c
72
73 mb.o: mb.S asmcode.h multiboot.h Makefile
74 $(CC) $(FLAGS) -o mb.o -c mb.S
75
76 tui.o: tui.c freeldr.h stdlib.h tui.h Makefile
77 $(CC) $(FLAGS) -o tui.o -c tui.c
78
79 menu.o: menu.c freeldr.h stdlib.h tui.h menu.h Makefile
80 $(CC) $(FLAGS) -o menu.o -c menu.c
81
82 boot.o: boot.S asmcode.h Makefile
83 $(CC) $(FLAGS) -o boot.o -c boot.S
84
85 miscboot.o: miscboot.c freeldr.h asmcode.h stdlib.h fs.h tui.h miscboot.h Makefile
86 $(CC) $(FLAGS) -o miscboot.o -c miscboot.c
87
88 options.o: options.c freeldr.h stdlib.h tui.h options.h Makefile
89 $(CC) $(FLAGS) -o options.o -c options.c
90
91 linux.o: linux.c freeldr.h stdlib.h tui.h linux.h Makefile
92 $(CC) $(FLAGS) -o linux.o -c linux.c
93
94 arcname.o: arcname.c freeldr.h arcname.h stdlib.h Makefile
95 $(CC) $(FLAGS) -o arcname.o -c arcname.c
96
97 mem.o: mem.S asmcode.h Makefile
98 $(CC) $(FLAGS) -o mem.o -c mem.S
99
100 memory.o: memory.c asmcode.h memory.h Makefile
101 $(CC) $(FLAGS) -o memory.o -c memory.c
102
103 clean:
104 $(RM) *.o
105 $(RM) *.a
106 $(RM) freeldr.sys