From patchwork Mon Jul 17 03:59:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 9843945 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 BB57060386 for ; Mon, 17 Jul 2017 03:59:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A942027FB7 for ; Mon, 17 Jul 2017 03:59:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E11528338; Mon, 17 Jul 2017 03:59:21 +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 ECD7227FB7 for ; Mon, 17 Jul 2017 03:59:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751285AbdGQD7U (ORCPT ); Sun, 16 Jul 2017 23:59:20 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34219 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751253AbdGQD7T (ORCPT ); Sun, 16 Jul 2017 23:59:19 -0400 Received: by mail-pf0-f196.google.com with SMTP id c24so18125408pfe.1 for ; Sun, 16 Jul 2017 20:59:19 -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=K2MC+uQ4S9Buy4LgADqa78BfSdTV7ueBDS7PMLMKHNw=; b=hiTOOyVmTxiwADstbE1UTZeIWNMMsHUfMfsB+S6LkhEynYKQvi7mPcXN7r1hu7w0rq BxIdwZgF+lKEmZ4qGL5g8jFiYQiUsfpwuIkifUYWw/1i462k/+MA5kwQEzwia5rI5tJ3 K/OV+/8FlxT3XIrtElMT5TxuqoIZMOHnwZYMc/2RrS6DblI4apRfcbVkTwhRseYWiGFx 5lfsKLuNMXBaNMcbvz3mtaZO9f6rbOvwoupHdllAGWsxDDnEwvZxiL8QDNYKpR1Jnm8n qDMT9BrvW0Ux+o1VcZJCndzMxMC8OwLH3+TcmMYjQozczfIY6Dl2JlDJVJL1hdgxm71h FnaA== 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=K2MC+uQ4S9Buy4LgADqa78BfSdTV7ueBDS7PMLMKHNw=; b=NGfSQgrO+RSle4L/GCI7wtPiezlCDlNCM2sariV0DvAZhQnXnlUQNW2CDeY/9R8R56 NdbHPJtNhGSdW0h0/hxyvRAFR/Mn/lKErL3IVEZxUW7U5oGo9Dg/7JxNy3gjO2c3GeTK 9wjmDrWaRgi56h7XCVWSL/PxDaQrc6dvD92Oej+gqXErQsfWp3D/TaU5tKURuaI1cHht luEOvzWabdPcN3y9OjDafpDRB5Clpm7pjxSDbOF9ruTU5bNaFZZOFAwY8Yu57S7C5qB7 yPjaXKmoDW8oii7zKyTHafp2iyB/jGbq6k42llSKmRhT/0/8W7fRywuBAvxayMRzLuL4 PaJQ== X-Gm-Message-State: AIVw112j6mS7gKH6gfVse8cNxiQWy+J0/UYoFHhW3EpAV/5P/POR4MXo sYuZOZsCK0xDO1wsmCygjGzpM5uBm7cI X-Received: by 10.84.172.1 with SMTP id m1mr27726283plb.174.1500263959345; Sun, 16 Jul 2017 20:59:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.149.130 with HTTP; Sun, 16 Jul 2017 20:59:18 -0700 (PDT) From: Christopher Li Date: Sun, 16 Jul 2017 23:59:18 -0400 X-Google-Sender-Auth: xv-9MdMSsD5LNbeSrgURoqgCkc8 Message-ID: Subject: [PATCH 2/3] Makefile: add selfcheck target 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 "make selfcheck" will invoke sparse to check its own source code. It is different than the "make C=1" in linux kernel because sparse executable need to be compiled first. "make .sc" will invoke the sparse to check specific C source file .c For example: "make parse.sc" Signed-of-By: Christopher Li --- Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0706d8d..ae81586 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,8 @@ GTK2_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0) PROGRAMS += test-inspect INST_PROGRAMS += test-inspect test-inspect_EXTRA_DEPS := ast-model.o ast-view.o ast-inspect.o -test-inspect.o $(test-inspect_EXTRA_DEPS): BASIC_CFLAGS += $(GTK2_CFLAGS) +test-inspect_OBJS := test-inspect.o $(test-inspect_EXTRA_DEPS) +$(test-inspect_OBJS) $(test-inspect_OBJS:.o=.sc): CFLAGS += $(GTK2_CFLAGS) test-inspect_EXTRA_OBJS := $(GTK2_LIBS) else $(warning Your system does not have libgtk2, disabling test-inspect) @@ -126,6 +127,7 @@ LIBS=$(LIB_FILE) V = @ Q = $(V:1=) QUIET_CC = $(Q:@=@echo ' CC '$@;) +QUIET_CHECK = $(Q:@=@echo ' CHECK '$<;) QUIET_AR = $(Q:@=@echo ' AR '$@;) QUIET_GEN = $(Q:@=@echo ' GEN '$@;) QUIET_LINK = $(Q:@=@echo ' LINK '$@;) @@ -193,11 +195,17 @@ include $(DEP_FILES) endif LIBXML_CFLAGS := $(shell $(PKG_CONFIG) --cflags libxml-2.0) -c2xml.o: CFLAGS += $(LIBXML_CFLAGS) +c2xml.o c2xml.sc: CFLAGS += $(LIBXML_CFLAGS) %.o: %.c $(LIB_H) $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< +%.sc: %.c sparse + $(QUIET_CHECK) ./sparse -c $(ALL_CFLAGS) $< + +selfcheck: $(LIB_OBJS:.o=.sc) $(addsuffix .sc, $(PROGRAMS)) + + clean: clean-check rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc