kern

annotate Makefile @ 41:928b0ebfff4d

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