kern

view Makefile @ 19:8be069e6bb05

I think I'm done with the physical memory page allocator
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 30 Mar 2011 22:42:16 +0300
parents b11a86695493
children e6f75f91e606
line source
1 # collect all of our C and assembly source files
2 csrc = $(wildcard src/boot/*.c) $(wildcard src/*.c) $(wildcard src/klibc/*.c)
3 asmsrc = $(wildcard src/boot/*.S) $(wildcard src/*.S) $(wildcard src/klibc/*.S)
4 dep = $(asmsrc:.S=.d) $(csrc:.c=.d)
6 # each source file will generate one object file
7 obj = $(asmsrc:.S=.o) $(csrc:.c=.o)
9 CC = gcc
11 inc = -Isrc -Isrc/klibc -Isrc/boot
13 # -nostdinc instructs the compiler to ignore standard include directories
14 # -m32 instructs the compiler to produce 32bit code (in case we have a 64bit compiler)
15 CFLAGS = -m32 -Wall -g -nostdinc -fno-builtin $(inc)
16 ASFLAGS = -m32 -g -nostdinc -fno-builtin $(inc)
18 bin = kernel.elf
20 # default target: make an ELF binary by linking the object files
21 # we need to specify where to assume the text section (code) is going
22 # in memory, as well as the kernel entry point (kentry).
23 $(bin): $(obj)
24 ld -melf_i386 -o $@ -Ttext 0x100000 -e kentry $(obj) -Map link.map
26 -include $(dep)
28 %.d: %.c
29 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
31 %.d: %.S
32 @$(CPP) $(ASFLAGS) -MM -MT $(@:.d=.o) $< >$@
34 .PHONY: clean
35 clean:
36 rm -f $(obj) $(bin)
38 .PHONY: cleandep
39 cleandep:
40 rm -f $(dep)