kern

diff Makefile @ 0:662ff2170531

starting the kernel
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 01 Dec 2010 22:02:42 +0200
parents
children ebe5e0e44a9d
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Wed Dec 01 22:02:42 2010 +0200
     1.3 @@ -0,0 +1,25 @@
     1.4 +# collect all of our C and assembly source files
     1.5 +csrc = $(wildcard src/*.c) $(wildcard src/klibc/*.c)
     1.6 +asmsrc = $(wildcard src/*.S) $(wildcard src/klibc/*.S)
     1.7 +
     1.8 +# each source file will generate one object file
     1.9 +obj = $(csrc:.c=.o) $(asmsrc:.S=.o)
    1.10 +
    1.11 +CC = gcc
    1.12 +
    1.13 +# -nostdinc instructs the compiler to ignore standard include directories
    1.14 +# -m32 instructs the compiler to produce 32bit code (in case we have a 64bit compiler)
    1.15 +CFLAGS = -m32 -Wall -g -nostdinc -fno-builtin -Isrc -Isrc/klibc
    1.16 +ASFLAGS = -m32 -g -nostdinc -fno-builtin -Isrc -Isrc/klibc
    1.17 +
    1.18 +bin = kernel.elf
    1.19 +
    1.20 +# default target: make an ELF binary by linking the object files
    1.21 +# we need to specify where to assume the text segment (code) is going
    1.22 +# in memory, as well as the kernel entry point (kstart).
    1.23 +$(bin): $(obj)
    1.24 +	ld -melf_i386 -o $@ -Ttext 0x200000 -e _start $(obj)
    1.25 +
    1.26 +.PHONY: clean
    1.27 +clean:
    1.28 +	rm -f $(obj) $(bin)