Subversion Repositories HelenOS-historic

Rev

Rev 500 | Rev 535 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 500 Rev 502
Line 31... Line 31...
31
 
31
 
32
ifndef ARCH
32
ifndef ARCH
33
	ARCH = ia32
33
	ARCH = ia32
34
endif
34
endif
35
 
35
 
36
## Common compiler flags
36
SOURCES = \
-
 
37
	libc \
37
#
38
	init
38
 
39
 
39
DEFS = -DARCH=$(ARCH)
-
 
40
CFLAGS = -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -Ilibc/include
-
 
41
LFLAGS = -M
-
 
42
AFLAGS =
-
 
43
 
-
 
44
## Setup platform configuration
-
 
45
#
-
 
46
 
-
 
47
include libc/arch/$(ARCH)/Makefile.inc
-
 
48
 
-
 
49
## Toolchain configuration
-
 
50
#
-
 
51
 
-
 
52
ifeq ($(COMPILER),native)
-
 
53
	CC = gcc
-
 
54
	AS = as
-
 
55
	LD = ld
-
 
56
	OBJCOPY = objcopy
-
 
57
	OBJDUMP = objdump
-
 
58
else
-
 
59
	CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc
-
 
60
	AS = $(TOOLCHAIN_DIR)/$(TARGET)-as
40
CLEANS := $(addsuffix .clean,$(SOURCES))
61
	LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld
-
 
62
	OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy
-
 
63
	OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
-
 
64
endif
-
 
65
 
-
 
66
.PHONY: all clean
-
 
67
 
-
 
68
all: init
-
 
69
 
-
 
70
clean:
-
 
71
	-rm -f init init.map _link.ld *.o
-
 
72
	$(MAKE) -C libc clean ARCH=$(ARCH)
-
 
73
 
-
 
74
libc/libc.a:
-
 
75
	$(MAKE) -C libc all ARCH=$(ARCH)
-
 
76
 
41
 
77
_link.ld: _link.ld.in
-
 
78
	$(CC) $(DEFS) $(CFLAGS) -E -x c $< | grep -v "^\#" > $@
42
.PHONY: all $(SOURCES) $(CLEANS) clean
79
 
43
 
80
init: init.o libc/libc.a _link.ld
44
all: $(SOURCES)
81
	$(LD) -T _link.ld $(LFLAGS) init.o libc/libc.a -o $@ -Map init.map
-
 
82
 
45
 
83
%.o: %.S
46
clean: $(CLEANS)
84
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
47
	find $(SOURCES) -name '*.o' -follow -exec rm \{\} \;
85
 
48
 
86
%.o: %.s
49
$(CLEANS):
87
	$(AS) $(AFLAGS) $< -o $@
50
	$(MAKE) -C $(basename $@) clean ARCH=$(ARCH)
88
 
51
 
89
%.o: %.c
52
$(SOURCES):
90
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
53
	$(MAKE) -C $@ all ARCH=$(ARCH)