Subversion Repositories HelenOS

Rev

Rev 4341 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4341 Rev 4342
1
#
1
#
2
# Copyright (c) 2005 Martin Decky
2
# Copyright (c) 2005 Martin Decky
3
# All rights reserved.
3
# All rights reserved.
4
#
4
#
5
# Redistribution and use in source and binary forms, with or without
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
6
# modification, are permitted provided that the following conditions
7
# are met:
7
# are met:
8
#
8
#
9
# - Redistributions of source code must retain the above copyright
9
# - Redistributions of source code must retain the above copyright
10
#   notice, this list of conditions and the following disclaimer.
10
#   notice, this list of conditions and the following disclaimer.
11
# - Redistributions in binary form must reproduce the above copyright
11
# - Redistributions in binary form must reproduce the above copyright
12
#   notice, this list of conditions and the following disclaimer in the
12
#   notice, this list of conditions and the following disclaimer in the
13
#   documentation and/or other materials provided with the distribution.
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
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.
15
#   derived from this software without specific prior written permission.
16
#
16
#
17
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
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
18
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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
23
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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
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.
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
27
#
28
 
28
 
29
include ../../../../version
29
include ../../../../version
30
-include ../../../../Makefile.config
-
 
31
 
30
 
32
## Setup toolchain
31
## Setup toolchain
33
#
32
#
34
 
33
 
35
LIBC_PREFIX = ../../../lib/libc
34
LIBC_PREFIX = ../../../lib/libc
36
APP_LIBC_PREFIX = ../../lib/libc
35
APP_LIBC_PREFIX = ../../lib/libc
37
SOFTINT_PREFIX = ../../../lib/softint
36
SOFTINT_PREFIX = ../../../lib/softint
38
RTLD_PREFIX = ../../../lib/rtld
37
RTLD_PREFIX = ../../../lib/rtld
39
include $(LIBC_PREFIX)/Makefile.toolchain
38
include $(LIBC_PREFIX)/Makefile.toolchain
40
#include arch/$(ARCH)/Makefile.inc
39
#include arch/$(UARCH)/Makefile.inc
41
ARCH_SOURCES :=
40
ARCH_SOURCES :=
42
 
41
 
43
LFLAGS = -shared -soname libc.so.0 --whole-archive 
42
LFLAGS = -shared -soname libc.so.0 --whole-archive 
44
 
43
 
45
LIBS = \
44
LIBS = \
46
	$(LIBC_PREFIX)/libc.pic.a \
45
	$(LIBC_PREFIX)/libc.pic.a \
47
	$(SOFTINT_PREFIX)/libsoftint.pic.a \
46
	$(SOFTINT_PREFIX)/libsoftint.pic.a \
48
	$(RTLD_PREFIX)/librtld.pic.a
47
	$(RTLD_PREFIX)/librtld.pic.a
49
 
48
 
50
DEFS += -DRELEASE=\"$(RELEASE)\"
49
DEFS += -DRELEASE=\"$(RELEASE)\"
51
 
50
 
52
ifdef REVISION
-
 
53
	DEFS += "-DREVISION=\"$(REVISION)\""
-
 
54
endif
-
 
55
 
-
 
56
ifdef TIMESTAMP
-
 
57
	DEFS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
-
 
58
endif
-
 
59
 
-
 
60
## Sources
51
## Sources
61
#
52
#
62
 
53
 
63
OUTPUT = libc.so.0
54
OUTPUT = libc.so.0
64
 
55
 
65
.PHONY: all clean
56
.PHONY: all clean
66
 
57
 
67
all: $(OUTPUT) arch/$(ARCH)/_link.ld
58
all: $(OUTPUT) arch/$(UARCH)/_link.ld
68
 
59
 
69
inc:
60
inc:
70
	ln -sfn ../arch/$(ARCH)/include include/arch
61
	ln -sfn ../arch/$(UARCH)/include include/arch
71
 
62
 
72
-include Makefile.depend
63
-include Makefile.depend
73
 
64
 
74
clean:
65
clean:
75
	-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm $(OUTPUT).sections Makefile.depend *.o arch/$(ARCH)/_link.ld  arch/$(ARCH)/_lib.ld include/arch
66
	-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm $(OUTPUT).sections Makefile.depend *.o arch/$(UARCH)/_link.ld  arch/$(UARCH)/_lib.ld include/arch
76
	find arch/$(ARCH)/ -name '*.o' -follow -exec rm \{\} \;
67
	find arch/$(UARCH)/ -name '*.o' -follow -exec rm \{\} \;
77
 
68
 
78
$(OUTPUT): $(LIBS) arch/$(ARCH)/_lib.ld
69
$(OUTPUT): $(LIBS) arch/$(UARCH)/_lib.ld
79
	$(LD) -T arch/$(ARCH)/_lib.ld $(LFLAGS) $(LIBS) -o $@ -Map $(OUTPUT).map
70
	$(LD) -T arch/$(UARCH)/_lib.ld $(LFLAGS) $(LIBS) -o $@ -Map $(OUTPUT).map
80
 
71
 
81
arch/$(ARCH)/_lib.ld: arch/$(ARCH)/_lib.ld.in
72
arch/$(UARCH)/_lib.ld: arch/$(UARCH)/_lib.ld.in
82
	$(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
73
	$(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
83
 
74
 
84
arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in
75
arch/$(UARCH)/_link.ld: arch/$(UARCH)/_link.ld.in
85
	$(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(APP_LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
76
	$(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(APP_LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
86
 
77