kern
view Makefile @ 8:78d5c304ddd0
minor changes
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 16 Feb 2011 07:50:25 +0200 |
parents | a9176938bce1 |
children | b11a86695493 |
line source
1 # collect all of our C and assembly source files
2 csrc = $(wildcard src/*.c) $(wildcard src/klibc/*.c)
3 asmsrc = $(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 # -nostdinc instructs the compiler to ignore standard include directories
12 # -m32 instructs the compiler to produce 32bit code (in case we have a 64bit compiler)
13 CFLAGS = -m32 -Wall -g -nostdinc -fno-builtin -Isrc -Isrc/klibc
14 ASFLAGS = -m32 -g -nostdinc -fno-builtin -Isrc -Isrc/klibc
16 bin = kernel.elf
18 # default target: make an ELF binary by linking the object files
19 # we need to specify where to assume the text section (code) is going
20 # in memory, as well as the kernel entry point (kentry).
21 $(bin): $(obj)
22 ld -melf_i386 -o $@ -Ttext 0x100000 -e kentry $(obj)
24 -include $(dep)
26 %.d: %.c
27 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
29 %.d: %.S
30 @$(CPP) $(ASFLAGS) -MM -MT $(@:.d=.o) $< >$@
32 .PHONY: clean
33 clean:
34 rm -f $(obj) $(bin)
36 .PHONY: cleandep
37 cleandep:
38 rm -f $(dep)