# kernel_MODULES .. list of the kernel side modules/applications
# rtlinux_MODULES .. list of RT-Linux the kernel side modules/applications
# xxx_SOURCES .. list of specific target sources
-# xxx_LIBS .. list of specific target libraries (-l prefix is automatically added)
-# xxx_LDFLAGS .. list of specific target LDFLAGS
+# xxx_CFLAGS .. custom CFLAGS for .c modules of target xxx (in addition to CFLAGS)
+# xxx_CXXFLAGS .. custom CXXFLAGS for .cpp/.cxx modules of target xxx (in addition to CXXFLAGS)
+# xxx_ASFLAGS .. custom ASFLAGS for .S modules of target xxx (in addition to ASFLAGS)
+# xxx_LIBS .. custom libraries for target xxx (in addition to LIBS)
- # xxx_DLFLAGS .. custom LDFLAGS for target xxx (in addition to LDFLAGS)
++# xxx_LDFLAGS .. custom LDFLAGS for target xxx (in addition to LDFLAGS)
# lib_LOADLIBES .. list of libraries linked to each executable
# INCLUDES .. additional include directories and defines for user-space
# kernel_INCLUDES .. additional include directories and defines for kernel-space
SOLIB_OBJS += $$($(1)_OBJSLO)
SOLIB_SOURCES += $$($(1)_SOURCES)
+$(foreach src,$(filter %.c,$($(1)_SOURCES)$($(1)_GEN_SOURCES)),$(eval $(call COMPILE_c_o_template,$(SOURCES_DIR)/$(src),$(src:%.c=%-$(1).lo),$(SOLIB_PICFLAGS) $($(1)_CPPFLAGS) $($(1)_CFLAGS))))
+
+$(foreach src,$(filter %.cc,$($(1)_SOURCES)$($(1)_GEN_SOURCES)),$(eval $(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cc=%-$(1).lo),$(SOLIB_PICFLAGS) $($(1)_CPPFLAGS) $($(1)_CXXFLAGS))))
+
+$(foreach src,$(filter %.cxx,$($(1)_SOURCES)$($(1)_GEN_SOURCES)),$(eval $(call COMPILE_cc_o_template,$(SOURCES_DIR)/$(src),$(src:%.cxx=%-$(1).lo),$(SOLIB_PICFLAGS) $($(1)_CPPFLAGS) $($(1)_CXXFLAGS))))
+
+$(foreach src,$(filter %.S,$($(1)_SOURCES)$($(1)_GEN_SOURCES)),$(eval $(call COMPILE_S_o_template,$(SOURCES_DIR)/$(src),$(src:%.S=%-$(1).lo),$(SOLIB_PICFLAGS) $($(1)_ASFLAGS))))
+
$(OMK_WORK_DIR)/lib$(1).$(SOLIB_EXT).omkvar: $$($(1)_OBJSLO) FORCE
- $(Q)echo '$(1)_objslo += $$$$(addprefix $(USER_OBJS_DIR)/,$$($(1)_OBJSLO))' > $$@.tmp; \
+ $(Q)echo '$(1)_OBJSLO += $$$$(addprefix $(USER_OBJS_DIR)/,$$($(1)_OBJSLO))' > $$@.tmp; \
echo '$(1)_libs += $$($(1)_LIBS) $$(lib_LOADLIBES)' >> $$@.tmp; \
+ echo '$(1)_ldflags += $$($(1)_LDFLAGS) $$(lib_LDFLAGS)' >> $$@.tmp; \
echo 'shared_libs := $$$$(sort $(1) $$$$(shared_libs))' >> $$@.tmp; \
if cmp -s $$@.tmp $$@; then rm $$@.tmp; else mv $$@.tmp $$@; fi
endef