2
# Copyright (c) 2005 Martin Decky
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
9
# - Redistributions of source code must retain the above copyright
10
# notice, this list of conditions and the following disclaimer.
11
# - Redistributions in binary form must reproduce the above copyright
12
# notice, this list of conditions and the following disclaimer in the
13
# documentation and/or other materials provided with the distribution.
14
# - The name of the author may not be used to endorse or promote products
15
# derived from this software without specific prior written permission.
17
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
## Common compiler flags
32
LIBC_PREFIX = $(shell pwd)
33
SOFTINT_PREFIX = ../softint
39
include $(LIBC_PREFIX)/Makefile.toolchain
56
generic/fibril_sync.c \
63
generic/io/asprintf.c \
67
generic/io/snprintf.c \
68
generic/io/vprintf.c \
69
generic/io/vsnprintf.c \
70
generic/io/printf_core.c \
71
generic/io/console.c \
79
generic/adt/hash_table.o \
86
generic/vfs/canonify.c
89
arch/$(UARCH)/src/entry.s \
90
arch/$(UARCH)/src/thread_entry.s
92
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
93
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
94
OBJECTS := $(GENERIC_OBJECTS) $(ARCH_OBJECTS)
96
.PHONY: all clean depend kerninc
98
all: kerninc libc.a arch/$(UARCH)/_link.ld
101
ln -sfn ../../../../kernel/generic/include include/kernel
102
ln -sfn kernel/arch include/arch
103
ln -sfn ../arch/$(UARCH)/include include/libarch
105
-include Makefile.depend
108
-rm -f include/kernel include/arch include/libarch libc.a arch/$(UARCH)/_link.ld Makefile.depend
109
find generic/ arch/$(UARCH)/ -name '*.o' -follow -exec rm \{\} \;
112
-makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null
114
libc.a: depend $(ARCH_OBJECTS) $(GENERIC_OBJECTS)
115
$(AR) rc libc.a $(LIBS) $(ARCH_OBJECTS) $(GENERIC_OBJECTS)
117
arch/$(UARCH)/_link.ld: arch/$(UARCH)/_link.ld.in
118
$(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
121
$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
124
$(AS) $(AFLAGS) $< -o $@
127
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@