|
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 is a Linux makefile for elf2e32. |
|
15 |
|
16 ifdef EPOCROOT |
|
17 include $(EPOCROOT)/build/makefiles-garage/global-make-env.mk |
|
18 else |
|
19 $(error EPOCROOT must be defined as the parent directory of your epoc32 tree) |
|
20 endif |
|
21 |
|
22 cpp_inc_paths = -I source -I include -I $(EPOCROOT)/epoc32/include/tools -include ext/hash_map |
|
23 |
|
24 lib_opts = |
|
25 |
|
26 exe = elf2e32 |
|
27 |
|
28 CPPFLAGS = $(cpp_inc_paths) $(global_cpp_flags) |
|
29 LDFLAGS = $(lib_opts) $(global_ld_flags) |
|
30 |
|
31 srcs = source/deffile.cpp source/deflatecompress.cpp source/dll_fb_target.cpp source/dll_rebuild_target.cpp \ |
|
32 source/e32exporttable.cpp source/filedump.cpp source/e32imagefile.cpp source/elf2e32.cpp source/elffilesupplied.cpp \ |
|
33 source/errorhandler.cpp source/exetarget.cpp source/exexp_fb_target.cpp source/exexp_rebuild_target.cpp \ |
|
34 source/export_type_fb_target.cpp source/export_type_rebuild_target.cpp source/export_type_target.cpp source/h_utl.cpp \ |
|
35 source/huffman.cpp source/imgdump.cpp source/inflate.cpp source/librarytarget.cpp source/main.cpp \ |
|
36 source/messagehandler.cpp source/messageimplementation.cpp source/parameterlistinterface.cpp source/parametermanager.cpp \ |
|
37 source/pl_common.cpp source/pl_dllsymbol.cpp source/pl_dso_handler.cpp source/pl_elfconsumer.cpp \ |
|
38 source/pl_elfexecutable.cpp source/pl_elfexports.cpp source/pl_elfimportrelocation.cpp source/pl_elfimports.cpp \ |
|
39 source/pl_elflocalrelocation.cpp source/pl_elfproducer.cpp source/pl_elfrelocation.cpp source/pl_elfrelocations.cpp \ |
|
40 source/pl_symbol.cpp source/polydll_fb_target.cpp source/polydll_rebuild_target.cpp source/usecasebase.cpp \ |
|
41 source/byte_pair.cpp source/pagedcompress.cpp source/checksum.cpp source/stdexe_target.cpp |
|
42 |
|
43 fixfiles = source/pl_elfexecutable.h source/e32imagefile.cpp source/elffilesupplied.cpp source/parametermanager.cpp |
|
44 fixbackups = $(addsuffix .original,$(fixfiles)) |
|
45 |
|
46 .PHONY: all clean fixes remove_fixes |
|
47 |
|
48 all: $(exe) |
|
49 |
|
50 $(srcs): fixes |
|
51 |
|
52 bases = $(basename $(srcs)) |
|
53 |
|
54 objs = $(addsuffix .o,$(bases)) |
|
55 |
|
56 $(exe): $(objs) |
|
57 $(CC) -o $@ $(objs) $(LDFLAGS) |
|
58 |
|
59 clean: remove_fixes |
|
60 rm -f $(objs) $(exe) |
|
61 |
|
62 fixes: $(fixbackups) |
|
63 |
|
64 source/pl_elfexecutable.h.original: |
|
65 cp $(basename $@) $@ && \ |
|
66 sed -e 's|using std::hash_map;|using __gnu_cxx::hash_map;|g' -i $(basename $@) |
|
67 |
|
68 source/e32imagefile.cpp.original: |
|
69 cp $(basename $@) $@ && \ |
|
70 sed -e 's|memcpy(iImportSection, aImportSection\.begin(), aImportSectionSize);|memcpy(iImportSection, \&*aImportSection.begin(), aImportSectionSize);|g' \ |
|
71 -e 's|memcpy(aInfo+aPos, iSymAddrTab\.begin(),|memcpy(aInfo+aPos, \&*iSymAddrTab.begin(),|g' \ |
|
72 -e 's|memcpy( ((void\*)(aInfo+aPos)), ((void\*)Iter), aOffLen);|memcpy( ((void*)(aInfo+aPos)), ((void*)\&*Iter), aOffLen);|g' \ |
|
73 -e 's|memcpy(aInfo+aPos, iSymbolNames\.begin(), iSymbolNames\.size());|memcpy(aInfo+aPos, \&*iSymbolNames.begin(), iSymbolNames.size());|g' \ |
|
74 -i $(basename $@) |
|
75 |
|
76 source/elffilesupplied.cpp.original: |
|
77 cp $(basename $@) $@ && \ |
|
78 sed -e 's|using namespace std;|using namespace std; using __gnu_cxx::hash_set; using __gnu_cxx::hash;|g' -i $(basename $@) |
|
79 |
|
80 source/parametermanager.cpp.original: |
|
81 cp $(basename $@) $@ && \ |
|
82 sed -e 's|ParseCapability1(b, e, aCapabilities, invert);|ParseCapability1(\&*b, \&*e, aCapabilities, invert);|g' \ |
|
83 -e 's|memcpy(symbol, p, len);|memcpy(symbol, \&*p, len);|g' -i $(basename $@) |
|
84 |
|
85 |
|
86 remove_fixes: |
|
87 for file in $(fixbackups); do if [ -f $$file ]; then mv -f $$file $${file%original}; fi; done |
|
88 |