|
1 # Copyright (c) 2009 Symbian Foundation Ltd |
|
2 # This component and the accompanying materials are made available |
|
3 # under the terms of the License "Eclipse Public License v1.0" |
|
4 # which accompanies this distribution, and is available |
|
5 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
6 # |
|
7 # Initial Contributors: |
|
8 # Symbian Foundation Ltd - initial contribution. |
|
9 # Mike Kinghan, mikek@symbian.org |
|
10 # |
|
11 # Contributors: |
|
12 # |
|
13 # Description: |
|
14 # This makefile sets up the global environment for building the Symbian build tools. |
|
15 # It is included by all the makefiles. |
|
16 |
|
17 ifndef global_make_env |
|
18 # include the following only once |
|
19 |
|
20 export global_make_env = 1 |
|
21 |
|
22 export gcc_patch = $(shell gcc --version | head -n 1 | sed -e 's/^.*\([0-9]\.[0-9]\.[0-9]\)$$/\1/g' -) |
|
23 export gcc_ver = $(shell gcc --version | head -n 1 | sed -e 's/^.*\([0-9]\.[0-9]\)\.[0-9]$$/\1/g' -) |
|
24 |
|
25 linux_gcc_inc_path = $(EPOCROOT)/epoc32/include/tools/linux/gcc |
|
26 linux_gcc_ver_inc_path = $(linux_gcc_inc_path)/$(gcc_ver) |
|
27 linux_gcc_patch_inc_path = $(linux_gcc_inc_path)/$(gcc_patch) |
|
28 linux_gcc_defs_inc = $(linux_gcc_ver_inc_path)/hack_defs.h |
|
29 preinclude = $(linux_gcc_ver_inc_path)/preinclude.h |
|
30 make_preinclude := $(shell if [ -f $(preinclude) ]; then echo N; else echo Y; fi) |
|
31 global_cpp_defs = -D__LINUX__ -D__TOOLS2__ -D__TOOLS__ -D__GCC32__ -D__PLACEMENT_NEW_INLINE -D__PLACEMENT_VEC_NEW_INLINE |
|
32 global_cpp_inc_paths = -I $(EPOCROOT)/epoc32/include -I $(EPOCROOT)/epoc32/include/tools/linux/gcc/$(gcc_ver) |
|
33 global_cpp_preinclude = -include $(preinclude) |
|
34 |
|
35 export CC = g++ |
|
36 export global_cpp_flags = $(global_cpp_defs) $(global_cpp_inc_paths) $(global_cpp_preinclude) |
|
37 export global_cxx_flags = -O2 |
|
38 export global_prereqs = $(preinclude) |
|
39 export global_cflags = |
|
40 |
|
41 ifeq ($(make_preinclude),Y) |
|
42 # We need to make the global preinclude.h file |
|
43 |
|
44 $(preinclude): $(linux_gcc_defs_inc) |
|
45 printf "#ifndef PREINCLUDE_H\n"\ |
|
46 "#include <cstdlib>\n"\ |
|
47 "#include <e32def.h>\n"\ |
|
48 "#include <hack_defs.h>\n"\ |
|
49 "#include <cstring>\n"\ |
|
50 "#include <climits>\n"\ |
|
51 "#include <exception>\n"\ |
|
52 "#include <new>\n"\ |
|
53 "#endif\n" >> $@ |
|
54 $(MAKE) |
|
55 |
|
56 $(linux_gcc_patch_inc_path): |
|
57 mkdir -p $@ |
|
58 |
|
59 |
|
60 $(linux_gcc_ver_inc_path) : $(linux_gcc_patch_inc_path) |
|
61 rm -f $@ |
|
62 ln -s $< $@ |
|
63 |
|
64 |
|
65 $(linux_gcc_defs_inc): $(linux_gcc_ver_inc_path) |
|
66 printf "#ifndef HACK_DEFS_H\n"\ |
|
67 "#define HACK_DEFS_H\n"\ |
|
68 "#define DIMPORT_C\n"\ |
|
69 "#define __NO_THROW\n"\ |
|
70 "#define NONSHARABLE_CLASS(x) class x\n"\ |
|
71 "#undef _FOFF\n"\ |
|
72 "#define _FOFF(c,f) (((TInt)&(((c *)0x1000)->f))-0x1000)\n"\ |
|
73 "#define TEMPLATE_SPECIALIZATION template<>\n"\ |
|
74 "#undef __ASSERT_COMPILE\n"\ |
|
75 "#define __ASSERT_COMPILE(x)\n"\ |
|
76 "#define TAny void\n"\ |
|
77 "#endif\n" >> $@ |
|
78 |
|
79 endif |
|
80 # End: make the global preinclude.h file |
|
81 |
|
82 endif |
|
83 # End: included only once |
|
84 |
|
85 ifdef query |
|
86 # Running one of the query targets |
|
87 |
|
88 hacks: |
|
89 @if [ "$(fixfiles)" != "" ]; then \ |
|
90 echo $(targ): hacks for:-; \ |
|
91 for file in $(fixfiles); do echo " $$file"; done; \ |
|
92 fi |
|
93 |
|
94 prereqs: |
|
95 @if [ "$(prereqs)" != "" ]; then \ |
|
96 echo $(targ): needs:-; \ |
|
97 for prereq in $(prereqs); do echo " $$prereq"; done; \ |
|
98 fi |
|
99 |
|
100 endif |
|
101 # End: Running one of the query targets |
|
102 |