kern

view Makefile @ 39:92297f65aaef

- removed redundant call to day_of_year in gmtime_r
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 12 Jun 2011 01:46:53 +0300
parents 2cbc2b922e49
children 928b0ebfff4d
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 = -O0 -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 %.s: %.c
27 $(CC) $(CFLAGS) -S -o $@ $<
29 -include $(dep)
31 %.d: %.c
32 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
34 %.d: %.S
35 @$(CPP) $(ASFLAGS) -MM -MT $(@:.d=.o) $< >$@
37 .PHONY: clean
38 clean:
39 rm -f $(obj) $(bin)
41 .PHONY: cleandep
42 cleandep:
43 rm -f $(dep)