kern

view Makefile @ 77:a6513dc35f04

- started writing disk/ata code - made the debug script rip the commandline arguments out of the run script so I won't have to keep them in sync - added 64bit sized types in klibc/intypes.h - temporarily commented out the processes init from main
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 06 Dec 2011 11:56:08 +0200
parents 637efe95d0d1
children
line source
1 ifneq ($(shell uname -m), i386)
2 # -m32 instructs the compiler to produce 32bit code
3 ccemu = -m32
5 ifeq ($(shell uname -s), FreeBSD)
6 ldemu = -m elf_i386_fbsd
7 else
8 ldemu = -m elf_i386
9 endif
10 endif
12 # collect all of our C and assembly source files
13 csrc = $(wildcard src/boot/*.c) $(wildcard src/*.c) $(wildcard src/klibc/*.c)
14 asmsrc = $(wildcard src/boot/*.S) $(wildcard src/*.S) $(wildcard src/klibc/*.S)
15 dep = $(asmsrc:.S=.d) $(csrc:.c=.d)
17 # each source file will generate one object file
18 obj = $(asmsrc:.S=.o) $(csrc:.c=.o)
20 CC = gcc
22 inc = -Isrc -Isrc/klibc -Isrc/boot -Iinclude
24 # -nostdinc instructs the compiler to ignore standard include directories
25 CFLAGS = $(ccemu) -Wall -g -nostdinc -fno-builtin $(inc) -DKERNEL
26 ASFLAGS = $(ccemu) -g -nostdinc -fno-builtin $(inc)
28 bin = kernel.elf
30 # default target: make an ELF binary by linking the object files
31 # we need to specify where to assume the text section (code) is going
32 # in memory, as well as the kernel entry point (kentry).
33 $(bin): $(obj)
34 ld $(ldemu) -o $@ -Ttext 0x100000 -e kentry $(obj) -Map link.map
36 %.s: %.c
37 $(CC) $(CFLAGS) -S -o $@ $<
39 -include $(dep)
41 %.d: %.c
42 @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
44 %.d: %.S
45 @$(CPP) $(ASFLAGS) -MM -MT $(@:.d=.o) $< >$@
47 .PHONY: clean
48 clean:
49 rm -f $(obj) $(bin)
51 .PHONY: cleandep
52 cleandep:
53 rm -f $(dep)