]> rtime.felk.cvut.cz Git - omk.git/blob - snippets/rtems.omk
Convert clean pass to "double-colon rules"
[omk.git] / snippets / rtems.omk
1 #                   This version is adapted for RTEMS build
2 #
3 #
4 # lib_LIBRARIES    .. list of the user-space libraries
5 # shared_LIBRARIES .. list of the user-space shared libraries
6 # include_HEADERS  .. list of the user-space public header files
7 # nobase_include_HEADERS .. public headers copied even with directory part
8 # renamed_include_HEADERS .. public headers copied to the different target name
9 # bin_PROGRAMS     .. list of the require binary programs
10 # utils_PROGRAMS   .. list of the development utility programs
11 # test_PROGRAMS    .. list of the test programs
12 # xxx_SOURCES      .. list of specific target sources
13 # xxx_LIBS         .. list of specific target libraries
14 # INCLUDES         .. additional include directories and defines for user-space
15 # tar_EMBEDFILES   .. list of tars with embedded files
16
17 include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
18 include $(RTEMS_CUSTOM)
19 include $(CONFIG.CC)
20
21 BUILD_DIR_NAME = _build/$(RTEMS_BSP)
22 COMPILED_DIR_NAME = _compiled/$(RTEMS_BSP)
23 GROUP_DIR_NAME =
24
25
26 USER_INCLUDE_DIR := $(MAKERULES_DIR)/$(COMPILED_DIR_NAME)/include
27 USER_LIB_DIR     := $(MAKERULES_DIR)/$(COMPILED_DIR_NAME)/lib
28 USER_UTILS_DIR   := $(MAKERULES_DIR)/$(COMPILED_DIR_NAME)/bin-utils
29 USER_TESTS_DIR   := $(MAKERULES_DIR)/$(COMPILED_DIR_NAME)/bin-tests
30 USER_BIN_DIR     := $(MAKERULES_DIR)/$(COMPILED_DIR_NAME)/bin
31 USER_BUILD_DIR   := $(MAKERULES_DIR)/$(BUILD_DIR_NAME)/user
32
33 LOCAL_BUILD_DIR  = $(USER_OBJS_DIR)
34
35
36 DEFAULT_INCLUDES = -I $(PROJECT_INCLUDE)
37
38 CPPFLAGS  += -I $(USER_INCLUDE_DIR)
39
40 CPPFLAGS  += $(CONFIG_OMK_DEFINES)
41
42 #CPPFLAGS  += $(AM_CPPFLAGS)
43 #CFLAGS    += $(AM_CFLAGS)
44 #CXXFLAGS  += $(AM_CXXFLAGS)
45 #LDFLAGS   += $(CFLAGS) $(AM_CFLAGS) $(LD_PATHS:%=-L%)
46
47 LOADLIBES += -L$(USER_LIB_DIR)
48
49 LOADLIBES += $(lib_LOADLIBES:%=-l%)
50
51 SOLIB_PICFLAGS += -shared -fpic
52
53 ifndef RELATIVE_DIR
54 RELATIVE_DIR := $(SOURCES_DIR:$(MAKERULES_DIR)%=%)
55 endif
56 override RELATIVE_DIR := $(RELATIVE_DIR:/%=%)
57 override RELATIVE_DIR := $(RELATIVE_DIR:\\%=%)
58 #$(warning  RELATIVE_DIR $(RELATIVE_DIR))
59
60 #$(warning SOURCES_DIR = $(SOURCES_DIR))
61 #$(warning MAKERULES_DIR = $(MAKERULES_DIR))
62 #$(warning RELATIVE_DIR = $(RELATIVE_DIR))
63
64 #vpath %.c $(SOURCES_DIR)
65 #vpath %.cc $(SOURCES_DIR)
66 #vpath %.cxx $(SOURCES_DIR)
67
68 USER_OBJS_DIR = $(USER_BUILD_DIR)/$(RELATIVE_DIR)
69
70 .PHONY: check-dir
71
72 # Some support to serialize some targets for parallel make
73 ifneq ($(OMK_SERIALIZE_INCLUDED),y)
74 include-pass: check-dir
75 library-pass: include-pass
76 binary-pass: library-pass
77
78 override OMK_SERIALIZE_INCLUDED = y
79 MAKEOVERRIDES := $(filter-out OMK_SERIALIZE_INCLUDED=n,$(MAKEOVERRIDES))
80 endif
81
82 #=====================================================================
83 # Special rules for target filesystem and data preparation
84
85 # Syntax: $(call TARFILE_template,<filename>,<filename2>,<directory>) FIXME: Is this correct?
86 define TARFILE_template
87
88 .PHONY: $(2)
89
90 $(2):
91         $(Q) ABSOLUTETARFILE=`cd $$(dir $$@) ; pwd`/$$@ ; \
92              ( test -e $$$$ABSOLUTETARFILE && ( cd  $(3) && tar $$(TARFLAGS) -df $$$$ABSOLUTETARFILE ) ) || \
93              ( cd  $(3) && tar $$(TARFLAGS) -cf $$$$ABSOLUTETARFILE . )
94
95 $(2).o: $(2)
96         @$(QUIET_CMD_ECHO) "  TARFILE $$@"
97         $(Q) $(LD) -r --accept-unknown-input-arch -b binary -o $$@.tmp $$^
98         $(Q) $(OBJCOPY) --rename-section .data=.rodata,alloc,load,readonly,data,contents $$@.tmp $$@
99
100 endef
101
102 #=====================================================================
103 # User-space rules and templates to compile programs, libraries etc.
104
105 ifdef USER_RULE_TEMPLATES
106
107
108 #%.lo: %.c
109 #       $(CC) -o $@ $(LCFLAGS) -c $<
110
111 c_o_COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) \
112         $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(INCLUDES) -DOMK_FOR_USER
113
114 cc_o_COMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) \
115         $(CPPFLAGS) $(AM_CXXFLAGS) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) -DOMK_FOR_USER
116
117 S_o_COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
118         $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASFLAGS) -DOMK_FOR_USER
119
120 # Check GCC version for user build
121 ifndef CC_MAJOR_VERSION
122 CC_MAJOR_VERSION := $(shell $(CC) -dumpversion | $(SED4OMK) -e 's/\([^.]\)\..*/\1/')
123 endif
124 # Prepare suitable define for dependency building
125 ifeq ($(CC_MAJOR_VERSION),2)
126 CC_DEPFLAGS = -Wp,-MD,"$@.d.tmp"
127 else
128 CC_DEPFLAGS = -MT $@ -MD -MP -MF "$@.d.tmp"
129 endif
130
131
132 # Syntax: $(call COMPILE_c_o_template,<source>,<target>,<additional c-flags>)
133 define COMPILE_c_o_template
134 $(2): $(1) $$(GEN_HEADERS)
135         @$(QUIET_CMD_ECHO) "  CC      $$@"
136         $(Q) if $$(c_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
137         then mv -f "$$@.d.tmp" "$$@.d" ; \
138         else rm -f "$$@.d.tmp" ; exit 1; \
139         fi
140 endef
141
142
143 # Syntax: $(call COMPILE_cc_o_template,<source>,<target>,<additional c-flags>)
144 define COMPILE_cc_o_template
145 $(2): $(1) $$(GEN_HEADERS)
146         @$(QUIET_CMD_ECHO) "  CXX     $$@"
147         $(Q) if $$(cc_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
148         then mv -f "$$@.d.tmp" "$$@.d" ; \
149         else rm -f "$$@.d.tmp" ; exit 1; \
150         fi
151 endef
152
153
154 # Syntax: $(call COMPILE_S_o_template,<source>,<target>,<additional c-flags>)
155 define COMPILE_S_o_template
156 $(2): $(1) $$(GEN_HEADERS)
157         @$(QUIET_CMD_ECHO) "  AS      $$@"
158         $(Q) if $$(S_o_COMPILE) -D__ASSEMBLY__ $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
159         then if [ -e "$$@.d.tmp" ] ; then mv -f "$$@.d.tmp" "$$@.d" ; fi ; \
160         else rm -f "$$@.d.tmp" ; exit 1; \
161         fi
162 endef
163
164 # Syntax: $(call CMETRIC_o_h_template,<object_file>,<target_header>)
165 define CMETRIC_o_h_template
166 $(2): $(1)
167         @$(QUIET_CMD_ECHO) "  CMETRIC $$@"
168         $(Q)if [ -n `dirname $$@` ] ; then \
169               if [ ! -e `dirname $$@` ] ; then \
170                 mkdir -p `dirname $$@` ; fi ; fi
171         $(Q)echo >$$@.tmp '/* Automatically generated from $$< */'
172         $(Q)echo >>$$@.tmp '/* Conditionals to control compilation */'
173 # Bellow, the tricks with redirection are for shells without set -o pipefail
174 # (see http://www.mail-archive.com/dash@vger.kernel.org/msg00149.html)
175         $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) $$<; echo $$$$? >&4; }\
176                 | $(SED4OMK) -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2cond_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
177                 | sort >>$$@.tmp` && exit $$$$status
178         $(Q)echo >>$$@.tmp '/* Defines from the values defined to symbols in hexadecimal format */'
179         $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) $$<; echo $$$$? >&4; }\
180                 | $(SED4OMK) -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2def_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
181                 | sort >>$$@.tmp` && exit $$$$status
182         $(Q)echo >>$$@.tmp '/* Defines from the values defined to symbols in decimal format */'
183         $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) -td $$<; echo $$$$? >&4; }\
184                 | $(SED4OMK) -n 's/^ *0*\(0\|[1-9][0-9]*\) *A *_cmetric2defdec_\([A-Za-z_0-9]*\) */#define \2 \1/p' \
185                 | sort >>$$@.tmp` && exit $$$$status
186         $(Q)mv $$@.tmp $$@
187 endef
188
189 idl_COMPILE = $(IDL_COMPILER)
190
191 define COMPILE_idl_template
192 $(2).c $(2)-stubs.c $(2)-skels.c $(2)-common.c $(2).h: $(1) $$(wildcard $$(firstword $$(idl_COMPILE)))
193         @$(QUIET_CMD_ECHO) "  IDL     $$@"
194         $(Q) $$(idl_COMPILE) $$($(2)_IDLFLAGS) $(1)
195 endef
196
197 # Syntax: $(call PROGRAM_template,<executable-name>,<dir>,<link-variant>)
198 define PROGRAM_template
199 USER_IDLS  += $$($(1)_SERVER_IDL) $$($(1)_CLIENT_IDL) $$($(1)_IDL)
200 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-skels.c))
201 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-common.c))
202 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-stubs.c))
203 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-common.c))
204 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_IDL:%.idl=%.c))
205 USER_GEN_SOURCES += $$($(1)_GEN_SOURCES)
206
207 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.c=%.o) $$($(1)_GEN_SOURCES:%.c=%.o))
208 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cc=%.o) $$($(1)_GEN_SOURCES:%.c=%.o))
209 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cxx=%.o) $$($(1)_GEN_SOURCES:%.c=%.o))
210 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.S=%.o) $$($(1)_GEN_SOURCES:%.c=%.o))
211 $(1)_OBJS += $$($(1)_EMBEDTARFILES:%=%_tarfile.o)
212 $(1)_OBJS := $$(sort $$($(1)_OBJS))
213
214 USER_OBJS  += $$($(1)_OBJS)
215 USER_SOURCES += $$($(1)_SOURCES)
216 USER_EMBEDTARFILES += $$($(1)_EMBEDTARFILES)
217
218 $(2)/$(1): $(USER_LIB_DIR)/timestamp
219 $(2)/$(1): $$($(1)_OBJS)
220         @$(QUIET_CMD_ECHO) "  LINK    $$@"
221         $(Q) $$(shell if [ -z "$$(filter %.cc,$$($(1)_SOURCES))" ] ; \
222           then echo $$(CC)  $$(CPPFLAGS) $$(AM_CPPFLAGS) $$(AM_CFLAGS) $$(CFLAGS) ; \
223           else echo $$(CXX) $$(CPPFLAGS) $$(AM_CPPFLAGS) $$(AM_CXXFLAGS) $$(CXXFLAGS) ; fi) \
224           $$(AM_LDFLAGS) $$(LDFLAGS) $$($(1)_OBJS) $$(LOADLIBES) $$($(1)_LIBS:%=-l%) \
225           -o $(2)/$(1)
226 #@echo "$(2)/$(1): \\" >$(USER_OBJS_DIR)/$(1).exe.d
227 #@$(SED4OMK) -n -e 's/^LOAD \(.*\)$$$$/  \1  \\/p' $(USER_OBJS_DIR)/$(1).exe.map  >>$(USER_OBJS_DIR)/$(1).exe.d
228 #@echo >>$(USER_OBJS_DIR)/$(1).exe.d
229 #-Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map
230 # FIXME: Why the map file was commented out?
231 endef
232
233
234
235 # Syntax: $(call LIBRARY_template,<library-name>)
236 define LIBRARY_template
237 USER_IDLS  += $$($(1)_SERVER_IDL) $$($(1)_CLIENT_IDL) $$($(1)_IDL)
238 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-skels.c))
239 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-common.c))
240 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-stubs.c))
241 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-common.c))
242 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_IDL:%.idl=%.c))
243 USER_GEN_SOURCES += $$($(1)_GEN_SOURCES)
244
245 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.c=%.o) $$($(1)_GEN_SOURCES:%.c=%.o))
246 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cc=%.o) $$($(1)_GEN_SOURCES:%.c=%.o))
247 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.cxx=%.o) $$($(1)_GEN_SOURCES:%.c=%.o))
248 $(1)_OBJS += $$(filter %.o,$$($(1)_SOURCES:%.S=%.o) $$($(1)_GEN_SOURCES:%.c=%.o))
249 $(1)_OBJS += $$($(1)_EMBEDTARFILES:%=%_tarfile.o)
250 $(1)_OBJS := $$(sort $$($(1)_OBJS))
251
252 USER_OBJS  += $$($(1)_OBJS)
253 USER_SOURCES += $$($(1)_SOURCES)
254 USER_EMBEDTARFILES += $$($(1)_EMBEDTARFILES)
255
256 $(USER_LIB_DIR)/lib$(1).a: $$($(1)_OBJS)
257         @$(QUIET_CMD_ECHO) "  AR      $$@"
258         $(Q) $(AR) rcs $$@ $$^
259         @touch $(USER_LIB_DIR)/timestamp
260 endef
261
262 $(USER_LIB_DIR)/timestamp:
263         $(Q)touch $@
264
265 # Syntax: $(call SOLIB_template,<library-name>)
266 define SOLIB_template
267 USER_IDLS  += $$($(1)_SERVER_IDL) $$($(1)_CLIENT_IDL) $$($(1)_IDL)
268 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-skels.c))
269 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_SERVER_IDL:%.idl=%-common.c))
270 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-stubs.c))
271 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_CLIENT_IDL:%.idl=%-common.c))
272 $(1)_GEN_SOURCES += $$(filter %.c,$$($(1)_IDL:%.idl=%.c))
273 SOLIB_GEN_SOURCES += $$($(1)_GEN_SOURCES)
274
275 $(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.c=%.lo) $$($(1)_GEN_SOURCES:%.c=%.lo))
276 $(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.cc=%.lo) $$($(1)_GEN_SOURCES:%.c=%.lo))
277 $(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.cxx=%.lo) $$($(1)_GEN_SOURCES:%.c=%.lo))
278 $(1)_OBJSLO += $$(filter %.lo,$$($(1)_SOURCES:%.S=%.lo) $$($(1)_GEN_SOURCES:%.c=%.lo))
279 $(1)_OBJS += $$($(1)_EMBEDTARFILES:%=%_tarfile.o)
280 $(1)_OBJSLO := $$(sort $$($(1)_OBJSLO))
281
282 SOLIB_OBJS  += $$($(1)_OBJSLO)
283 SOLIB_SOURCES += $$($(1)_SOURCES)
284 USER_EMBEDTARFILES += $$($(1)_EMBEDTARFILES)
285
286 $(USER_LIB_DIR)/lib$(1).so: $$($(1)_OBJSLO)
287         @$(QUIET_CMD_ECHO) "  LINK    $$@"
288         $(Q) $(LD) --shared --soname=lib$(1).so -o $$@ $$^
289 endef
290
291
292
293 library-pass-local: $(addprefix $(USER_INCLUDE_DIR)/,$(cmetric_include_HEADERS)) \
294                     $(lib_LIBRARIES:%=$(USER_LIB_DIR)/lib%.a) $(shared_LIBRARIES:%=$(USER_LIB_DIR)/lib%.so)
295
296 binary-pass-local: $(bin_PROGRAMS:%=$(USER_BIN_DIR)/%) $(utils_PROGRAMS:%=$(USER_UTILS_DIR)/%) $(test_PROGRAMS:%=$(USER_TESTS_DIR)/%)
297
298 # Special rules for CMETRIC generated headers
299
300 $(foreach cmetrh,$(cmetric_include_HEADERS),$(eval $(call COMPILE_c_o_template,\
301                 $(SOURCES_DIR)/$($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES),\
302                 $($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES:%.c=%.o),)))
303 $(foreach cmetrh,$(cmetric_include_HEADERS),$(eval $(call CMETRIC_o_h_template,\
304                 $($(basename $(notdir $(cmetrh)))_CMETRIC_SOURCES:%.c=%.o),\
305                 $(addprefix $(USER_INCLUDE_DIR)/,$(cmetrh)))))
306
307 GEN_HEADERS+=$(cmetric_include_HEADERS:%=$(USER_INCLUDE_DIR)/%)
308 GEN_HEADERS+=$(filter %.h,$(USER_IDLS:%.idl=%.h))
309
310 # Generate rules for compilation of programs and libraries
311
312 $(foreach prog,$(utils_PROGRAMS),$(eval $(call PROGRAM_template,$(prog),$(USER_UTILS_DIR))))
313
314 $(foreach prog,$(test_PROGRAMS),$(eval $(call PROGRAM_template,$(prog),$(USER_TESTS_DIR))))
315
316 $(foreach prog,$(bin_PROGRAMS),$(eval $(call PROGRAM_template,$(prog),$(USER_BIN_DIR))))
317
318 $(foreach lib,$(lib_LIBRARIES),$(eval $(call LIBRARY_template,$(lib))))
319
320 $(foreach lib,$(shared_LIBRARIES),$(eval $(call SOLIB_template,$(lib))))
321
322 # IDL compilation
323 USER_IDLS := $(sort $(USER_IDLS))
324 $(foreach src,$(filter %.idl,$(USER_IDLS)),$(eval $(call COMPILE_idl_template,$(SOURCES_DIR)/$(src),$(src:%.idl=%))))
325
326
327 -include $(USER_OBJS_DIR)/*.d
328
329 endif
330
331 #=====================================================================
332
333
334 $(eval $(call omk_pass_template, include-pass,$(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(include_HEADERS)$(nobase_include_HEADERS)$(renamed_include_HEADERS)$(config_include_HEADERS)$(LOCAL_CONFIG_H)))
335 $(eval $(call omk_pass_template, library-pass,$(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(lib_LIBRARIES)$(shared_LIBRARIES)))
336 $(eval $(call omk_pass_template, binary-pass, $(USER_OBJS_DIR),USER_RULE_TEMPLATES=y,$(bin_PROGRAMS)$(utils_PROGRAMS)$(test_PROGRAMS)))
337
338 $(eval $(call omk_pass_template,clean,$(USER_OBJS_DIR),,always))
339
340 check-dir::
341         @$(call mkdir_def,$(USER_INCLUDE_DIR))
342         @$(call mkdir_def,$(USER_LIB_DIR))
343         @$(call mkdir_def,$(USER_BIN_DIR))
344         @$(call mkdir_def,$(USER_UTILS_DIR))
345         @$(call mkdir_def,$(USER_TESTS_DIR))
346
347 $(eval $(call include-pass-template,$(USER_INCLUDE_DIR),include))
348
349 ifdef USER_RULE_TEMPLATES
350
351 # User-space static libraries and applications object files
352
353 USER_SOURCES := $(sort $(USER_SOURCES))
354 USER_GEN_SOURCES := $(sort $(USER_GEN_SOURCES))
355
356 #$(warning USER_SOURCES = $(USER_SOURCES))
357
358 $(foreach src,$(filter %.c,$(USER_SOURCES)),$(eval $(call COMPILE_c_o_template,$(SOURCES_DIR)/$(src),$(src:%.c=%.o),)))
359
360 $(foreach src,$(filter %.cc,$(USER_SOURCES)),$(eval $(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cc=%.o),)))
361
362 $(foreach src,$(filter %.cxx,$(USER_SOURCES)),$(eval $(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cxx=%.o),)))
363
364 $(foreach src,$(filter %.S,$(USER_SOURCES)),$(eval $(call COMPILE_S_o_template,$(SOURCES_DIR)/$(src),$(src:%.S=%.o),)))
365
366 $(foreach src,$(filter %.c,$(USER_GEN_SOURCES)),$(eval $(call COMPILE_c_o_template,$(src),$(src:%.c=%.o),)))
367
368 # User-space shared libraries object files
369
370 SOLIB_SOURCES := $(sort $(SOLIB_SOURCES))
371
372 #$(warning SOLIB_SOURCES = $(SOLIB_SOURCES))
373
374 $(foreach src,$(filter %.c,$(SOLIB_SOURCES)),$(eval $(call COMPILE_c_o_template,$(SOURCES_DIR)/$(src),$(src:%.c=%.lo),$(SOLIB_PICFLAGS))))
375
376 $(foreach src,$(filter %.cc,$(SOLIB_SOURCES)),$(eval $(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cc=%.lo),$(SOLIB_PICFLAGS))))
377
378 $(foreach src,$(filter %.cxx,$(SOLIB_SOURCES)),$(eval $(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cxx=%.lo),$(SOLIB_PICFLAGS))))
379
380 $(foreach src,$(filter %.S,$(SOLIB_SOURCES)),$(eval $(call COMPILE_S_o_template,$(SOURCES_DIR)/$(src),$(src:%.S=%.lo),$(SOLIB_PICFLAGS))))
381
382 $(foreach tarfile,$(USER_EMBEDTARFILES),$(eval $(call TARFILE_template,$(tarfile),$(tarfile)_tarfile,$(SOURCES_DIR)/$(tarfile))))
383
384 endif
385
386
387 clean-local::
388         @echo Cleaning in $(USER_OBJS_DIR)
389         @rm -f $(USER_OBJS_DIR)/*.o $(USER_OBJS_DIR)/*.lo \
390                $(USER_OBJS_DIR)/*.d \
391                $(USER_OBJS_DIR)/*.map \
392                $(LOCAL_CONFIG_H:%=$(USER_OBJS_DIR)/%) \
393                $(tar_EMBEDFILES:%=$(USER_OBJS_DIR)/%_tarfile)
394
395
396 default: include-pass library-pass binary-pass
397
398 include-pass-submakes: extra-rules-subdirs
399
400 # We must go to EXTRA_RULES_SUBDIRS before going to any other
401 # directory, since the executables compiled in EXTRA_RULES_SUBDIRS
402 # might be needed there.
403 include-pass-this-dir $(foreach subdir,$(SUBDIRS),include-pass-$(subdir)-subdir): extra-rules-subdirs