nuclear@0: # collect all of our C and assembly source files nuclear@0: csrc = $(wildcard src/*.c) $(wildcard src/klibc/*.c) nuclear@0: asmsrc = $(wildcard src/*.S) $(wildcard src/klibc/*.S) nuclear@0: nuclear@0: # each source file will generate one object file nuclear@0: obj = $(csrc:.c=.o) $(asmsrc:.S=.o) nuclear@0: nuclear@0: CC = gcc nuclear@0: nuclear@0: # -nostdinc instructs the compiler to ignore standard include directories nuclear@0: # -m32 instructs the compiler to produce 32bit code (in case we have a 64bit compiler) nuclear@0: CFLAGS = -m32 -Wall -g -nostdinc -fno-builtin -Isrc -Isrc/klibc nuclear@0: ASFLAGS = -m32 -g -nostdinc -fno-builtin -Isrc -Isrc/klibc nuclear@0: nuclear@0: bin = kernel.elf nuclear@0: nuclear@0: # default target: make an ELF binary by linking the object files nuclear@0: # we need to specify where to assume the text segment (code) is going nuclear@0: # in memory, as well as the kernel entry point (kstart). nuclear@0: $(bin): $(obj) nuclear@0: ld -melf_i386 -o $@ -Ttext 0x200000 -e _start $(obj) nuclear@0: nuclear@0: .PHONY: clean nuclear@0: clean: nuclear@0: rm -f $(obj) $(bin)