From patchwork Mon Jul 17 02:02:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 9843841 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 78C9360392 for ; Mon, 17 Jul 2017 02:02:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FF5A28474 for ; Mon, 17 Jul 2017 02:02:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52E7028479; Mon, 17 Jul 2017 02:02:37 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 BF4E028474 for ; Mon, 17 Jul 2017 02:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751232AbdGQCCg (ORCPT ); Sun, 16 Jul 2017 22:02:36 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36746 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751223AbdGQCCf (ORCPT ); Sun, 16 Jul 2017 22:02:35 -0400 Received: by mail-pf0-f195.google.com with SMTP id a11so1526745pfj.3 for ; Sun, 16 Jul 2017 19:02:35 -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=0zlOP2L4KkklmTb6cXSnRuybTZns3SEmRSLdzBMQcaE=; b=BhLOa9NDYido0P7jru/NIiOhd7M35L2wKeNi5WBrevjLzYtod09Zre4Z+fbEZbj42P P70yZan5r1XzhPjnsAF5XT2PvcbxvWeWpBAxuuqAD6qFv+23+tTMAYh+3NUd1bArAQET o/31DKUAZ40sszdegc/PLdRrg7aZopWlg8aDppBSg25xIeuZ4UcCFwxlXHUubxYwEVQH lqLmQThlPKOQ8tKXilFq6yvMDc2l5YkO3waid1tITatkTNAu7dSuPY+WZqI+gWjySxBG rA23efK6MmhEbMBoJWMi3+dDgKRUcn14PkBVrTUSgBUCGsTYAO/Szu3djkzg1LyAEt+E +aGw== 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=0zlOP2L4KkklmTb6cXSnRuybTZns3SEmRSLdzBMQcaE=; b=RJyU0P5Y7QMTHJt6sRNVWSv2Jye9IZGD6WnfbRiTXWELM3KdXyaW7epkRE3RSnzTJB xbbtDfJwSLExTUbzd3kJyxEILFAOrescvbaSNf1uMqnTSLUlvcMIzClHywXuOkBlByzC 6t1mvTG2rtMPb9R7UfinfLAwqcRbjdzrmFZLkWLH6tT7ox9e2YIQBi8oij9bX3BNChWL EAfnUTxDLwIiGBFsGOT/EgLI4coiFUScyuqr7CNfEq6tK3I/nU4fauTxeTjtP0KJk9ie vYFTKpOKwsZ5ecG4Z9h82h40tq2LvJ+i2pU/GJzYaqYcI8p9nq1122380lwNuVQ/HmOr 6e2A== X-Gm-Message-State: AIVw112e1dIlO71FDbYZztZclNEH0cFEhO38wxwl5dwpNZtIaWukT7++ EcJJzbB0SX8QUcFj8VVii5u9QAVGLna0 X-Received: by 10.99.5.201 with SMTP id 192mr2476401pgf.51.1500256954828; Sun, 16 Jul 2017 19:02:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.149.130 with HTTP; Sun, 16 Jul 2017 19:02:34 -0700 (PDT) From: Christopher Li Date: Sun, 16 Jul 2017 22:02:34 -0400 X-Google-Sender-Auth: j0ld3RmhqSAHssyrmXIi-m8aNvw Message-ID: Subject: [PATCH 1/3] Makefile: clean up and simplify To: Linux-Sparse , Luc Van Oostenryck 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. Signed-of-By: Christopher Li --- Makefile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) ifeq ($(HAVE_GCC_DEP),yes) @@ -187,17 +187,15 @@ $(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) +LIBXML_CFLAGS := $(shell $(PKG_CONFIG) --cflags libxml-2.0) +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..0706d8d 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)\"