Subversion Repositories HelenOS

Rev

Rev 3564 | Rev 3686 | 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
2479 jermar 37
CONSOLE_PREFIX = ../../srv/console
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
 
1451 cejka 44
CFLAGS += -I$(CONSOLE_PREFIX)
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 \
999 palkovsky 56
	generic/string.c \
2586 jermar 57
	generic/fibril.c \
3171 svoboda 58
	generic/pcb.c \
3400 svoboda 59
	generic/smc.c \
1065 jermar 60
	generic/thread.c \
2586 jermar 61
	generic/tls.c \
1175 jermar 62
	generic/task.c \
1111 jermar 63
	generic/futex.c \
3403 svoboda 64
	generic/io/asprintf.c \
974 cejka 65
	generic/io/io.c \
1234 cejka 66
	generic/io/printf.c \
1363 vana 67
	generic/io/stream.c \
1234 cejka 68
	generic/io/sprintf.c \
69
	generic/io/snprintf.c \
70
	generic/io/vprintf.c \
71
	generic/io/vsprintf.c \
72
	generic/io/vsnprintf.c \
73
	generic/io/printf_core.c \
1113 palkovsky 74
	malloc/malloc.c \
1351 palkovsky 75
	generic/sysinfo.c \
1392 palkovsky 76
	generic/ipc.c \
77
	generic/async.c \
3474 svoboda 78
	generic/loader.c \
3403 svoboda 79
	generic/getopt.c \
1392 palkovsky 80
	generic/libadt/list.o \
1435 palkovsky 81
	generic/libadt/hash_table.o \
1472 palkovsky 82
	generic/time.c \
83
	generic/err.c \
1505 palkovsky 84
	generic/stdlib.c \
2671 jermar 85
	generic/mman.c \
3448 svoboda 86
	generic/udebug.c \
2753 jermar 87
	generic/vfs/vfs.c \
88
	generic/vfs/canonify.c
491 decky 89
 
805 palkovsky 90
ARCH_SOURCES += \
1079 jermar 91
	arch/$(ARCH)/src/entry.s \
92
	arch/$(ARCH)/src/thread_entry.s
491 decky 93
 
94
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
95
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
96
 
2955 svoboda 97
OBJECTS = $(GENERIC_OBJECTS) $(ARCH_OBJECTS)
98
PIC_OBJECTS = $(addsuffix .pio,$(basename $(OBJECTS)))
99
 
954 palkovsky 100
.PHONY: all clean depend kerninc
491 decky 101
 
2955 svoboda 102
all: kerninc libc.a libc.pic.a arch/$(ARCH)/_link.ld
491 decky 103
 
954 palkovsky 104
kerninc:
2479 jermar 105
	ln -sfn ../../../../kernel/generic/include include/kernel
1015 decky 106
	ln -sfn kernel/arch include/arch
1113 palkovsky 107
	ln -sfn ../arch/$(ARCH)/include include/libarch
954 palkovsky 108
 
491 decky 109
-include Makefile.depend
110
 
447 decky 111
clean:
2955 svoboda 112
	-rm -f include/kernel include/arch include/libarch libc.a libc.pic.a arch/$(ARCH)/_link.ld Makefile.depend
113
	find . \( -name '*.o' -o -name '*.pio' \) -follow -exec rm \{\} \;
447 decky 114
 
1113 palkovsky 115
depend: kerninc
3535 svoboda 116
	-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null
2955 svoboda 117
	-makedepend $(DEFS) $(PIC_CFLAGS) -o.pio -f - $(ARCH_SOURCES) $(GENERIC_SOURCES) >> Makefile.depend 2> /dev/null
447 decky 118
 
2955 svoboda 119
libc.a: depend $(OBJECTS)
120
	$(AR) rc $@ $(LIBS) $(OBJECTS)
447 decky 121
 
2955 svoboda 122
libc.pic.a: depend $(PIC_OBJECTS)
123
	$(AR) rc $@ $(LIBS) $(PIC_OBJECTS)
124
 
795 palkovsky 125
arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in
2528 jermar 126
	$(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
502 decky 127
 
491 decky 128
%.o: %.S
129
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
130
 
447 decky 131
%.o: %.s
491 decky 132
	$(AS) $(AFLAGS) $< -o $@
447 decky 133
 
134
%.o: %.c
491 decky 135
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
2955 svoboda 136
 
137
%.pio: %.S
138
	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
139
 
140
%.pio: %.s
141
	$(AS) $(AFLAGS) $< -o $@
142
 
143
%.pio: %.c
144
	$(CC) $(DEFS) $(PIC_CFLAGS) -c $< -o $@