1SubDir HAIKU_TOP src system runtime_loader ;
2
3
4if $(TARGET_ARCH) = x86_64
5	&& ( x86 in $(HAIKU_ARCHS[2-]) || x86_gcc2 in $(HAIKU_ARCHS[2-]) ) {
6	DEFINES += _COMPAT_MODE ;
7}
8
9local architectureObject ;
10for architectureObject in [ MultiArchSubDirSetup ] {
11	on $(architectureObject) {
12		local architecture = $(TARGET_PACKAGING_ARCH) ;
13
14		UsePrivateHeaders libroot runtime_loader shared ;
15		UsePrivateHeaders kernel ;
16			# for <util/KMessage.h>
17		UsePrivateHeaders libroot os ;
18			# for "PathBuffer.h"
19		UsePrivateSystemHeaders ;
20
21		ObjectHdrs find_directory.cpp : $(HAIKU_TOP)/src/system/libroot/os ;
22
23		# Don't let gcc inject built-in function code. This will cause
24		# dependencies to libroot, which we don't link against.
25		SubDirCcFlags -fno-builtin ;
26		SubDirC++Flags -fno-builtin -fno-exceptions ;
27
28		DEFINES +=
29			KMESSAGE_CONTAINER_ONLY
30			_LOADER_MODE
31			USING_LIBGCC=1
32		;
33
34		AddResources [ MultiArchDefaultGristFiles runtime_loader ]
35			: runtime_loader.rdef ;
36
37		# needed for "runtime_loader" only
38		StaticLibrary <$(architecture)>libruntime_loader.a :
39			kernel_vsprintf.cpp
40			kernel_cpp.cpp
41			KMessage.cpp
42			find_directory.cpp
43			:
44			<src!system!libroot!os!$(architecture)>mutex.o
45			<src!system!libroot!os!$(architecture)>recursive_lock.o
46			<src!system!libroot!os!$(architecture)>syscalls.o
47			<src!system!libroot!os!$(architecture)>sem.o
48			<src!system!libroot!os!arch!$(TARGET_ARCH)!$(architecture)>tls.o
49
50			<src!system!libroot!posix!$(architecture)>errno.o
51			<src!system!libroot!posix!$(architecture)>fcntl.o
52
53			<src!system!libroot!posix!locale!$(architecture)>ctype.o
54			<src!system!libroot!posix!locale!$(architecture)>LocaleData.o
55
56			<src!system!libroot!posix!string!$(architecture)>memchr.o
57			<src!system!libroot!posix!string!$(architecture)>memcmp.o
58			<src!system!libroot!posix!string!$(architecture)>memmove.o
59			<src!system!libroot!posix!string!$(architecture)>strcasecmp.o
60			<src!system!libroot!posix!string!$(architecture)>strcat.o
61			<src!system!libroot!posix!string!$(architecture)>strchr.o
62			<src!system!libroot!posix!string!$(architecture)>strcmp.o
63			<src!system!libroot!posix!string!$(architecture)>strcpy.o
64			<src!system!libroot!posix!string!$(architecture)>strcspn.o
65			<src!system!libroot!posix!string!$(architecture)>strdup.o
66			<src!system!libroot!posix!string!$(architecture)>strerror.o
67			<src!system!libroot!posix!string!$(architecture)>strlcat.o
68			<src!system!libroot!posix!string!$(architecture)>strlcpy.o
69			<src!system!libroot!posix!string!$(architecture)>strlen.o
70			<src!system!libroot!posix!string!$(architecture)>strncmp.o
71			<src!system!libroot!posix!string!$(architecture)>strnlen.o
72			<src!system!libroot!posix!string!$(architecture)>strpbrk.o
73			<src!system!libroot!posix!string!$(architecture)>strrchr.o
74			<src!system!libroot!posix!string!$(architecture)>strspn.o
75			<src!system!libroot!posix!string!$(architecture)>strstr.o
76		;
77
78		SEARCH on [ FGristFiles kernel_cpp.cpp ]
79			= [ FDirName $(HAIKU_TOP) src system kernel util ] ;
80		SEARCH on [ FGristFiles kernel_vsprintf.cpp ]
81			= [ FDirName $(HAIKU_TOP) src system kernel lib ] ;
82		SEARCH on [ FGristFiles KMessage.cpp ]
83			= [ FDirName $(HAIKU_TOP) src system kernel messaging ] ;
84		SEARCH on [ FGristFiles find_directory.cpp ]
85			= [ FDirName $(HAIKU_TOP) src system libroot os ] ;
86
87		local sources =
88			add_ons.cpp
89			elf.cpp
90			elf_haiku_version.cpp
91			elf_load_image.cpp
92			elf_symbol_lookup.cpp
93			elf_tls.cpp
94			elf_versioning.cpp
95			pe.cpp
96			errors.cpp
97			export.cpp
98			heap.cpp
99			images.cpp
100			runtime_loader.cpp
101			utility.cpp
102		;
103
104		Objects [ FGristFiles $(sources) ] ;
105
106		Ld [ MultiArchDefaultGristFiles runtime_loader ] :
107			[ FGristFiles $(sources:S=$(SUFOBJ)) ]
108			<$(architecture)>libruntime_loader.a
109			<$(architecture)>libruntime_loader_$(TARGET_ARCH).a
110			[ TargetKernelLibsupc++ ]
111			[ TargetKernelLibgcc ]
112			[ TargetKernelLibgcceh ]
113			: $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/runtime_loader.ld
114			: --no-undefined -shared -soname=runtime_loader
115		;
116	}
117}
118
119
120local arch ;
121for arch in $(TARGET_ARCHS) {
122	HaikuSubInclude arch $(arch) ;
123}
124
125