From patchwork Mon Jul 20 16:44:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Chikunov X-Patchwork-Id: 11674309 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5ACDA618 for ; Mon, 20 Jul 2020 16:45:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D09A20773 for ; Mon, 20 Jul 2020 16:45:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730670AbgGTQpA (ORCPT ); Mon, 20 Jul 2020 12:45:00 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:46606 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729192AbgGTQo5 (ORCPT ); Mon, 20 Jul 2020 12:44:57 -0400 Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id E273572CCDC; Mon, 20 Jul 2020 19:44:55 +0300 (MSK) Received: from beacon.altlinux.org (unknown [83.220.44.62]) by imap.altlinux.org (Postfix) with ESMTPSA id BDCC94A4AEE; Mon, 20 Jul 2020 19:44:55 +0300 (MSK) From: Vitaly Chikunov To: Steven Rostedt , linux-trace-devel@vger.kernel.org Cc: Vitaly Chikunov , "Dmitry V . Levin" Subject: [PATCH 1/2] Makefile: Fix CUNIT_INSTALLED test to work with make 4.3 and dash Date: Mon, 20 Jul 2020 19:44:52 +0300 Message-Id: <20200720164453.5161-1-vt@altlinux.org> X-Mailer: git-send-email 2.11.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org In GNU Make 4.3 there is backward incompatible change that there is no need to quote '#' in shell invocations anymore. If quoted, backslash character is passed into gcc making cunit (and vsock) tests fail to compile. Also, `echo -e' is replaced with `printf' to interpret '\n', because, on Debian dash's `echo' does not support `-e', thus having `-e' passed into test source making gcc fail to compile the test. make test error message: Makefile:342: *** CUnit framework not installed, cannot build unit tests. Stop. Signed-off-by: Vitaly Chikunov Cc: Dmitry V. Levin --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4b72a04..6b606da 100644 --- a/Makefile +++ b/Makefile @@ -86,6 +86,8 @@ plugin_traceevent_dir_SQ = $(subst ','\'',$(plugin_traceevent_dir)) plugin_tracecmd_dir_SQ = $(subst ','\'',$(plugin_tracecmd_dir)) python_dir_SQ = $(subst ','\'',$(python_dir)) +pound := \# + VAR_DIR = -DVAR_DIR="$(var_dir)" VAR_DIR_SQ = '$(subst ','\'',$(VAR_DIR))' var_dir_SQ = '$(subst ','\'',$(var_dir))' @@ -233,14 +235,14 @@ CFLAGS ?= -g -Wall CPPFLAGS ?= LDFLAGS ?= -VSOCK_DEFINED := $(shell if (echo "\#include " | $(CC) -E - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi) +VSOCK_DEFINED := $(shell if (echo "$(pound)include " | $(CC) -E - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi) export VSOCK_DEFINED ifeq ($(VSOCK_DEFINED), 1) CFLAGS += -DVSOCK endif -CUNIT_INSTALLED := $(shell if (echo -e "\#include \n void main(){CU_initialize_registry();}" | $(CC) -x c -lcunit - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi) +CUNIT_INSTALLED := $(shell if (printf "$(pound)include \n void main(){CU_initialize_registry();}" | $(CC) -x c -lcunit - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi) export CUNIT_INSTALLED export CFLAGS From patchwork Mon Jul 20 16:44:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Chikunov X-Patchwork-Id: 11674311 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C3356138A for ; Mon, 20 Jul 2020 16:45:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4E992073A for ; Mon, 20 Jul 2020 16:45:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729192AbgGTQpC (ORCPT ); Mon, 20 Jul 2020 12:45:02 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:46652 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729219AbgGTQpB (ORCPT ); Mon, 20 Jul 2020 12:45:01 -0400 Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id 6AE7672CCF0; Mon, 20 Jul 2020 19:44:59 +0300 (MSK) Received: from beacon.altlinux.org (unknown [83.220.44.62]) by imap.altlinux.org (Postfix) with ESMTPSA id 465404A4AEE; Mon, 20 Jul 2020 19:44:59 +0300 (MSK) From: Vitaly Chikunov To: Steven Rostedt , linux-trace-devel@vger.kernel.org Cc: Vitaly Chikunov , "Dmitry V . Levin" Subject: [PATCH 2/2] Makefile: Fix build of utest on systems with --as-needed enabled Date: Mon, 20 Jul 2020 19:44:53 +0300 Message-Id: <20200720164453.5161-2-vt@altlinux.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200720164453.5161-1-vt@altlinux.org> References: <20200720164453.5161-1-vt@altlinux.org> Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org On systems (such as ALT Linux) where `--as-needed' is passed to ld by default, building tests fail due to CUNIT_INSTALLED test failure to link with libcunit, becasue `-lcunit' is passed before input file (which is `-'). Move `-lcunit' after '-' to link it properly. To reproduce `make CC='gcc -Wl,--as-needed' test`. Error message: Makefile:344: *** CUnit framework not installed, cannot build unit tests. Stop. Signed-off-by: Vitaly Chikunov Cc: Dmitry V. Levin --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6b606da..83e5646 100644 --- a/Makefile +++ b/Makefile @@ -242,7 +242,7 @@ ifeq ($(VSOCK_DEFINED), 1) CFLAGS += -DVSOCK endif -CUNIT_INSTALLED := $(shell if (printf "$(pound)include \n void main(){CU_initialize_registry();}" | $(CC) -x c -lcunit - >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi) +CUNIT_INSTALLED := $(shell if (printf "$(pound)include \n void main(){CU_initialize_registry();}" | $(CC) -x c - -lcunit >/dev/null 2>&1) ; then echo 1; else echo 0 ; fi) export CUNIT_INSTALLED export CFLAGS