|
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 |
|
29 garage = $(EPOCROOT)/build/makefiles-garage |
|
30 garage_makefiles = $(shell find $(garage) -name Makefile) |
|
31 targets = $(notdir $(patsubst %/Makefile,%,$(garage_makefiles))) |
|
32 clean_targets = $(addsuffix -clean,$(targets)) |
|
33 garage_make_dirs = $(patsubst %/Makefile,%,$(garage_makefiles)) |
|
34 make_dirs = $(patsubst $(garage)%,$(EPOCROOT)/build%,$(garage_make_dirs)) |
|
35 makefiles = $(patsubst $(garage)/%,$(EPOCROOT)/build/%,$(garage_makefiles)) |
|
36 raptor_linux_binaries = $(EPOCROOT)/build/sbsv2/raptor/linux-* |
|
37 new_subdirs = $(EPOCROOT)/build/imgtools/romtools/r_t_areaset |
|
38 subdirs = imgtools e32tools sbsv2 srctools buildframework buildtoolguides bintools |
|
39 |
|
40 .PHONY: all tools export gen_preinclude clean distclean deploy_makefiles gather_makefiles help \ |
|
41 sbs_comp_list sbs_targ_list list_hacks list_prereqs |
|
42 |
|
43 all: tools |
|
44 |
|
45 tools: $(preinclude) $(makefiles) |
|
46 for dir in $(subdirs); do $(MAKE) -C $$dir; done |
|
47 |
|
48 |
|
49 #export: tools |
|
50 # for dir in $(subdirs); do $(MAKE) -C $$dir export; done |
|
51 |
|
52 clean: $(makefiles) |
|
53 for dir in $(subdirs); do $(MAKE) -C $$dir clean; done |
|
54 |
|
55 distclean: clean |
|
56 rm -f -r $(makefiles) $($(preinclude) $(linux_gcc_defs_inc) $(raptor_linux_binaries) $(new_subdirs) |
|
57 |
|
58 help: |
|
59 @echo "Build the Symbian build tools by conventional GNU/Linux means." |
|
60 @echo "PHONY targets:" |
|
61 @echo "" |
|
62 @echo " help" |
|
63 @echo " all - Build all real targets (default)" |
|
64 @echo " clean - Remove all build object files, libraries and executables" |
|
65 @echo " TARGET-clean - clean the real target TARGET" |
|
66 @echo " distclean - Remove everything but the original files" |
|
67 @echo " deploy_makefiles - Copy makefiles from the garage to the locations where they run" |
|
68 @echo " gather_makefiles - Gather any new or updated makefiles from the places where they run into the garage" |
|
69 @echo " export - TODO: No exports are implemented yet" |
|
70 @echo " what - TODO: \"What is built?\" not implemented yet" |
|
71 @echo " TARGET-what - TODO: \"What is built for TARGET?\" not implemented yet" |
|
72 @echo " sbs_comp_list - List the components that sbs would find (BLD.INF files)" |
|
73 @echo " sbs_targ_list - List the targets that sbs would find (MMP files)" |
|
74 @echo " list_prereqs - List the dependency graph of final targets" |
|
75 @echo " list_hacks - List the targets and files for which hacks are currently applied." |
|
76 @echo " The hacks are applied by the make and removed by clean." |
|
77 @echo "" |
|
78 @echo "Real targets in hierarchy:" |
|
79 @echo "" |
|
80 @for file in $(sort $(garage_makefiles)); do \ |
|
81 dummy=`grep 'include $$(EPOCROOT)/build/makefiles-garage/todo.mk' $$file 2> /dev/null`;\ |
|
82 todo=;\ |
|
83 file=$${file#$(garage)/};\ |
|
84 file=$${file%/Makefile};\ |
|
85 targ=$${file##*/};\ |
|
86 file=$${file%/*};\ |
|
87 file=$${file%$${targ}};\ |
|
88 file=`echo $$file | sed -e 's|/||g' -`;\ |
|
89 file=$${file//?/-};\ |
|
90 if [ "$${dummy}" != "" ]; then todo=' ### TODO ###'; fi; \ |
|
91 echo " $$file$$targ$$todo";\ |
|
92 done |
|
93 |
|
94 $(makefiles): $(EPOCROOT)/build/%: $(garage)/% |
|
95 mkdir -p $(dir $@) && cp $< $@ |
|
96 |
|
97 deploy_makefiles: $(makefiles) |
|
98 |
|
99 gather_makefiles: |
|
100 for dir in $(subdirs); do \ |
|
101 grep --include Makefile -r -e 'include $$(EPOCROOT)/build/makefiles-garage/global-make-env.mk' $$dir | \ |
|
102 sed -e 's|:include $$(EPOCROOT)/build/makefiles-garage/global-make-env.mk||g' -e 's|$(EPOCROOT)/build/||g' - | while read makefile; do \ |
|
103 if [ ! -f $(garage)/$$makefile ]; then \ |
|
104 echo "### Garaging new makefile $(garage)/$$makefile ###" ;\ |
|
105 cp -f --parents $$makefile $(garage); \ |
|
106 else if [ $(EPOCROOT)/build/$$makefile -nt $(garage)/$$makefile ]; then \ |
|
107 if [ "`diff $(EPOCROOT)/build/$$makefile $(garage)/$$makefile`" != "" ]; then \ |
|
108 echo "### Updating garaged makefile $(garage)/$$makefile ###" ;\ |
|
109 cp -f --parents $$makefile $(garage); \ |
|
110 fi; \ |
|
111 fi; \ |
|
112 fi; \ |
|
113 done; \ |
|
114 done |
|
115 |
|
116 sbs_comp_list: |
|
117 @for file in `find . -iname 'bld.inf'`; do echo $${file}; done |
|
118 |
|
119 sbs_targ_list: |
|
120 @for file in `find . -iname '*.mmp'`; do echo $${file}; done |
|
121 |
|
122 list_hacks: $(makefiles) |
|
123 @for make_dir in $(sort $(make_dirs)); do \ |
|
124 $(MAKE) -s -C $$make_dir query=1 targ=$${make_dir##*/} hacks; \ |
|
125 done |
|
126 |
|
127 list_prereqs: $(makefiles) |
|
128 @for make_dir in $(sort $(make_dirs)); do \ |
|
129 $(MAKE) -s -C $$make_dir query=1 targ=$${make_dir##*/} prereqs; \ |
|
130 done |
|
131 |
|
132 $(targets): $(preinclude) $(makefiles) |
|
133 garage_makedir=`find $(garage) -name $@`;\ |
|
134 makedir=$${garage_makedir##$(garage)/};\ |
|
135 makedir=$(EPOCROOT)/build/$${makedir};\ |
|
136 $(MAKE) -C $${makedir} |
|
137 |
|
138 $(clean_targets): $(makefiles) |
|
139 targ=$@; \ |
|
140 targ=$${targ%-clean}; \ |
|
141 garage_makedir=`find $(garage) -name $${targ}`;\ |
|
142 echo $$targ; \ |
|
143 makedir=$${garage_makedir##$(garage)/};\ |
|
144 makedir=$(EPOCROOT)/build/$${makedir};\ |
|
145 $(MAKE) -C $${makedir} clean |
|
146 |