From: Michal Sojka Date: Fri, 22 May 2009 12:01:09 +0000 (+0200) Subject: Updated Makefile.rules to support xxx_LDFLAGS X-Git-Tag: frescor-review~12 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/demo.git/commitdiff_plain/f765dd4ebe7d32249dff7703019ac3483ef21e3a Updated Makefile.rules to support xxx_LDFLAGS --- diff --git a/build/Makefile.rules b/build/Makefile.rules index 0db5dab..045b3c9 100644 --- a/build/Makefile.rules +++ b/build/Makefile.rules @@ -4,7 +4,7 @@ # (C) Copyright 2006 by Michal Sojka - Czech Technical University, FEE, DCE # # Homepage: http://rtime.felk.cvut.cz/omk/ -# Version: 0.1-83-g11801ce +# Version: 0.1-84-g20d0e16 # # The OMK build system is distributed under the GNU General Public # License. See file COPYING for details. @@ -35,7 +35,8 @@ # 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 +# xxx_LIBS .. list of specific target libraries (-l prefix is automatically added) +# xxx_LDFLAGS .. list of specific target 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 @@ -618,7 +619,7 @@ USER_SOURCES += $$($(1)_SOURCES) $(2)/$(1)$(3): $$($(1)_OBJS) @$(QUIET_CMD_ECHO) " LINK $$@" $(Q) $$(if $$(filter %.cc,$$($(1)_SOURCES:%.cxx=%.cc)),$$(CXX),$$(CC)) \ - $$($(1)_OBJS) $$($(1)_LIBS:%=-l%) $$(LOADLIBES) $$(LDFLAGS) -Wl,-rpath-link,$(USER_LIB_DIR) -Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map -o $$@ + $$($(1)_OBJS) $$($(1)_LIBS:%=-l%) $$(LOADLIBES) $$(LDFLAGS) $$($(1)_LDFLAGS) -Wl,-rpath-link,$(USER_LIB_DIR) -Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map -o $$@ @echo "$(2)/$(1)$(3): \\" >$(USER_OBJS_DIR)/$(1).exe.d @sed -n -e 's|^LOAD \(.*\)$$$$| \1 \&|p' $(USER_OBJS_DIR)/$(1).exe.map|tr '&' '\134' >>$(USER_OBJS_DIR)/$(1).exe.d @echo >>$(USER_OBJS_DIR)/$(1).exe.d @@ -675,6 +676,7 @@ SOLIB_SOURCES += $$($(1)_SOURCES) $(OMK_WORK_DIR)/lib$(1).$(SOLIB_EXT).omkvar: $$($(1)_OBJSLO) FORCE $(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 @@ -725,7 +727,7 @@ $(1)_shared_libs = $$(patsubst %,$(USER_LIB_DIR)/lib%.$(SOLIB_EXT),$$(filter $$( #$$(warning $(1)_shared_libs = $$($(1)_shared_libs)) $(USER_LIB_DIR)/lib$(1).$(SOLIB_EXT): $$($(1)_shared_libs) $$($(1)_objslo) @$(QUIET_CMD_ECHO) " LINK $$@" - $(Q)$(CC) --shared -Xlinker -soname=lib$(1).$(SOLIB_EXT) -Wl,-Map,$(USER_OBJS_DIR)/lib$(1).$(SOLIB_EXT).map -o $$@ $$($(1)_objslo) $$(LOADLIBES) $$($(1)_libs:%=-l%) + $(Q)$(CC) --shared -Xlinker -soname=lib$(1).$(SOLIB_EXT) -Wl,-Map,$(USER_OBJS_DIR)/lib$(1).$(SOLIB_EXT).map -o $$@ $$($(1)_objslo) $$(LOADLIBES) $$($(1)_libs:%=-l%) $$(lib_ldflags) $$($(1)_ldflags) endef -include $(shell true; find $(USER_BUILD_DIR) -name 'lib*.omkvar') # `true' is a hack for MinGW