Add rules to build *_r.c files. All compiled lib/*_r.c files will be included in libltp_r.a library. testcases_r.mk can be used in multi-threaded tests.
Signed-off-by: Alexey Kodanev <[email protected]> --- include/mk/lib.mk | 15 ++++++++++++++- include/mk/testcases_r.mk | 29 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletions(-) create mode 100644 include/mk/testcases_r.mk diff --git a/include/mk/lib.mk b/include/mk/lib.mk index 456db24..3bec31c 100644 --- a/include/mk/lib.mk +++ b/include/mk/lib.mk @@ -20,6 +20,7 @@ # Garrett Cooper, July 2009 # # Copyright (C) Cyril Hrubis <[email protected]> 2012 +# Copyright (C) 2014 Oracle and/or its affiliates. All Rights Reserved. # # Makefile to include for libraries. @@ -46,7 +47,7 @@ ifneq ($(MAKECMDGOALS),install) LIB ?= $(INTERNAL_LIB) endif -MAKE_TARGETS += $(LIB) +MAKE_TARGETS += $(LIB) $(LIB_R) LIBSRCS ?= $(wildcard $(abs_srcdir)/*.c) @@ -60,7 +61,11 @@ LIBSRCS := $(subst $(abs_srcdir)/,,$(wildcard $(LIBSRCS))) LIBSRCS := $(filter-out $(FILTER_OUT_LIBSRCS),$(LIBSRCS)) +LIBSRCS_R := $(filter %_r.c,$(LIBSRCS)) +LIBSRCS := $(filter-out %_r.c,$(LIBSRCS)) + LIBOBJS := $(LIBSRCS:.c=.o) +LIBOBJS_R := $(LIBSRCS_R:.c=.o) $(LIB): $(notdir $(LIBOBJS)) if [ -z "$(strip $^)" ] ; then \ @@ -70,4 +75,12 @@ $(LIB): $(notdir $(LIBOBJS)) $(if $(AR),$(AR),ar) -rc "$@" $^ $(if $(RANLIB),$(RANLIB),ranlib) "$@" +$(LIB_R): $(notdir $(LIBOBJS_R)) + if [ -z "$(strip $^)" ] ; then \ + echo "Cowardly refusing to create empty archive"; \ + exit 1; \ + fi + $(if $(AR),$(AR),ar) -rc "$@" $^ + $(if $(RANLIB),$(RANLIB),ranlib) "$@" + include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/include/mk/testcases_r.mk b/include/mk/testcases_r.mk new file mode 100644 index 0000000..49db8a5 --- /dev/null +++ b/include/mk/testcases_r.mk @@ -0,0 +1,29 @@ +# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Author: Alexey Kodanev <[email protected]> +# +# For inclusion in multi-threaded test-cases +# + +include $(top_srcdir)/include/mk/env_pre.mk +include $(top_srcdir)/include/mk/functions.mk + +# Link static libltp_r before libltp because it has unresolved symbols +# defined in libltp +LDLIBS += -lltp_r -pthread + +include $(top_srcdir)/include/mk/testcases.mk -- 1.7.1 ------------------------------------------------------------------------------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
