Subversion Repositories HelenOS

Rev

Rev 4337 | Rev 4340 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
491 decky 1
#
2071 jermar 2
# Copyright (c) 2005 Martin Decky
2955 svoboda 3
# Copyright (c) 2008 Jiri Svoboda
491 decky 4
# All rights reserved.
5
#
6
# Redistribution and use in source and binary forms, with or without
7
# modification, are permitted provided that the following conditions
8
# are met:
9
#
10
# - Redistributions of source code must retain the above copyright
11
#   notice, this list of conditions and the following disclaimer.
12
# - Redistributions in binary form must reproduce the above copyright
13
#   notice, this list of conditions and the following disclaimer in the
14
#   documentation and/or other materials provided with the distribution.
15
# - The name of the author may not be used to endorse or promote products
16
#   derived from this software without specific prior written permission.
17
#
18
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
#
447 decky 29
 
491 decky 30
## Common compiler flags
31
#
447 decky 32
 
3569 svoboda 33
include ../../Makefile.config
34
 
2528 jermar 35
LIBC_PREFIX = $(shell pwd)
1073 cejka 36
SOFTINT_PREFIX = ../softint
3686 svoboda 37
RTLD_PREFIX = ../../lib/rtld
447 decky 38
 
502 decky 39
## Setup toolchain
491 decky 40
#
447 decky 41
 
502 decky 42
include $(LIBC_PREFIX)/Makefile.toolchain
447 decky 43
 
4338 svoboda 44
CFLAGS += -I$(RTLD_PREFIX)/include -I../../srv/loader/include -D__32_BITS__
3564 svoboda 45
PIC_CFLAGS := $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__
1451 cejka 46
 
491 decky 47
## Sources
48
#
49
 
1073 cejka 50
 
491 decky 51
GENERIC_SOURCES = \
504 decky 52
	generic/libc.c \
1180 jermar 53
	generic/ddi.c \
1237 jermar 54
	generic/as.c \
1308 jermar 55
	generic/cap.c \
4338 svoboda 56
	generic/console.c \
4337 svoboda 57
	generic/mem.c \
999 palkovsky 58
	generic/string.c \
2586 jermar 59
	generic/fibril.c \
3171 svoboda 60
	generic/pcb.c \
3400 svoboda 61
	generic/smc.c \
1065 jermar 62
	generic/thread.c \
2586 jermar 63
	generic/tls.c \
1175 jermar 64
	generic/task.c \
1111 jermar 65
	generic/futex.c \
3403 svoboda 66
	generic/io/asprintf.c \
974 cejka 67
	generic/io/io.c \
1234 cejka 68
	generic/io/printf.c \
4338 svoboda 69
	generic/io/fprintf.c \
70
	generic/io/stdio.c \
1363 vana 71
	generic/io/stream.c \
1234 cejka 72
	generic/io/sprintf.c \
73
	generic/io/snprintf.c \
74
	generic/io/vprintf.c \
75
	generic/io/vsprintf.c \
76
	generic/io/vsnprintf.c \
77
	generic/io/printf_core.c \
1113 palkovsky 78
	malloc/malloc.c \
1351 palkovsky 79
	generic/sysinfo.c \
1392 palkovsky 80
	generic/ipc.c \
81
	generic/async.c \
3686 svoboda 82
	generic/dlfcn.c \
3474 svoboda 83
	generic/loader.c \
3403 svoboda 84
	generic/getopt.c \
1392 palkovsky 85
	generic/libadt/list.o \
1435 palkovsky 86
	generic/libadt/hash_table.o \
1472 palkovsky 87
	generic/time.c \
88
	generic/err.c \
1505 palkovsky 89
	generic/stdlib.c \
2671 jermar 90
	generic/mman.c \
3448 svoboda 91
	generic/udebug.c \
2753 jermar 92
	generic/vfs/vfs.c \
93
	generic/vfs/canonify.c
491 decky 94
 
805 palkovsky 95
ARCH_SOURCES += \
1079 jermar 96
	arch/$(ARCH)/src/entry.s \
97
	arch/$(ARCH)/src/thread_entry.s
491 decky 98
 
99
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
100
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
4337 svoboda 101
OBJECTS := $(GENERIC_OBJECTS) $(ARCH_OBJECTS)
102
PIC_OBJECTS := $(addsuffix .pio,$(basename $(OBJECTS)))
491 decky 103
 
954 palkovsky 104
.PHONY: all clean depend kerninc
491 decky 105
 
2955 svoboda 106
all: kerninc libc.a libc.pic.a arch/$(ARCH)/_link.ld
491 decky 107
 
954 palkovsky 108
kerninc:
2479 jermar 109
	ln -sfn ../../../../kernel/generic/include include/kernel
1015 decky 110
	ln -sfn kernel/arch include/arch
1113 palkovsky 111
	ln -sfn ../arch/$(ARCH)/include include/libarch
954 palkovsky 112
 
491 decky 113
-include Makefile.depend
114
 
447 decky 115
clean:
2955 svoboda 116
	-rm -f include/kernel include/arch include/libarch libc.a libc.pic.a arch/$(ARCH)/_link.ld Makefile.depend
117
	find . \( -name '*.o' -o -name '*.pio' \) -follow -exec rm \{\} \;
447 decky 118
 
1113 palkovsky 119
depend: kerninc
3535 svoboda 120
	-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null
2955 svoboda 121
	-makedepend $(DEFS) $(PIC_CFLAGS) -o.pio -f - $(ARCH_SOURCES) $(GENERIC_SOURCES) >> Makefile.depend 2> /dev/null
447 decky 122
 
2955 svoboda 123
libc.a: depend $(OBJECTS)
3772 svoboda 124
	$(AR) rc $@ $(LIBS) $(OBJECTS)
447 decky 125
 
2955 svoboda 126
libc.pic.a: depend $(PIC_OBJECTS)
127
	$(AR) rc $@ $(LIBS) $(PIC_OBJECTS)
128
 
795 palkovsky 129
arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in
2528 jermar 130
	$(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
502 decky 131
 
491 decky 132
%.o: %.S
133
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
134
 
447 decky 135
%.o: %.s
491 decky 136
	$(AS) $(AFLAGS) $< -o $@
447 decky 137
 
138
%.o: %.c
491 decky 139
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
2955 svoboda 140
 
141
%.pio: %.S
142
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
143
 
144
%.pio: %.s
145
	$(AS) $(AFLAGS) $< -o $@
146
 
147
%.pio: %.c
148
	$(CC) $(DEFS) $(PIC_CFLAGS) -c $< -o $@