0
|
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 the Symbian build tools components.
|
|
15 |
|
|
16 |
epocroot := $(dir $(realpath ../epoc32))
|
|
17 |
ifneq '$(epocroot)' ''
|
|
18 |
epocroot := $(patsubst %/,%,$(epocroot))
|
|
19 |
$(warning WARNING: EPOCROOT not set. Assuming $(epocroot))
|
|
20 |
export EPOCROOT=$(epocroot)
|
|
21 |
else
|
|
22 |
$(error EPOCROOT must be defined as the parent directory of your epoc32 tree)
|
|
23 |
endif
|
|
24 |
|
|
25 |
ifdef EPOCROOT
|
|
26 |
include $(EPOCROOT)/build/makefiles-garage/global-make-env.mk
|
|
27 |
endif
|
|
28 |
|
1
|
29 |
ifeq '$(file)' ''
|
|
30 |
file = diffs.patch
|
|
31 |
endif
|
|
32 |
|
0
|
33 |
garage = $(EPOCROOT)/build/makefiles-garage
|
|
34 |
garage_makefiles = $(shell find $(garage) -name Makefile)
|
|
35 |
targets = $(notdir $(patsubst %/Makefile,%,$(garage_makefiles)))
|
|
36 |
clean_targets = $(addsuffix -clean,$(targets))
|
1
|
37 |
what_targets = $(addsuffix -what,$(targets))
|
0
|
38 |
garage_make_dirs = $(patsubst %/Makefile,%,$(garage_makefiles))
|
|
39 |
make_dirs = $(patsubst $(garage)%,$(EPOCROOT)/build%,$(garage_make_dirs))
|
|
40 |
makefiles = $(patsubst $(garage)/%,$(EPOCROOT)/build/%,$(garage_makefiles))
|
|
41 |
raptor_linux_binaries = $(EPOCROOT)/build/sbsv2/raptor/linux-*
|
|
42 |
new_subdirs = $(EPOCROOT)/build/imgtools/romtools/r_t_areaset
|
|
43 |
subdirs = imgtools e32tools sbsv2 srctools buildframework buildtoolguides bintools
|
|
44 |
|
|
45 |
.PHONY: all tools export gen_preinclude clean distclean deploy_makefiles gather_makefiles help \
|
1
|
46 |
sbs_comp_list sbs_targ_list list_fixups list_prereqs
|
|
47 |
|
0
|
48 |
|
|
49 |
all: tools
|
|
50 |
|
|
51 |
tools: $(preinclude) $(makefiles)
|
|
52 |
for dir in $(subdirs); do $(MAKE) -C $$dir; done
|
|
53 |
|
|
54 |
|
|
55 |
#export: tools
|
|
56 |
# for dir in $(subdirs); do $(MAKE) -C $$dir export; done
|
|
57 |
|
|
58 |
clean: $(makefiles)
|
|
59 |
for dir in $(subdirs); do $(MAKE) -C $$dir clean; done
|
|
60 |
|
|
61 |
distclean: clean
|
|
62 |
rm -f -r $(makefiles) $($(preinclude) $(linux_gcc_defs_inc) $(raptor_linux_binaries) $(new_subdirs)
|
|
63 |
|
|
64 |
help:
|
|
65 |
@echo "Build the Symbian build tools by conventional GNU/Linux means."
|
|
66 |
@echo "PHONY targets:"
|
|
67 |
@echo ""
|
|
68 |
@echo " help"
|
|
69 |
@echo " all - Build all real targets (default)"
|
|
70 |
@echo " clean - Remove all build object files, libraries and executables"
|
|
71 |
@echo " TARGET-clean - clean the real target TARGET"
|
|
72 |
@echo " distclean - Remove everything but the original files"
|
1
|
73 |
@echo " deploy_makefiles - Copy makefiles from the 'makefiles_garage' to the locations where they run"
|
|
74 |
@echo " gather_makefiles - Gather any new or updated makefiles from the places where they run into the 'makefiles_garage'"
|
0
|
75 |
@echo " export - TODO: No exports are implemented yet"
|
1
|
76 |
@echo " what - List the files built by the real targets."
|
|
77 |
@echo " missing - List the real targets that do not exist."
|
|
78 |
@echo " TARGET-what - List the files built by the real target TARGET."
|
0
|
79 |
@echo " sbs_comp_list - List the components that sbs would find (BLD.INF files)"
|
|
80 |
@echo " sbs_targ_list - List the targets that sbs would find (MMP files)"
|
|
81 |
@echo " list_prereqs - List the dependency graph of final targets"
|
1
|
82 |
@echo " list_fixes - List the targets and files for which fixes are currently applied."
|
|
83 |
@echo " The fixes are applied by the make and removed by clean."
|
|
84 |
@echo " fix - Just apply the fixes. Don't build."
|
|
85 |
@echo " diff [file=FILE] - List the diffs that are generated by applying the fixups."
|
|
86 |
@echo " The diffs are written to FILE, if specified, else to ./diffs.patch."
|
0
|
87 |
@echo ""
|
|
88 |
@echo "Real targets in hierarchy:"
|
|
89 |
@echo ""
|
|
90 |
@for file in $(sort $(garage_makefiles)); do \
|
1
|
91 |
dummy=`grep '^include $$(EPOCROOT)/build/makefiles-garage/todo.mk' $$file 2> /dev/null`;\
|
0
|
92 |
todo=;\
|
|
93 |
file=$${file#$(garage)/};\
|
|
94 |
file=$${file%/Makefile};\
|
|
95 |
targ=$${file##*/};\
|
|
96 |
file=$${file%/*};\
|
|
97 |
file=$${file%$${targ}};\
|
|
98 |
file=`echo $$file | sed -e 's|/||g' -`;\
|
|
99 |
file=$${file//?/-};\
|
|
100 |
if [ "$${dummy}" != "" ]; then todo=' ### TODO ###'; fi; \
|
|
101 |
echo " $$file$$targ$$todo";\
|
|
102 |
done
|
|
103 |
|
|
104 |
$(makefiles): $(EPOCROOT)/build/%: $(garage)/%
|
|
105 |
mkdir -p $(dir $@) && cp $< $@
|
|
106 |
|
|
107 |
deploy_makefiles: $(makefiles)
|
|
108 |
|
|
109 |
gather_makefiles:
|
|
110 |
for dir in $(subdirs); do \
|
|
111 |
grep --include Makefile -r -e 'include $$(EPOCROOT)/build/makefiles-garage/global-make-env.mk' $$dir | \
|
|
112 |
sed -e 's|:include $$(EPOCROOT)/build/makefiles-garage/global-make-env.mk||g' -e 's|$(EPOCROOT)/build/||g' - | while read makefile; do \
|
|
113 |
if [ ! -f $(garage)/$$makefile ]; then \
|
|
114 |
echo "### Garaging new makefile $(garage)/$$makefile ###" ;\
|
|
115 |
cp -f --parents $$makefile $(garage); \
|
|
116 |
else if [ $(EPOCROOT)/build/$$makefile -nt $(garage)/$$makefile ]; then \
|
|
117 |
if [ "`diff $(EPOCROOT)/build/$$makefile $(garage)/$$makefile`" != "" ]; then \
|
|
118 |
echo "### Updating garaged makefile $(garage)/$$makefile ###" ;\
|
|
119 |
cp -f --parents $$makefile $(garage); \
|
|
120 |
fi; \
|
|
121 |
fi; \
|
|
122 |
fi; \
|
|
123 |
done; \
|
|
124 |
done
|
|
125 |
|
|
126 |
sbs_comp_list:
|
|
127 |
@for file in `find . -iname 'bld.inf'`; do echo $${file}; done
|
|
128 |
|
|
129 |
sbs_targ_list:
|
|
130 |
@for file in `find . -iname '*.mmp'`; do echo $${file}; done
|
|
131 |
|
1
|
132 |
list_fixes: $(makefiles)
|
0
|
133 |
@for make_dir in $(sort $(make_dirs)); do \
|
1
|
134 |
$(MAKE) -s -C $$make_dir call_in=1 targ=$${make_dir##*/} _list_fixes; \
|
0
|
135 |
done
|
|
136 |
|
|
137 |
list_prereqs: $(makefiles)
|
|
138 |
@for make_dir in $(sort $(make_dirs)); do \
|
1
|
139 |
$(MAKE) -s -C $$make_dir call_in=1 targ=$${make_dir##*/} _list_prereqs; \
|
|
140 |
done
|
|
141 |
|
|
142 |
fix: $(makefiles)
|
|
143 |
@for make_dir in $(sort $(make_dirs)); do \
|
|
144 |
$(MAKE) -C $$make_dir call_in=1 fixes; \
|
|
145 |
done
|
|
146 |
|
|
147 |
what: $(makefiles)
|
|
148 |
@for make_dir in $(sort $(make_dirs)); do \
|
|
149 |
$(MAKE) -s -C $$make_dir call_in=1 targ=$${make_dir##*/} _what; \
|
0
|
150 |
done
|
|
151 |
|
1
|
152 |
missing: $(makefiles)
|
|
153 |
@for make_dir in $(sort $(make_dirs)); do \
|
|
154 |
$(MAKE) -s -C $$make_dir call_in=1 targ=$${make_dir##*/} _missing; \
|
|
155 |
done
|
|
156 |
|
|
157 |
diff:
|
|
158 |
$(MAKE) distclean && \
|
|
159 |
rm -fr ../pristine && \
|
|
160 |
mkdir ../pristine && \
|
|
161 |
cp -r -t ../pristine * && \
|
|
162 |
$(MAKE) fix && \
|
|
163 |
diff -r -b ../pristine ../build > $(file)
|
|
164 |
for file in `find bintools/rcomp -name '*.CPP.original' -or -name '*.H.original' -or -name '*.LEX.original' -or -name '*.YACC.original'`; do \
|
|
165 |
lcfile=$$(file%\.original) && \
|
|
166 |
lcfile=`echo $$lcile | tr '[:upper:]' '[:lower:]'` && \
|
|
167 |
diff -r -b $$file $$lcfile >> $(file); \
|
|
168 |
done
|
|
169 |
|
0
|
170 |
$(targets): $(preinclude) $(makefiles)
|
|
171 |
garage_makedir=`find $(garage) -name $@`;\
|
|
172 |
makedir=$${garage_makedir##$(garage)/};\
|
|
173 |
makedir=$(EPOCROOT)/build/$${makedir};\
|
|
174 |
$(MAKE) -C $${makedir}
|
|
175 |
|
|
176 |
$(clean_targets): $(makefiles)
|
|
177 |
targ=$@; \
|
|
178 |
targ=$${targ%-clean}; \
|
|
179 |
garage_makedir=`find $(garage) -name $${targ}`;\
|
1
|
180 |
if [ "$$garage_makedir" != "" ]; then \
|
|
181 |
makedir=$${garage_makedir##$(garage)/};\
|
|
182 |
makedir=$(EPOCROOT)/build/$${makedir};\
|
|
183 |
$(MAKE) -C $${makedir} clean; \
|
|
184 |
fi
|
|
185 |
|
0
|
186 |
|
1
|
187 |
$(what_targets): $(makefiles)
|
|
188 |
@targ=$@; \
|
|
189 |
targ=$${targ%-what}; \
|
|
190 |
garage_makedir=`find $(garage) -name $${targ}`;\
|
|
191 |
if [ "$$garage_makedir" != "" ]; then \
|
|
192 |
makedir=$${garage_makedir##$(garage)/};\
|
|
193 |
makedir=$(EPOCROOT)/build/$${makedir};\
|
|
194 |
$(MAKE) -C $${makedir} call_in=1 targ=$${make_dir##*/} what; \
|
|
195 |
fi
|
|
196 |
|