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 | 26 ++++++++++++++++++++++++++ lib/Makefile | 3 +++ 3 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..f3f2a76 --- /dev/null +++ b/include/mk/testcases_r.mk @@ -0,0 +1,26 @@ +# 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 +include $(top_srcdir)/include/mk/testcases.mk + +LDLIBS += -pthread -lltp_r diff --git a/lib/Makefile b/lib/Makefile index c92225c..3a0226c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -19,6 +19,8 @@ # # Garrett Cooper, July 2009 # +# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved. +# top_srcdir ?= .. @@ -31,6 +33,7 @@ CFLAGS += -I. FILTER_OUT_LIBSRCS := mount_utils.c LIB := libltp.a +LIB_R := libltp_r.a pc_file := $(DESTDIR)/$(datarootdir)/pkgconfig/ltp.pc -- 1.7.1 ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
