From patchwork Tue Jul 18 02:53:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 9846687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE23260212 for ; Tue, 18 Jul 2017 02:53:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1FA726AE3 for ; Tue, 18 Jul 2017 02:53:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6E3226E1A; Tue, 18 Jul 2017 02:53:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5189126AE3 for ; Tue, 18 Jul 2017 02:53:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751461AbdGRCxQ (ORCPT ); Mon, 17 Jul 2017 22:53:16 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35352 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751041AbdGRCxP (ORCPT ); Mon, 17 Jul 2017 22:53:15 -0400 Received: by mail-pf0-f194.google.com with SMTP id q85so978156pfq.2 for ; Mon, 17 Jul 2017 19:53:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=X7f8Z+vOko2iBkfDZMJ5raSMFMahCF8vhtoxZL10/Gs=; b=mPTfPMR8KIjL0GpGCuOCN+GOXf5KMjpRvuJaulpI32/D3OgE+9cSv7ebDRXtxurMDI RpxDsM8Q4TNKnITVk6k5ABch3+C2aKkgIqVJWt9VrnXjEJ6hj3ZCpcckZp0sE51xU4Fj bcn9xXdv7jyUUMPojDbzGZprP53lVQgjjM4K8CBPzVCH4H0MJJ5zARE2svI4hJZS1nCs 9HXXMo17Bn5HftSa8n6iHz+IAL/My3RCduUFOhD7Mk476WMloKHUAWLoE6291TVOnNfP haozFCDbbAPhp1E/2kfAoTUi0qeLs3ppNSuqW28Sipnyt+7KPitW9OTMDTCdKlmLxciU pkUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=X7f8Z+vOko2iBkfDZMJ5raSMFMahCF8vhtoxZL10/Gs=; b=NTzcTWuP19r/dvTSXvVndjLaqTekO5M/TWjdyGwb6YxioxET9yPqPqXRZ9k+gnrUs3 9ssj6pOTtlIBo/BnvV6K/19rzl35VRSFFq+L4zfUGgze/xD8UwRQQCONYEdsyQPL21A/ YIrX9Sau5nyOltrjdJnw//xei+G6e1xWAHQaIJp4/sLHMbAsN4HpQNrwDIpnvBMsD0fO YMRZ7NQ5hEcjaTYLC8Cv/XS1q8cjlS4MXjUfx8BkeTbxOU3ECYE2g1un3XWR3jzbi2DT NLdDBId7x9s/fpbJKWL03wFXPIqndKDBFExxFksAoJiRw0z7zRmLabXXNkQisoeceRAE 4SBA== X-Gm-Message-State: AIVw112PlRmenlgAzVJ4HmNbZ4luOoAIGyWtkvgIGckCgZsDv4bsS3pc gfW5NM9vHowKKiAUlDc7YIZl5wDCmo4l X-Received: by 10.84.172.1 with SMTP id m1mr776437plb.174.1500346394596; Mon, 17 Jul 2017 19:53:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.149.130 with HTTP; Mon, 17 Jul 2017 19:53:14 -0700 (PDT) From: Christopher Li Date: Mon, 17 Jul 2017 22:53:14 -0400 X-Google-Sender-Auth: HfzsbB8J_NJdPvFu8n6-GGrtaMM Message-ID: Subject: [PATCH 1/4] V2 Makefile: clean up and simplify To: Linux-Sparse , Ramsay Jones Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - For invoke shell command, use immediate evaluation to avoid invoke more than once. - Adding header file dependency to all object files. Remove the hand specify header file dependency. - Change c2xml to target specific CFLAGS, this allow c2xml using the common pattern rules. - Ramsay Jones point out that LIBXML_CFLAGS need to be put into if HAVE_LIBXML condition. Otherwise make will spew error on system that does not have libxml Signed-off-by: Ramsay Jones Signed-off-By: Christopher Li --- Makefile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) ifeq ($(HAVE_GCC_DEP),yes) @@ -62,6 +62,7 @@ ifeq ($(HAVE_LIBXML),yes) PROGRAMS+=c2xml INST_PROGRAMS+=c2xml c2xml_EXTRA_OBJS = `$(PKG_CONFIG) --libs libxml-2.0` +LIBXML_CFLAGS := $(shell $(PKG_CONFIG) --cflags libxml-2.0) else $(warning Your system does not have libxml, disabling c2xml) endif @@ -187,17 +188,14 @@ $(SLIB_FILE): $(LIB_OBJS) $(QUIET_LINK)$(CC) $(LDFLAGS) -Wl,-soname,$@ -shared -o $@ $(LIB_OBJS) DEP_FILES := $(wildcard .*.o.d) -$(if $(DEP_FILES),$(eval include $(DEP_FILES))) -c2xml.o: c2xml.c $(LIB_H) - $(QUIET_CC)$(CC) `$(PKG_CONFIG) --cflags libxml-2.0` -o $@ -c $(ALL_CFLAGS) $< +ifneq ($(DEP_FILES),) +include $(DEP_FILES) +endif -compat-linux.o: compat/strtold.c compat/mmap-blob.c $(LIB_H) -compat-solaris.o: compat/mmap-blob.c $(LIB_H) -compat-mingw.o: $(LIB_H) -compat-cygwin.o: $(LIB_H) +c2xml.o: CFLAGS += $(LIBXML_CFLAGS) -%.o: %.c +%.o: %.c $(LIB_H) $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< clean: clean-check diff --git a/Makefile b/Makefile index 4d5df1a..9f62c61 100644 --- a/Makefile +++ b/Makefile @@ -34,10 +34,10 @@ HAVE_GTK2:=$(shell $(PKG_CONFIG) --exists gtk+-2.0 2>/dev/null && echo 'yes') LLVM_CONFIG:=llvm-config HAVE_LLVM:=$(shell $(LLVM_CONFIG) --version >/dev/null 2>&1 && echo 'yes') -GCC_BASE = $(shell $(CC) --print-file-name=) +GCC_BASE := $(shell $(CC) --print-file-name=) BASIC_CFLAGS = -DGCC_BASE=\"$(GCC_BASE)\" -MULTIARCH_TRIPLET = $(shell $(CC) -print-multiarch 2>/dev/null) +MULTIARCH_TRIPLET := $(shell $(CC) -print-multiarch 2>/dev/null) BASIC_CFLAGS += -DMULTIARCH_TRIPLET=\"$(MULTIARCH_TRIPLET)\"