All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/37] Makefile reorganization
@ 2017-11-09  6:46 Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 01/37] build: make PREFIX overwritable from the environment Luc Van Oostenryck
                   ` (37 more replies)
  0 siblings, 38 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

The goal of this series is to reorganize sparse's Makefile
in order to offer a few features asked by the distros:
1) allow CFLAGS & CPPFLAGS to be taken from the command line
2) allow PREFIX to be taken from the environment
Support for pkg-config is removed as well as some old crufts.

This cleanup is based on a previous series by Uwe Kleine-König
and further inspired by a patch and a need from Jeff Layton.

The changes since v1 are:
*) fold the two patches concerning the removal of shared lib support
*) remove the patch using git-clean for 'make clean'

The changes since v2 are:
*) change a commit message to make explicit the fact that
   quiet's commands abbreviated part are also issued for V=1
*) add a convenience rule for running a single test via:
	make validation/<name-of-testfile>.t
   
A priori, this should be the final version.

The series is available for review & testing at:
  git://github.com/lucvoo/sparse.git make-cleanup-v3

Luc Van Oostenryck (31):
  build: fix effectiveness of generated dependencies
  build: remove unused support for pkgconfig
  build: use '_OBJS' instead of '_EXTRA_DEPS'
  build: use '_LDLIBS' instead of '_EXTRA_OBJS'
  build: allow target-specific CFLAGS, CPPFLAGS, LDFLAGS & LDLIBS
  build: allow CFLAGS & friends from command line
  build: avoid rule-specific CFLAGS
  build: use $LIBS directly in the dependency list
  build: no need to use wildcards for generated dependencies
  build: reuse rule for ALL_OBJS
  build: CHECKER_FLAGS=-Wno-vla for all targets
  build: move tests near their use
  build: add note about overwritable vars
  build: remove references to unexisting pre-process.h
  build: move clean & clean-check together
  build: make clean targets quieter
  build: remove rule for shared lib, it's unused
  build: normalize rules
  build: remove the dist rule since unused
  build: use one line per item
  build: use a dot file name instead of local.mk: .sparse.mk
  build: use standard rules for install
  build: remove unused QUIET_INST_SH
  build: let quiet commands use less indentation
  build: simplify quiet commands
  build: simplify clean pattern
  build: add *.o to clean-check pattern
  build: avoid foreach
  build: reorg & add comment
  build: use a single space before assignments
  build: add rule to run a single test

Uwe Kleine-König (6):
  build: make PREFIX overwritable from the environment
  build: put comment about local.mk to the place where it is included
  build: drop BASIC_CFLAGS and ALL_CFLAGS
  build: drop -g from LDFLAGS
  build: pass CPPFLAGS to compiler
  build: only generate version.h when needed

 .gitignore   |   4 +-
 Makefile     | 316 +++++++++++++++++++++++++++++------------------------------
 sparse.pc.in |   9 --
 3 files changed, 157 insertions(+), 172 deletions(-)
 delete mode 100644 sparse.pc.in

-- 
2.14.0


^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v3 01/37] build: make PREFIX overwritable from the environment
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 02/37] build: put comment about local.mk to the place where it is included Luc Van Oostenryck
                   ` (36 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

From: Uwe Kleine-König <uwe@kleine-koenig.org>

This way I can just use

	env PREFIX=/usr make install

on the command line to install sparse into the system.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index d03417641..e011df3cc 100644
--- a/Makefile
+++ b/Makefile
@@ -54,7 +54,7 @@ BASIC_CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
 endif
 
 DESTDIR=
-PREFIX=$(HOME)
+PREFIX ?= $(HOME)
 BINDIR=$(PREFIX)/bin
 LIBDIR=$(PREFIX)/lib
 MANDIR=$(PREFIX)/share/man
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 02/37] build: put comment about local.mk to the place where it is included
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 01/37] build: make PREFIX overwritable from the environment Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 03/37] build: drop BASIC_CFLAGS and ALL_CFLAGS Luc Van Oostenryck
                   ` (35 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

From: Uwe Kleine-König <uwe@kleine-koenig.org>

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index e011df3cc..ddb4c5e3d 100644
--- a/Makefile
+++ b/Makefile
@@ -22,11 +22,6 @@ CHECKER = ./cgcc -no-compile
 CHECKER_FLAGS =
 
 ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS)
-#
-# For debugging, put this in local.mk:
-#
-#     CFLAGS += -O0 -DDEBUG -g3 -gdwarf-2
-#
 
 HAVE_LIBXML:=$(shell $(PKG_CONFIG) --exists libxml-2.0 2>/dev/null && echo 'yes')
 HAVE_GCC_DEP:=$(shell touch .gcc-test.c && 				\
@@ -167,6 +162,10 @@ SED_PC_CMD = 's|@version@|$(VERSION)|g;		\
 
 
 # Allow users to override build settings without dirtying their trees
+# For debugging, put this in local.mk:
+#
+#     CFLAGS += -O0 -DDEBUG -g3 -gdwarf-2
+#
 -include local.mk
 
 
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 03/37] build: drop BASIC_CFLAGS and ALL_CFLAGS
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 01/37] build: make PREFIX overwritable from the environment Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 02/37] build: put comment about local.mk to the place where it is included Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 04/37] build: drop -g from LDFLAGS Luc Van Oostenryck
                   ` (34 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

From: Uwe Kleine-König <uwe@kleine-koenig.org>

There is no good reason to not use plain CFLAGS for all usages.
This simplifies understanding the Makefile for the casual reader.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index ddb4c5e3d..069dae6c8 100644
--- a/Makefile
+++ b/Makefile
@@ -21,8 +21,6 @@ PKG_CONFIG = pkg-config
 CHECKER = ./cgcc -no-compile
 CHECKER_FLAGS =
 
-ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS)
-
 HAVE_LIBXML:=$(shell $(PKG_CONFIG) --exists libxml-2.0 2>/dev/null && echo 'yes')
 HAVE_GCC_DEP:=$(shell touch .gcc-test.c && 				\
 		$(CC) -c -Wp,-MD,.gcc-test.d .gcc-test.c 2>/dev/null && \
@@ -39,13 +37,13 @@ LLVM_CONFIG:=llvm-config
 HAVE_LLVM:=$(shell $(LLVM_CONFIG) --version >/dev/null 2>&1 && echo 'yes')
 
 GCC_BASE := $(shell $(CC) --print-file-name=)
-BASIC_CFLAGS = -DGCC_BASE=\"$(GCC_BASE)\"
+CFLAGS += -DGCC_BASE=\"$(GCC_BASE)\"
 
 MULTIARCH_TRIPLET := $(shell $(CC) -print-multiarch 2>/dev/null)
-BASIC_CFLAGS += -DMULTIARCH_TRIPLET=\"$(MULTIARCH_TRIPLET)\"
+CFLAGS += -DMULTIARCH_TRIPLET=\"$(MULTIARCH_TRIPLET)\"
 
 ifeq ($(HAVE_GCC_DEP),yes)
-BASIC_CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
+CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
 endif
 
 DESTDIR=
@@ -96,7 +94,7 @@ LLVM_LIBS := $(shell $(LLVM_CONFIG) --libs)
 LLVM_LIBS += $(shell $(LLVM_CONFIG) --system-libs 2>/dev/null)
 PROGRAMS += $(LLVM_PROGS)
 INST_PROGRAMS += sparse-llvm sparsec
-sparse-llvm.o: BASIC_CFLAGS += $(LLVM_CFLAGS)
+sparse-llvm.o: CFLAGS += $(LLVM_CFLAGS)
 sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS) $(LLVM_LDFLAGS)
 else
 $(warning LLVM 3.0 or later required. Your system has version $(LLVM_VERSION) installed.)
@@ -122,7 +120,7 @@ LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
 LIB_FILE= libsparse.a
 SLIB_FILE= libsparse.so
 
-# If you add $(SLIB_FILE) to this, you also need to add -fpic to BASIC_CFLAGS above.
+# If you add $(SLIB_FILE) to this, you also need to add -fpic to CFLAGS above.
 # Doing so incurs a noticeable performance hit, and Sparse does not have a
 # stable shared library interface, so this does not occur by default.  If you
 # really want a shared library, you may want to build Sparse twice: once
@@ -212,10 +210,10 @@ c2xml.o c2xml.sc: CFLAGS += $(LIBXML_CFLAGS)
 pre-process.sc: CHECKER_FLAGS += -Wno-vla
 
 %.o: %.c $(LIB_H)
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
 
 %.sc: %.c sparse
-	$(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) -c $(ALL_CFLAGS) $<
+	$(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) -c $(CFLAGS) $<
 
 ALL_OBJS :=  $(LIB_OBJS) $(foreach p,$(PROGRAMS),$(p).o $($(p)_EXTRA_DEPS))
 selfcheck: $(ALL_OBJS:.o=.sc)
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 04/37] build: drop -g from LDFLAGS
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (2 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 03/37] build: drop BASIC_CFLAGS and ALL_CFLAGS Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 05/37] build: pass CPPFLAGS to compiler Luc Van Oostenryck
                   ` (33 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

From: Uwe Kleine-König <uwe@kleine-koenig.org>

-g is a compiler option that is ignored by the linker. So it should be
included in CFLAGS (it already is) but not LDFLAGS.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Makefile b/Makefile
index 069dae6c8..39b34f901 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,6 @@ OS = linux
 CC = gcc
 CFLAGS = -O2 -finline-functions -fno-strict-aliasing -g
 CFLAGS += -Wall -Wwrite-strings
-LDFLAGS += -g
 LD = gcc
 AR = ar
 PKG_CONFIG = pkg-config
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 05/37] build: pass CPPFLAGS to compiler
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (3 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 04/37] build: drop -g from LDFLAGS Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 06/37] build: fix effectiveness of generated dependencies Luc Van Oostenryck
                   ` (32 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

From: Uwe Kleine-König <uwe@kleine-koenig.org>

Debian packages use CPPFLAGS to pass -D_FORTIFY_SOURCE=2 for hardening.

Originally-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 39b34f901..f1af83e32 100644
--- a/Makefile
+++ b/Makefile
@@ -209,10 +209,10 @@ c2xml.o c2xml.sc: CFLAGS += $(LIBXML_CFLAGS)
 pre-process.sc: CHECKER_FLAGS += -Wno-vla
 
 %.o: %.c $(LIB_H)
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
+	$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 %.sc: %.c sparse
-	$(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) -c $(CFLAGS) $<
+	$(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) $(CFLAGS) $(CPPFLAGS) -c $<
 
 ALL_OBJS :=  $(LIB_OBJS) $(foreach p,$(PROGRAMS),$(p).o $($(p)_EXTRA_DEPS))
 selfcheck: $(ALL_OBJS:.o=.sc)
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 06/37] build: fix effectiveness of generated dependencies
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (4 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 05/37] build: pass CPPFLAGS to compiler Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 07/37] build: remove unused support for pkgconfig Luc Van Oostenryck
                   ` (31 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Commit fb8734e3f "Makefile: clean up and simplify" added blindly
$(LIB_H) as dependency to all .o targets.
This completely defeat the purpose of generated dependencies.

Fix this by removing this unneeded dependency.

Fixes: fb8734e3fa18619277f54f131a9b898ce7171645
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index f1af83e32..bc4469410 100644
--- a/Makefile
+++ b/Makefile
@@ -208,7 +208,7 @@ c2xml.o c2xml.sc: CFLAGS += $(LIBXML_CFLAGS)
 
 pre-process.sc: CHECKER_FLAGS += -Wno-vla
 
-%.o: %.c $(LIB_H)
+%.o: %.c
 	$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 %.sc: %.c sparse
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 07/37] build: remove unused support for pkgconfig
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (5 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 06/37] build: fix effectiveness of generated dependencies Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 08/37] build: use '_OBJS' instead of '_EXTRA_DEPS' Luc Van Oostenryck
                   ` (30 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Sparse being a library was installed as such and with support for
pkgconfig.

However, it seems that sparse is only used for its tools and not
as a library (at least not as an external one) and currently
doesn't offer a stable interface.

For now, remove the support for this, it will be easy enough to
restore it if there is a new need.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 .gitignore   |  1 -
 Makefile     | 27 +++------------------------
 sparse.pc.in |  9 ---------
 3 files changed, 3 insertions(+), 34 deletions(-)
 delete mode 100644 sparse.pc.in

diff --git a/.gitignore b/.gitignore
index 44218a2fe..9f996dc87 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,6 @@
 
 # generated
 pre-process.h
-sparse.pc
 version.h
 
 # programs
diff --git a/Makefile b/Makefile
index bc4469410..bd8a08f13 100644
--- a/Makefile
+++ b/Makefile
@@ -48,11 +48,8 @@ endif
 DESTDIR=
 PREFIX ?= $(HOME)
 BINDIR=$(PREFIX)/bin
-LIBDIR=$(PREFIX)/lib
 MANDIR=$(PREFIX)/share/man
 MAN1DIR=$(MANDIR)/man1
-INCLUDEDIR=$(PREFIX)/include
-PKGCONFIGDIR=$(LIBDIR)/pkgconfig
 
 PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse \
 	 test-linearize example test-unssa test-dissect ctags
@@ -105,9 +102,6 @@ else
 $(warning Your system does not have llvm, disabling sparse-llvm)
 endif
 
-LIB_H=    token.h parse.h lib.h symbol.h scope.h expression.h target.h \
-	  linearize.h bitmap.h ident-list.h compat.h flow.h allocate.h \
-	  storage.h ptrlist.h dissect.h
 
 LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
 	  expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
@@ -151,12 +145,6 @@ define INSTALL_FILE
 
 endef
 
-SED_PC_CMD = 's|@version@|$(VERSION)|g;		\
-	      s|@prefix@|$(PREFIX)|g;		\
-	      s|@libdir@|$(LIBDIR)|g;		\
-	      s|@includedir@|$(INCLUDEDIR)|g'
-
-
 
 # Allow users to override build settings without dirtying their trees
 # For debugging, put this in local.mk:
@@ -166,24 +154,15 @@ SED_PC_CMD = 's|@version@|$(VERSION)|g;		\
 -include local.mk
 
 
-all: $(PROGRAMS) sparse.pc
+all: $(PROGRAMS)
 
-all-installable: $(INST_PROGRAMS) $(LIBS) $(LIB_H) sparse.pc
+all-installable: $(INST_PROGRAMS)
 
 install: all-installable
 	$(Q)install -d $(DESTDIR)$(BINDIR)
-	$(Q)install -d $(DESTDIR)$(LIBDIR)
 	$(Q)install -d $(DESTDIR)$(MAN1DIR)
-	$(Q)install -d $(DESTDIR)$(INCLUDEDIR)/sparse
-	$(Q)install -d $(DESTDIR)$(PKGCONFIGDIR)
 	$(foreach f,$(INST_PROGRAMS),$(call INSTALL_EXEC,$f,$(BINDIR)))
 	$(foreach f,$(INST_MAN1),$(call INSTALL_FILE,$f,$(MAN1DIR)))
-	$(foreach f,$(LIBS),$(call INSTALL_FILE,$f,$(LIBDIR)))
-	$(foreach f,$(LIB_H),$(call INSTALL_FILE,$f,$(INCLUDEDIR)/sparse))
-	$(call INSTALL_FILE,sparse.pc,$(PKGCONFIGDIR))
-
-sparse.pc: sparse.pc.in
-	$(QUIET_GEN)sed $(SED_PC_CMD) sparse.pc.in > sparse.pc
 
 
 compile_EXTRA_DEPS = compile-i386.o
@@ -219,7 +198,7 @@ selfcheck: $(ALL_OBJS:.o=.sc)
 
 
 clean: clean-check
-	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc version.h
+	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h version.h
 
 dist:
 	@if test "$(SPARSE_VERSION)" != "v$(VERSION)" ; then \
diff --git a/sparse.pc.in b/sparse.pc.in
deleted file mode 100644
index f1281c97a..000000000
--- a/sparse.pc.in
+++ /dev/null
@@ -1,9 +0,0 @@
-prefix=@prefix@
-libdir=@libdir@
-includedir=@includedir@

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 08/37] build: use '_OBJS' instead of '_EXTRA_DEPS'
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (6 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 07/37] build: remove unused support for pkgconfig Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 09/37] build: use '_LDLIBS' instead of '_EXTRA_OBJS' Luc Van Oostenryck
                   ` (29 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Some programs are composed of several source files other than the
main one. These files need then to be added at linking time.
These extra file are currently specified using variables named
"<program-name>_EXTRA_DEPS" but the way these variables are used
make that they can only hold .o files (or .a ones) and are not
some kind of generic dependencie.

Make this explicit by using the suffix '_OBJS' instead.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index bd8a08f13..eb7154992 100644
--- a/Makefile
+++ b/Makefile
@@ -70,8 +70,8 @@ GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-$(GTK_VERSION))
 GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-$(GTK_VERSION))
 PROGRAMS += test-inspect
 INST_PROGRAMS += test-inspect
-test-inspect_EXTRA_DEPS := ast-model.o ast-view.o ast-inspect.o
-test-inspect_OBJS := test-inspect.o $(test-inspect_EXTRA_DEPS)
+test-inspect_OBJS := test-inspect.o
+test-inspect_OBJS += ast-model.o ast-view.o ast-inspect.o
 $(test-inspect_OBJS) $(test-inspect_OBJS:.o=.sc): CFLAGS += $(GTK_CFLAGS)
 test-inspect_EXTRA_OBJS := $(GTK_LIBS)
 else
@@ -165,9 +165,9 @@ install: all-installable
 	$(foreach f,$(INST_MAN1),$(call INSTALL_FILE,$f,$(MAN1DIR)))
 
 
-compile_EXTRA_DEPS = compile-i386.o
+compile_OBJS := compile-i386.o
 
-$(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_EXTRA_DEPS) $(LIBS)))
+$(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_OBJS) $(LIBS)))
 $(PROGRAMS): % : %.o 
 	$(QUIET_LINK)$(LD) $(LDFLAGS) -o $@ $^ $($@_EXTRA_OBJS)
 
@@ -193,7 +193,7 @@ pre-process.sc: CHECKER_FLAGS += -Wno-vla
 %.sc: %.c sparse
 	$(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) $(CFLAGS) $(CPPFLAGS) -c $<
 
-ALL_OBJS :=  $(LIB_OBJS) $(foreach p,$(PROGRAMS),$(p).o $($(p)_EXTRA_DEPS))
+ALL_OBJS :=  $(LIB_OBJS) $(foreach p,$(PROGRAMS),$(p).o $($(p)_OBJS))
 selfcheck: $(ALL_OBJS:.o=.sc)
 
 
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 09/37] build: use '_LDLIBS' instead of '_EXTRA_OBJS'
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (7 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 08/37] build: use '_OBJS' instead of '_EXTRA_DEPS' Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 10/37] build: allow target-specific CFLAGS, CPPFLAGS, LDFLAGS & LDLIBS Luc Van Oostenryck
                   ` (28 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Some of the programs need to link with some external libraries.
For some reasons, these libraries are specified via variables named:
"<target>_EXTRA_OBJS".

Use the '_LDLIBS' prefix instead to better reflect the real use.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index eb7154992..c9cd15aba 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ INST_MAN1=sparse.1 cgcc.1
 ifeq ($(HAVE_LIBXML),yes)
 PROGRAMS+=c2xml
 INST_PROGRAMS+=c2xml
-c2xml_EXTRA_OBJS = `$(PKG_CONFIG) --libs libxml-2.0`
+c2xml_LDLIBS = `$(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)
@@ -73,7 +73,7 @@ INST_PROGRAMS += test-inspect
 test-inspect_OBJS := test-inspect.o
 test-inspect_OBJS += ast-model.o ast-view.o ast-inspect.o
 $(test-inspect_OBJS) $(test-inspect_OBJS:.o=.sc): CFLAGS += $(GTK_CFLAGS)
-test-inspect_EXTRA_OBJS := $(GTK_LIBS)
+test-inspect_LDLIBS := $(GTK_LIBS)
 else
 $(warning Your system does not have gtk3/gtk2, disabling test-inspect)
 endif
@@ -91,7 +91,7 @@ LLVM_LIBS += $(shell $(LLVM_CONFIG) --system-libs 2>/dev/null)
 PROGRAMS += $(LLVM_PROGS)
 INST_PROGRAMS += sparse-llvm sparsec
 sparse-llvm.o: CFLAGS += $(LLVM_CFLAGS)
-sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS) $(LLVM_LDFLAGS)
+sparse-llvm_LDLIBS := $(LLVM_LIBS) $(LLVM_LDFLAGS)
 else
 $(warning LLVM 3.0 or later required. Your system has version $(LLVM_VERSION) installed.)
 endif
@@ -169,7 +169,7 @@ compile_OBJS := compile-i386.o
 
 $(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_OBJS) $(LIBS)))
 $(PROGRAMS): % : %.o 
-	$(QUIET_LINK)$(LD) $(LDFLAGS) -o $@ $^ $($@_EXTRA_OBJS)
+	$(QUIET_LINK)$(LD) $(LDFLAGS) -o $@ $^ $($@_LDLIBS)
 
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 10/37] build: allow target-specific CFLAGS, CPPFLAGS, LDFLAGS & LDLIBS
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (8 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 09/37] build: use '_LDLIBS' instead of '_EXTRA_OBJS' Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 11/37] build: allow CFLAGS & friends from command line Luc Van Oostenryck
                   ` (27 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index c9cd15aba..70a4156ed 100644
--- a/Makefile
+++ b/Makefile
@@ -59,8 +59,8 @@ INST_MAN1=sparse.1 cgcc.1
 ifeq ($(HAVE_LIBXML),yes)
 PROGRAMS+=c2xml
 INST_PROGRAMS+=c2xml
-c2xml_LDLIBS = `$(PKG_CONFIG) --libs libxml-2.0`
-LIBXML_CFLAGS := $(shell $(PKG_CONFIG) --cflags libxml-2.0)
+c2xml_LDLIBS := $(shell $(PKG_CONFIG) --libs libxml-2.0)
+c2xml_CFLAGS := $(shell $(PKG_CONFIG) --cflags libxml-2.0)
 else
 $(warning Your system does not have libxml, disabling c2xml)
 endif
@@ -90,8 +90,9 @@ LLVM_LIBS := $(shell $(LLVM_CONFIG) --libs)
 LLVM_LIBS += $(shell $(LLVM_CONFIG) --system-libs 2>/dev/null)
 PROGRAMS += $(LLVM_PROGS)
 INST_PROGRAMS += sparse-llvm sparsec
-sparse-llvm.o: CFLAGS += $(LLVM_CFLAGS)
-sparse-llvm_LDLIBS := $(LLVM_LIBS) $(LLVM_LDFLAGS)
+sparse-llvm_CFLAGS := $(LLVM_CFLAGS)
+sparse-llvm_LDFLAGS := $(LLVM_LDFLAGS)
+sparse-llvm_LDLIBS := $(LLVM_LIBS)
 else
 $(warning LLVM 3.0 or later required. Your system has version $(LLVM_VERSION) installed.)
 endif
@@ -167,9 +168,11 @@ install: all-installable
 
 compile_OBJS := compile-i386.o
 
+ldflags += $($(@)_LDFLAGS) $(LDFLAGS)
+ldlibs  += $($(@)_LDLIBS)  $(LDLIBS)
 $(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_OBJS) $(LIBS)))
 $(PROGRAMS): % : %.o 
-	$(QUIET_LINK)$(LD) $(LDFLAGS) -o $@ $^ $($@_LDLIBS)
+	$(QUIET_LINK)$(LD) $(ldflags) -o $@ $^ $(ldlibs)
 
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)
@@ -183,15 +186,15 @@ ifneq ($(DEP_FILES),)
 include $(DEP_FILES)
 endif
 
-c2xml.o c2xml.sc: CFLAGS += $(LIBXML_CFLAGS)
 
 pre-process.sc: CHECKER_FLAGS += -Wno-vla
 
+cflags   += $($(*)_CFLAGS) $(CPPFLAGS) $(CFLAGS)
 %.o: %.c
-	$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+	$(QUIET_CC)$(CC) $(cflags) -c -o $@ $<
 
 %.sc: %.c sparse
-	$(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) $(CFLAGS) $(CPPFLAGS) -c $<
+	$(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) $(cflags) -c $<
 
 ALL_OBJS :=  $(LIB_OBJS) $(foreach p,$(PROGRAMS),$(p).o $($(p)_OBJS))
 selfcheck: $(ALL_OBJS:.o=.sc)
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 11/37] build: allow CFLAGS & friends from command line
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (9 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 10/37] build: allow target-specific CFLAGS, CPPFLAGS, LDFLAGS & LDLIBS Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 12/37] build: avoid rule-specific CFLAGS Luc Van Oostenryck
                   ` (26 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

This allow distros or devs to override the default CFLAGS,
CPPFLAGS, LDFLAGS, ...

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 70a4156ed..fed392c8a 100644
--- a/Makefile
+++ b/Makefile
@@ -36,13 +36,13 @@ LLVM_CONFIG:=llvm-config
 HAVE_LLVM:=$(shell $(LLVM_CONFIG) --version >/dev/null 2>&1 && echo 'yes')
 
 GCC_BASE := $(shell $(CC) --print-file-name=)
-CFLAGS += -DGCC_BASE=\"$(GCC_BASE)\"
+cflags += -DGCC_BASE=\"$(GCC_BASE)\"
 
 MULTIARCH_TRIPLET := $(shell $(CC) -print-multiarch 2>/dev/null)
-CFLAGS += -DMULTIARCH_TRIPLET=\"$(MULTIARCH_TRIPLET)\"
+cflags += -DMULTIARCH_TRIPLET=\"$(MULTIARCH_TRIPLET)\"
 
 ifeq ($(HAVE_GCC_DEP),yes)
-CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
+cflags += -Wp,-MD,$(@D)/.$(@F).d
 endif
 
 DESTDIR=
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 12/37] build: avoid rule-specific CFLAGS
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (10 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 11/37] build: allow CFLAGS & friends from command line Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 13/37] build: use $LIBS directly in the dependency list Luc Van Oostenryck
                   ` (25 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Those are not evil but it's for consistency with the remaining.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index fed392c8a..73fc6d554 100644
--- a/Makefile
+++ b/Makefile
@@ -72,7 +72,7 @@ PROGRAMS += test-inspect
 INST_PROGRAMS += test-inspect
 test-inspect_OBJS := test-inspect.o
 test-inspect_OBJS += ast-model.o ast-view.o ast-inspect.o
-$(test-inspect_OBJS) $(test-inspect_OBJS:.o=.sc): CFLAGS += $(GTK_CFLAGS)
+$(foreach p,$(test-inspect_OBJS:.o=),$(eval $(p)_CFLAGS := $(GTK_CFLAGS)))
 test-inspect_LDLIBS := $(GTK_LIBS)
 else
 $(warning Your system does not have gtk3/gtk2, disabling test-inspect)
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 13/37] build: use $LIBS directly in the dependency list
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (11 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 12/37] build: avoid rule-specific CFLAGS Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 14/37] build: no need to use wildcards for generated dependencies Luc Van Oostenryck
                   ` (24 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 73fc6d554..da99a60ad 100644
--- a/Makefile
+++ b/Makefile
@@ -170,8 +170,8 @@ compile_OBJS := compile-i386.o
 
 ldflags += $($(@)_LDFLAGS) $(LDFLAGS)
 ldlibs  += $($(@)_LDLIBS)  $(LDLIBS)
-$(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_OBJS) $(LIBS)))
-$(PROGRAMS): % : %.o 
+$(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_OBJS)))
+$(PROGRAMS): % : %.o $(LIBS)
 	$(QUIET_LINK)$(LD) $(ldflags) -o $@ $^ $(ldlibs)
 
 $(LIB_FILE): $(LIB_OBJS)
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 14/37] build: no need to use wildcards for generated dependencies
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (12 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 13/37] build: use $LIBS directly in the dependency list Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 15/37] build: reuse rule for ALL_OBJS Luc Van Oostenryck
                   ` (23 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index da99a60ad..b694db61a 100644
--- a/Makefile
+++ b/Makefile
@@ -180,11 +180,10 @@ $(LIB_FILE): $(LIB_OBJS)
 $(SLIB_FILE): $(LIB_OBJS)
 	$(QUIET_LINK)$(CC) $(LDFLAGS) -Wl,-soname,$@ -shared -o $@ $(LIB_OBJS)
 
-DEP_FILES := $(wildcard .*.o.d)
+OBJS := $(LIB_OBJS) $(PROGRAMS:%=%.o) $(foreach p,$(PROGRAMS),$($(p)_OBJS))
+DEPS := $(OBJS:%.o=.%.o.d)
 
-ifneq ($(DEP_FILES),)
-include $(DEP_FILES)
-endif
+-include $(DEPS)
 
 
 pre-process.sc: CHECKER_FLAGS += -Wno-vla
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 15/37] build: reuse rule for ALL_OBJS
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (13 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 14/37] build: no need to use wildcards for generated dependencies Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 16/37] build: CHECKER_FLAGS=-Wno-vla for all targets Luc Van Oostenryck
                   ` (22 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index b694db61a..2d3deec3a 100644
--- a/Makefile
+++ b/Makefile
@@ -195,8 +195,7 @@ cflags   += $($(*)_CFLAGS) $(CPPFLAGS) $(CFLAGS)
 %.sc: %.c sparse
 	$(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) $(cflags) -c $<
 
-ALL_OBJS :=  $(LIB_OBJS) $(foreach p,$(PROGRAMS),$(p).o $($(p)_OBJS))
-selfcheck: $(ALL_OBJS:.o=.sc)
+selfcheck: $(OBJS:.o=.sc)
 
 
 clean: clean-check
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 16/37] build: CHECKER_FLAGS=-Wno-vla for all targets
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (14 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 15/37] build: reuse rule for ALL_OBJS Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 17/37] build: move tests near their use Luc Van Oostenryck
                   ` (21 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 2d3deec3a..c77a166f8 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ LD = gcc
 AR = ar
 PKG_CONFIG = pkg-config
 CHECKER = ./cgcc -no-compile
-CHECKER_FLAGS =
+CHECKER_FLAGS = -Wno-vla
 
 HAVE_LIBXML:=$(shell $(PKG_CONFIG) --exists libxml-2.0 2>/dev/null && echo 'yes')
 HAVE_GCC_DEP:=$(shell touch .gcc-test.c && 				\
@@ -186,8 +186,6 @@ DEPS := $(OBJS:%.o=.%.o.d)
 -include $(DEPS)
 
 
-pre-process.sc: CHECKER_FLAGS += -Wno-vla

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 17/37] build: move tests near their use
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (15 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 16/37] build: CHECKER_FLAGS=-Wno-vla for all targets Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 18/37] build: only generate version.h when needed Luc Van Oostenryck
                   ` (20 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

No functional changes here, just moving things around.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 79 +++++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 41 insertions(+), 38 deletions(-)

diff --git a/Makefile b/Makefile
index c77a166f8..460a261f1 100644
--- a/Makefile
+++ b/Makefile
@@ -20,20 +20,33 @@ PKG_CONFIG = pkg-config
 CHECKER = ./cgcc -no-compile
 CHECKER_FLAGS = -Wno-vla
 
-HAVE_LIBXML:=$(shell $(PKG_CONFIG) --exists libxml-2.0 2>/dev/null && echo 'yes')
-HAVE_GCC_DEP:=$(shell touch .gcc-test.c && 				\
-		$(CC) -c -Wp,-MD,.gcc-test.d .gcc-test.c 2>/dev/null && \
-		echo 'yes'; rm -f .gcc-test.d .gcc-test.o .gcc-test.c)
+DESTDIR=
+PREFIX ?= $(HOME)
+BINDIR=$(PREFIX)/bin
+MANDIR=$(PREFIX)/share/man
+MAN1DIR=$(MANDIR)/man1
 
-GTK_VERSION:=3.0
-HAVE_GTK:=$(shell $(PKG_CONFIG) --exists gtk+-$(GTK_VERSION) 2>/dev/null && echo 'yes')
-ifneq ($(HAVE_GTK),yes)
-	GTK_VERSION:=2.0
-	HAVE_GTK:=$(shell $(PKG_CONFIG) --exists gtk+-$(GTK_VERSION) 2>/dev/null && echo 'yes')
-endif
+# Allow users to override build settings without dirtying their trees
+# For debugging, put this in local.mk:
+#
+#     CFLAGS += -O0 -DDEBUG -g3 -gdwarf-2
+#
+-include local.mk
 
-LLVM_CONFIG:=llvm-config
-HAVE_LLVM:=$(shell $(LLVM_CONFIG) --version >/dev/null 2>&1 && echo 'yes')
+
+PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse \
+	 test-linearize example test-unssa test-dissect ctags
+INST_PROGRAMS=sparse cgcc
+INST_MAN1=sparse.1 cgcc.1
+
+LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
+	  expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
+	  char.o sort.o allocate.o compat-$(OS).o ptrlist.o \
+	  builtin.o \
+	  stats.o \
+	  flow.o cse.o simplify.o memops.o liveness.o storage.o unssa.o dissect.o
+
+all:
 
 GCC_BASE := $(shell $(CC) --print-file-name=)
 cflags += -DGCC_BASE=\"$(GCC_BASE)\"
@@ -41,21 +54,16 @@ cflags += -DGCC_BASE=\"$(GCC_BASE)\"
 MULTIARCH_TRIPLET := $(shell $(CC) -print-multiarch 2>/dev/null)
 cflags += -DMULTIARCH_TRIPLET=\"$(MULTIARCH_TRIPLET)\"
 
+# Can we use GCC's generated dependencies?
+HAVE_GCC_DEP:=$(shell touch .gcc-test.c && 				\
+		$(CC) -c -Wp,-MD,.gcc-test.d .gcc-test.c 2>/dev/null && \
+		echo 'yes'; rm -f .gcc-test.d .gcc-test.o .gcc-test.c)
 ifeq ($(HAVE_GCC_DEP),yes)
 cflags += -Wp,-MD,$(@D)/.$(@F).d
 endif
 
-DESTDIR=
-PREFIX ?= $(HOME)
-BINDIR=$(PREFIX)/bin
-MANDIR=$(PREFIX)/share/man
-MAN1DIR=$(MANDIR)/man1
-
-PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse \
-	 test-linearize example test-unssa test-dissect ctags
-INST_PROGRAMS=sparse cgcc
-INST_MAN1=sparse.1 cgcc.1
-
+# Can we use libxml (needed for c2xml)?
+HAVE_LIBXML:=$(shell $(PKG_CONFIG) --exists libxml-2.0 2>/dev/null && echo 'yes')
 ifeq ($(HAVE_LIBXML),yes)
 PROGRAMS+=c2xml
 INST_PROGRAMS+=c2xml
@@ -65,6 +73,13 @@ else
 $(warning Your system does not have libxml, disabling c2xml)
 endif
 
+# Can we use gtk (needed for test-inspect)
+GTK_VERSION:=3.0
+HAVE_GTK:=$(shell $(PKG_CONFIG) --exists gtk+-$(GTK_VERSION) 2>/dev/null && echo 'yes')
+ifneq ($(HAVE_GTK),yes)
+GTK_VERSION:=2.0
+HAVE_GTK:=$(shell $(PKG_CONFIG) --exists gtk+-$(GTK_VERSION) 2>/dev/null && echo 'yes')
+endif
 ifeq ($(HAVE_GTK),yes)
 GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-$(GTK_VERSION))
 GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-$(GTK_VERSION))
@@ -78,6 +93,9 @@ else
 $(warning Your system does not have gtk3/gtk2, disabling test-inspect)
 endif
 
+# Can we use LLVM (needed for ... sparse-llvm)?
+LLVM_CONFIG:=llvm-config
+HAVE_LLVM:=$(shell $(LLVM_CONFIG) --version >/dev/null 2>&1 && echo 'yes')
 ifeq ($(HAVE_LLVM),yes)
 ifeq ($(shell uname -m | grep -q '\(i386\|x86\)' && echo ok),ok)
 LLVM_VERSION:=$(shell $(LLVM_CONFIG) --version)
@@ -103,14 +121,6 @@ else
 $(warning Your system does not have llvm, disabling sparse-llvm)
 endif
 
-
-LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
-	  expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
-	  char.o sort.o allocate.o compat-$(OS).o ptrlist.o \
-	  builtin.o \
-	  stats.o \
-	  flow.o cse.o simplify.o memops.o liveness.o storage.o unssa.o dissect.o
-
 LIB_FILE= libsparse.a
 SLIB_FILE= libsparse.so
 
@@ -147,13 +157,6 @@ define INSTALL_FILE
 endef
 
 
-# Allow users to override build settings without dirtying their trees
-# For debugging, put this in local.mk:
-#
-#     CFLAGS += -O0 -DDEBUG -g3 -gdwarf-2
-#
--include local.mk

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 18/37] build: only generate version.h when needed
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (16 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 17/37] build: move tests near their use Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 19/37] build: add note about overwritable vars Luc Van Oostenryck
                   ` (19 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

From: Uwe Kleine-König <uwe@kleine-koenig.org>

This way version.h isn't generated when running $(make clean) but only
when lib.c is about to be compiled.

This simplifies packaging for Debian because the package building programs
abort when there are additional files after $(make clean).

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 460a261f1..ea3ce89a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,5 @@
 VERSION=0.5.1
 
-# Generating file version.h if current version has changed
-SPARSE_VERSION:=$(shell git describe 2>/dev/null || echo '$(VERSION)')
-VERSION_H := $(shell cat version.h 2>/dev/null)
-ifneq ($(lastword $(VERSION_H)),"$(SPARSE_VERSION)")
-$(info $(shell echo '     GEN      'version.h))
-$(shell echo '#define SPARSE_VERSION "$(SPARSE_VERSION)"' > version.h)
-endif
-
 OS = linux
 
 
@@ -199,6 +191,18 @@ cflags   += $($(*)_CFLAGS) $(CPPFLAGS) $(CFLAGS)
 selfcheck: $(OBJS:.o=.sc)
 
 
+SPARSE_VERSION:=$(shell git describe 2>/dev/null || echo '$(VERSION)')
+lib.o: version.h
+version.h: FORCE
+	@echo '#define SPARSE_VERSION "$(SPARSE_VERSION)"' > version.h.tmp
+	@if cmp -s version.h version.h.tmp; then \
+		rm version.h.tmp; \
+	else \
+		echo    '     GEN      '$@; \
+		mv version.h.tmp version.h; \
+	fi
+
+
 clean: clean-check
 	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h version.h
 
@@ -220,3 +224,5 @@ clean-check:
 	                 -o -name "*.c.error.got" \
 	                 -o -name "*.c.error.diff" \
 	                 \) -exec rm {} \;
+
+.PHONY: FORCE
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 19/37] build: add note about overwritable vars
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (17 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 18/37] build: only generate version.h when needed Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 20/37] build: remove references to unexisting pre-process.h Luc Van Oostenryck
                   ` (18 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index ea3ce89a4..f150b9eb9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
 VERSION=0.5.1
 
+########################################################################
+# The following variables can be overwritten from the command line
 OS = linux
 
 
@@ -24,6 +26,7 @@ MAN1DIR=$(MANDIR)/man1
 #     CFLAGS += -O0 -DDEBUG -g3 -gdwarf-2
 #
 -include local.mk
+########################################################################
 
 
 PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse \
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 20/37] build: remove references to unexisting pre-process.h
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (18 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 19/37] build: add note about overwritable vars Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 21/37] build: move clean & clean-check together Luc Van Oostenryck
                   ` (17 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 .gitignore | 1 -
 Makefile   | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9f996dc87..ab976e76b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,6 @@
 .*.swp
 
 # generated
-pre-process.h
 version.h
 
 # programs
diff --git a/Makefile b/Makefile
index f150b9eb9..a8578c305 100644
--- a/Makefile
+++ b/Makefile
@@ -207,7 +207,7 @@ version.h: FORCE
 
 
 clean: clean-check
-	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h version.h
+	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) version.h
 
 dist:
 	@if test "$(SPARSE_VERSION)" != "v$(VERSION)" ; then \
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 21/37] build: move clean & clean-check together
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (19 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 20/37] build: remove references to unexisting pre-process.h Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 22/37] build: make clean targets quieter Luc Van Oostenryck
                   ` (16 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index a8578c305..cd48a2a3b 100644
--- a/Makefile
+++ b/Makefile
@@ -206,9 +206,6 @@ version.h: FORCE
 	fi
 
 
-clean: clean-check
-	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) version.h

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 22/37] build: make clean targets quieter
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (20 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 21/37] build: move clean & clean-check together Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 23/37] build: remove rule for shared lib, it's unused Luc Van Oostenryck
                   ` (15 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index cd48a2a3b..af03d5dd5 100644
--- a/Makefile
+++ b/Makefile
@@ -218,9 +218,10 @@ check: all
 
 
 clean: clean-check
-	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) version.h
+	@rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) version.h
 clean-check:
-	find validation/ \( -name "*.c.output.expected" \
+	@echo '     CLEAN'
+	@find validation/ \( -name "*.c.output.expected" \
 	                 -o -name "*.c.output.got" \
 	                 -o -name "*.c.output.diff" \
 	                 -o -name "*.c.error.expected" \
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 23/37] build: remove rule for shared lib, it's unused
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (21 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 22/37] build: make clean targets quieter Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 24/37] build: normalize rules Luc Van Oostenryck
                   ` (14 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index af03d5dd5..0f69b479f 100644
--- a/Makefile
+++ b/Makefile
@@ -116,16 +116,7 @@ else
 $(warning Your system does not have llvm, disabling sparse-llvm)
 endif
 
-LIB_FILE= libsparse.a
-SLIB_FILE= libsparse.so
-
-# If you add $(SLIB_FILE) to this, you also need to add -fpic to CFLAGS above.
-# Doing so incurs a noticeable performance hit, and Sparse does not have a
-# stable shared library interface, so this does not occur by default.  If you
-# really want a shared library, you may want to build Sparse twice: once
-# without -fpic to get all the Sparse tools, and again with -fpic to get the
-# shared library.
-LIBS=$(LIB_FILE)
+LIBS := libsparse.a
 
 #
 # Pretty print
@@ -172,12 +163,9 @@ $(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_OBJS)))
 $(PROGRAMS): % : %.o $(LIBS)
 	$(QUIET_LINK)$(LD) $(ldflags) -o $@ $^ $(ldlibs)
 
-$(LIB_FILE): $(LIB_OBJS)
+libsparse.a: $(LIB_OBJS)
 	$(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)
 
-$(SLIB_FILE): $(LIB_OBJS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -Wl,-soname,$@ -shared -o $@ $(LIB_OBJS)

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 24/37] build: normalize rules
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (22 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 23/37] build: remove rule for shared lib, it's unused Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 25/37] build: remove the dist rule since unused Luc Van Oostenryck
                   ` (13 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 0f69b479f..b2638ae41 100644
--- a/Makefile
+++ b/Makefile
@@ -161,10 +161,10 @@ ldflags += $($(@)_LDFLAGS) $(LDFLAGS)
 ldlibs  += $($(@)_LDLIBS)  $(LDLIBS)
 $(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_OBJS)))
 $(PROGRAMS): % : %.o $(LIBS)
-	$(QUIET_LINK)$(LD) $(ldflags) -o $@ $^ $(ldlibs)
+	$(QUIET_LINK)$(LD) $(ldflags) $^ $(ldlibs) -o $@
 
 libsparse.a: $(LIB_OBJS)
-	$(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)
+	$(QUIET_AR)$(AR) rcs $@ $^
 
 OBJS := $(LIB_OBJS) $(PROGRAMS:%=%.o) $(foreach p,$(PROGRAMS),$($(p)_OBJS))
 DEPS := $(OBJS:%.o=.%.o.d)
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 25/37] build: remove the dist rule since unused
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (23 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 24/37] build: normalize rules Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 26/37] build: use one line per item Luc Van Oostenryck
                   ` (12 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

The last .tar.gz was for v0.5.0 in 2014.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/Makefile b/Makefile
index b2638ae41..0aaad52b3 100644
--- a/Makefile
+++ b/Makefile
@@ -194,13 +194,6 @@ version.h: FORCE
 	fi
 
 
-dist:
-	@if test "$(SPARSE_VERSION)" != "v$(VERSION)" ; then \
-		echo 'Update VERSION in the Makefile before running "make dist".' ; \
-		exit 1 ; \
-	fi
-	git archive --format=tar --prefix=sparse-$(VERSION)/ HEAD^{tree} | gzip -9 > sparse-$(VERSION).tar.gz

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 26/37] build: use one line per item
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (24 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 25/37] build: remove the dist rule since unused Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 27/37] build: use a dot file name instead of local.mk: .sparse.mk Luc Van Oostenryck
                   ` (11 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

This help to minimize merge conflicts.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 51 +++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 43 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 0aaad52b3..4f6ab108c 100644
--- a/Makefile
+++ b/Makefile
@@ -29,17 +29,52 @@ MAN1DIR=$(MANDIR)/man1
 ########################################################################
 
 
-PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse \
-	 test-linearize example test-unssa test-dissect ctags
+LIB_OBJS :=
+LIB_OBJS += allocate.o
+LIB_OBJS += builtin.o
+LIB_OBJS += char.o
+LIB_OBJS += compat-$(OS).o
+LIB_OBJS += cse.o
+LIB_OBJS += dissect.o
+LIB_OBJS += evaluate.o
+LIB_OBJS += expand.o
+LIB_OBJS += expression.o
+LIB_OBJS += flow.o
+LIB_OBJS += inline.o
+LIB_OBJS += lib.o
+LIB_OBJS += linearize.o
+LIB_OBJS += liveness.o
+LIB_OBJS += memops.o
+LIB_OBJS += parse.o
+LIB_OBJS += pre-process.o
+LIB_OBJS += ptrlist.o
+LIB_OBJS += scope.o
+LIB_OBJS += show-parse.o
+LIB_OBJS += simplify.o
+LIB_OBJS += sort.o
+LIB_OBJS += stats.o
+LIB_OBJS += storage.o
+LIB_OBJS += symbol.o
+LIB_OBJS += target.o
+LIB_OBJS += tokenize.o
+LIB_OBJS += unssa.o
+
+PROGRAMS :=
+PROGRAMS += compile
+PROGRAMS += ctags
+PROGRAMS += example
+PROGRAMS += graph
+PROGRAMS += obfuscate
+PROGRAMS += sparse
+PROGRAMS += test-dissect
+PROGRAMS += test-lexing
+PROGRAMS += test-linearize
+PROGRAMS += test-parsing
+PROGRAMS += test-unssa
+
 INST_PROGRAMS=sparse cgcc
 INST_MAN1=sparse.1 cgcc.1
 
-LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
-	  expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
-	  char.o sort.o allocate.o compat-$(OS).o ptrlist.o \
-	  builtin.o \
-	  stats.o \
-	  flow.o cse.o simplify.o memops.o liveness.o storage.o unssa.o dissect.o
 
 all:
 
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 27/37] build: use a dot file name instead of local.mk: .sparse.mk
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (25 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 26/37] build: use one line per item Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09 14:56   ` Ramsay Jones
  2017-11-09  6:46 ` [PATCH v3 28/37] build: use standard rules for install Luc Van Oostenryck
                   ` (10 subsequent siblings)
  37 siblings, 1 reply; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 .gitignore | 2 +-
 Makefile   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index ab976e76b..35b4d0248 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,7 +36,7 @@ patches
 series
 
 # local makefile
-local.mk
+.sparse.mk
 
 # cscope and Qt files
 cscope.out
diff --git a/Makefile b/Makefile
index 4f6ab108c..afc1efe98 100644
--- a/Makefile
+++ b/Makefile
@@ -21,11 +21,11 @@ MANDIR=$(PREFIX)/share/man
 MAN1DIR=$(MANDIR)/man1
 
 # Allow users to override build settings without dirtying their trees
-# For debugging, put this in local.mk:
+# For debugging, put this in .sparse.mk:
 #
 #     CFLAGS += -O0 -DDEBUG -g3 -gdwarf-2
 #
--include local.mk
+-include .sparse.mk
 ########################################################################
 
 
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 28/37] build: use standard rules for install
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (26 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 27/37] build: use a dot file name instead of local.mk: .sparse.mk Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 29/37] build: remove unused QUIET_INST_SH Luc Van Oostenryck
                   ` (9 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 35 ++++++++++++++---------------------
 1 file changed, 14 insertions(+), 21 deletions(-)

diff --git a/Makefile b/Makefile
index afc1efe98..d26b294d2 100644
--- a/Makefile
+++ b/Makefile
@@ -167,31 +167,11 @@ QUIET_LINK    = $(Q:@=@echo    '     LINK     '$@;)
 QUIET_INST_SH = $(Q:@=echo -n  '     INSTALL  ';)
 QUIET_INST    = $(Q:@=@echo -n '     INSTALL  ';)
 
-define INSTALL_EXEC
-	$(QUIET_INST)install -v $1 $(DESTDIR)$2/$1 || exit 1;
-
-endef
-
-define INSTALL_FILE
-	$(QUIET_INST)install -v -m 644 $1 $(DESTDIR)$2/$1 || exit 1;
-
-endef
-
 
+compile_OBJS := compile-i386.o
 
 all: $(PROGRAMS)
 
-all-installable: $(INST_PROGRAMS)
-
-install: all-installable
-	$(Q)install -d $(DESTDIR)$(BINDIR)
-	$(Q)install -d $(DESTDIR)$(MAN1DIR)
-	$(foreach f,$(INST_PROGRAMS),$(call INSTALL_EXEC,$f,$(BINDIR)))
-	$(foreach f,$(INST_MAN1),$(call INSTALL_FILE,$f,$(MAN1DIR)))
-
-
-compile_OBJS := compile-i386.o

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 29/37] build: remove unused QUIET_INST_SH
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (27 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 28/37] build: use standard rules for install Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 30/37] build: let quiet commands use less indentation Luc Van Oostenryck
                   ` (8 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Makefile b/Makefile
index d26b294d2..92b885d8a 100644
--- a/Makefile
+++ b/Makefile
@@ -164,7 +164,6 @@ QUIET_AR      = $(Q:@=@echo    '     AR       '$@;)
 QUIET_GEN     = $(Q:@=@echo    '     GEN      '$@;)
 QUIET_LINK    = $(Q:@=@echo    '     LINK     '$@;)
 # We rely on the -v switch of install to print 'file -> $install_dir/file'
-QUIET_INST_SH = $(Q:@=echo -n  '     INSTALL  ';)
 QUIET_INST    = $(Q:@=@echo -n '     INSTALL  ';)
 
 
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 30/37] build: let quiet commands use less indentation
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (28 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 29/37] build: remove unused QUIET_INST_SH Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 31/37] build: simplify quiet commands Luc Van Oostenryck
                   ` (7 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Now it does the same as done in the kernel: 2 + 8.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 92b885d8a..dc9ba9cde 100644
--- a/Makefile
+++ b/Makefile
@@ -158,13 +158,13 @@ LIBS := libsparse.a
 #
 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     '$@;)
+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    $@";)
 # We rely on the -v switch of install to print 'file -> $install_dir/file'
-QUIET_INST    = $(Q:@=@echo -n '     INSTALL  ';)
+QUIET_INST    = $(Q:@=@echo -n "  INSTALL ";)
 
 
 compile_OBJS := compile-i386.o
@@ -203,7 +203,7 @@ version.h: FORCE
 	@if cmp -s version.h version.h.tmp; then \
 		rm version.h.tmp; \
 	else \
-		echo    '     GEN      '$@; \
+		echo "  GEN     $@"; \
 		mv version.h.tmp version.h; \
 	fi
 
@@ -215,7 +215,7 @@ check: all
 clean: clean-check
 	@rm -f *.[oa] .*.d $(PROGRAMS) version.h
 clean-check:
-	@echo '     CLEAN'
+	@echo "  CLEAN"
 	@find validation/ \( -name "*.c.output.expected" \
 	                 -o -name "*.c.output.got" \
 	                 -o -name "*.c.output.diff" \
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 31/37] build: simplify quiet commands
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (29 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 30/37] build: let quiet commands use less indentation Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 32/37] build: simplify clean pattern Luc Van Oostenryck
                   ` (6 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

The current mechanism for the quiet commands, what's
hiding the true command and emitting instead things like:
	CC      target.o
is, IMO, somehow unneedlessly sophisticated and this doesn't help
to understand what's happening and to adapt things when needed.

Change this by using simple 'echo' commands and make's '@' to
display the short command and hiding the long one.

Warning: There is a small change in behaviour with this:
  previously, when displaying the non-quiet commands with
  'make V=1' the quiet ones were not emitted. Now, with this
  patch, the short/quiet command is emitted in both case.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index dc9ba9cde..c861ca090 100644
--- a/Makefile
+++ b/Makefile
@@ -158,13 +158,6 @@ LIBS := libsparse.a
 #
 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    $@";)
-# We rely on the -v switch of install to print 'file -> $install_dir/file'
-QUIET_INST    = $(Q:@=@echo -n "  INSTALL ";)
 
 
 compile_OBJS := compile-i386.o
@@ -175,10 +168,12 @@ ldflags += $($(@)_LDFLAGS) $(LDFLAGS)
 ldlibs  += $($(@)_LDLIBS)  $(LDLIBS)
 $(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_OBJS)))
 $(PROGRAMS): % : %.o $(LIBS)
-	$(QUIET_LINK)$(LD) $(ldflags) $^ $(ldlibs) -o $@
+	@echo "  LD      $@"
+	$(Q)$(LD) $(ldflags) $^ $(ldlibs) -o $@
 
 libsparse.a: $(LIB_OBJS)
-	$(QUIET_AR)$(AR) rcs $@ $^
+	@echo "  AR      $@"
+	$(Q)$(AR) rcs $@ $^
 
 OBJS := $(LIB_OBJS) $(PROGRAMS:%=%.o) $(foreach p,$(PROGRAMS),$($(p)_OBJS))
 DEPS := $(OBJS:%.o=.%.o.d)
@@ -188,10 +183,12 @@ DEPS := $(OBJS:%.o=.%.o.d)
 
 cflags   += $($(*)_CFLAGS) $(CPPFLAGS) $(CFLAGS)
 %.o: %.c
-	$(QUIET_CC)$(CC) $(cflags) -c -o $@ $<
+	@echo "  CC      $@"
+	$(Q)$(CC) $(cflags) -c -o $@ $<
 
 %.sc: %.c sparse
-	$(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) $(cflags) -c $<
+	@echo "  CHECK   $<"
+	$(Q) $(CHECKER) $(CHECKER_FLAGS) $(cflags) -c $<
 
 selfcheck: $(OBJS:.o=.sc)
 
@@ -233,8 +230,10 @@ install-bin: $(INST_PROGRAMS:%=$(DESTDIR)$(BINDIR)/%)
 install-man: $(INST_MAN1:%=$(DESTDIR)$(MAN1DIR)/%)
 
 $(DESTDIR)$(BINDIR)/%: %
-	$(QUIET_INST)install -v        $< $@ || exit 1;
+	@echo "  INSTALL $@"
+	$(Q)install        $< $@ || exit 1;
 $(DESTDIR)$(MAN1DIR)/%: %
-	$(QUIET_INST)install -v -m 644 $< $@ || exit 1;
+	@echo "  INSTALL $@"
+	$(Q)install -m 644 $< $@ || exit 1;
 
 .PHONY: FORCE
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 32/37] build: simplify clean pattern
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (30 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 31/37] build: simplify quiet commands Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 33/37] build: add *.o to clean-check pattern Luc Van Oostenryck
                   ` (5 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index c861ca090..bdb6c03af 100644
--- a/Makefile
+++ b/Makefile
@@ -213,13 +213,9 @@ clean: clean-check
 	@rm -f *.[oa] .*.d $(PROGRAMS) version.h
 clean-check:
 	@echo "  CLEAN"
-	@find validation/ \( -name "*.c.output.expected" \
-	                 -o -name "*.c.output.got" \
-	                 -o -name "*.c.output.diff" \
-	                 -o -name "*.c.error.expected" \
-	                 -o -name "*.c.error.got" \
-	                 -o -name "*.c.error.diff" \
-	                 \) -exec rm {} \;
+	@find validation/ \( -name "*.c.output.*" \
+			  -o -name "*.c.error.*" \
+	                  \) -exec rm {} \;
 
 
 install: $(INST_PROGRAMS) $(INST_MAN1) install-dirs install-bin install-man
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 33/37] build: add *.o to clean-check pattern
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (31 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 32/37] build: simplify clean pattern Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 34/37] build: avoid foreach Luc Van Oostenryck
                   ` (4 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

.o files are also created in the validation directory
(currently only tmp.o, for sparse-llvm/sparsec testing).

Aso remove them during make clean-check.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index bdb6c03af..4c2012977 100644
--- a/Makefile
+++ b/Makefile
@@ -215,6 +215,7 @@ clean-check:
 	@echo "  CLEAN"
 	@find validation/ \( -name "*.c.output.*" \
 			  -o -name "*.c.error.*" \
+			  -o -name "*.o" \
 	                  \) -exec rm {} \;
 
 
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 34/37] build: avoid foreach
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (32 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 33/37] build: add *.o to clean-check pattern Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 35/37] build: reorg & add comment Luc Van Oostenryck
                   ` (3 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

(g)make foreach can be quite handy but it also make
Makefiles much less declarative and thus harder to read.

Avoid them by adding the few needed assignments & dependencies.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 4c2012977..bb45155af 100644
--- a/Makefile
+++ b/Makefile
@@ -84,6 +84,9 @@ cflags += -DGCC_BASE=\"$(GCC_BASE)\"
 MULTIARCH_TRIPLET := $(shell $(CC) -print-multiarch 2>/dev/null)
 cflags += -DMULTIARCH_TRIPLET=\"$(MULTIARCH_TRIPLET)\"
 
+compile: compile-i386.o
+EXTRA_OBJS += compile-i386.o
+
 # Can we use GCC's generated dependencies?
 HAVE_GCC_DEP:=$(shell touch .gcc-test.c && 				\
 		$(CC) -c -Wp,-MD,.gcc-test.d .gcc-test.c 2>/dev/null && \
@@ -112,13 +115,15 @@ HAVE_GTK:=$(shell $(PKG_CONFIG) --exists gtk+-$(GTK_VERSION) 2>/dev/null && echo
 endif
 ifeq ($(HAVE_GTK),yes)
 GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-$(GTK_VERSION))
-GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-$(GTK_VERSION))
+ast-view_CFLAGS := $(GTK_CFLAGS)
+ast-model_CFLAGS := $(GTK_CFLAGS)
+ast-inspect_CFLAGS := $(GTK_CFLAGS)
+test-inspect_CFLAGS := $(GTK_CFLAGS)
+test-inspect_LDLIBS := $(shell $(PKG_CONFIG) --libs gtk+-$(GTK_VERSION))
+test-inspect: ast-model.o ast-view.o ast-inspect.o
+EXTRA_OBJS += ast-model.o ast-view.o ast-inspect.o
 PROGRAMS += test-inspect
 INST_PROGRAMS += test-inspect
-test-inspect_OBJS := test-inspect.o
-test-inspect_OBJS += ast-model.o ast-view.o ast-inspect.o
-$(foreach p,$(test-inspect_OBJS:.o=),$(eval $(p)_CFLAGS := $(GTK_CFLAGS)))
-test-inspect_LDLIBS := $(GTK_LIBS)
 else
 $(warning Your system does not have gtk3/gtk2, disabling test-inspect)
 endif
@@ -160,13 +165,10 @@ V	      = @
 Q	      = $(V:1=)
 
 
-compile_OBJS := compile-i386.o

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 35/37] build: reorg & add comment
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (33 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 34/37] build: avoid foreach Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 36/37] build: use a single space before assignments Luc Van Oostenryck
                   ` (2 subsequent siblings)
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

No functionnal changes here, only shuffling a few lines around,
adding separators and adding a few comments

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index bb45155af..afae2a370 100644
--- a/Makefile
+++ b/Makefile
@@ -84,6 +84,9 @@ cflags += -DGCC_BASE=\"$(GCC_BASE)\"
 MULTIARCH_TRIPLET := $(shell $(CC) -print-multiarch 2>/dev/null)
 cflags += -DMULTIARCH_TRIPLET=\"$(MULTIARCH_TRIPLET)\"
 
+########################################################################
+# target specificities
+
 compile: compile-i386.o
 EXTRA_OBJS += compile-i386.o
 
@@ -156,15 +159,15 @@ else
 $(warning Your system does not have llvm, disabling sparse-llvm)
 endif
 
+########################################################################
 LIBS := libsparse.a
+OBJS := $(LIB_OBJS) $(EXTRA_OBJS) $(PROGRAMS:%=%.o)
 
-#
 # Pretty print
-#
 V	      = @
 Q	      = $(V:1=)
 
-
+########################################################################
 all: $(PROGRAMS)
 
 ldflags += $($(@)_LDFLAGS) $(LDFLAGS)
@@ -177,11 +180,6 @@ libsparse.a: $(LIB_OBJS)
 	@echo "  AR      $@"
 	$(Q)$(AR) rcs $@ $^
 
-OBJS := $(LIB_OBJS) $(EXTRA_OBJS) $(PROGRAMS:%=%.o)
-DEPS := $(OBJS:%.o=.%.o.d)
-
--include $(DEPS)

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 36/37] build: use a single space before assignments
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (34 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 35/37] build: reorg & add comment Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09  6:46 ` [PATCH v3 37/37] build: add rule to run a single test Luc Van Oostenryck
  2017-11-09 19:11 ` [PATCH v3 00/37] Makefile reorganization Christopher Li
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index afae2a370..d7bcbf465 100644
--- a/Makefile
+++ b/Makefile
@@ -164,8 +164,8 @@ LIBS := libsparse.a
 OBJS := $(LIB_OBJS) $(EXTRA_OBJS) $(PROGRAMS:%=%.o)
 
 # Pretty print
-V	      = @
-Q	      = $(V:1=)
+V := @
+Q := $(V:1=)
 
 ########################################################################
 all: $(PROGRAMS)
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v3 37/37] build: add rule to run a single test
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (35 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 36/37] build: use a single space before assignments Luc Van Oostenryck
@ 2017-11-09  6:46 ` Luc Van Oostenryck
  2017-11-09 19:11 ` [PATCH v3 00/37] Makefile reorganization Christopher Li
  37 siblings, 0 replies; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:46 UTC (permalink / raw)
  To: linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton, Luc Van Oostenryck

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index d7bcbf465..cf04ec61d 100644
--- a/Makefile
+++ b/Makefile
@@ -207,6 +207,8 @@ version.h: FORCE
 
 check: all
 	$(Q)cd validation && ./test-suite
+validation/%.t: FORCE
+	@validation/test-suite single $*.c
 
 
 clean: clean-check
-- 
2.14.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* Re: [PATCH v3 27/37] build: use a dot file name instead of local.mk: .sparse.mk
  2017-11-09  6:46 ` [PATCH v3 27/37] build: use a dot file name instead of local.mk: .sparse.mk Luc Van Oostenryck
@ 2017-11-09 14:56   ` Ramsay Jones
  2017-11-09 15:18     ` Luc Van Oostenryck
  0 siblings, 1 reply; 44+ messages in thread
From: Ramsay Jones @ 2017-11-09 14:56 UTC (permalink / raw)
  To: Luc Van Oostenryck, linux-sparse
  Cc: Uwe Kleine-König, Josh Triplett, Jeff Layton



On 09/11/17 06:46, Luc Van Oostenryck wrote:
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  .gitignore | 2 +-
>  Makefile   | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/.gitignore b/.gitignore
> index ab976e76b..35b4d0248 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -36,7 +36,7 @@ patches
>  series
>  
>  # local makefile
> -local.mk
> +.sparse.mk
>  
>  # cscope and Qt files
>  cscope.out
> diff --git a/Makefile b/Makefile
> index 4f6ab108c..afc1efe98 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -21,11 +21,11 @@ MANDIR=$(PREFIX)/share/man
>  MAN1DIR=$(MANDIR)/man1
>  
>  # Allow users to override build settings without dirtying their trees
> -# For debugging, put this in local.mk:
> +# For debugging, put this in .sparse.mk:
>  #
>  #     CFLAGS += -O0 -DDEBUG -g3 -gdwarf-2
>  #
> --include local.mk
> +-include .sparse.mk
>  ########################################################################
>  
>  
> 

I don't see any reason to make this change. The commit message
does not make a very convincing argument! :-D

ATB,
Ramsay Jones


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v3 27/37] build: use a dot file name instead of local.mk: .sparse.mk
  2017-11-09 14:56   ` Ramsay Jones
@ 2017-11-09 15:18     ` Luc Van Oostenryck
  2017-11-09 15:28       ` Ramsay Jones
  0 siblings, 1 reply; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09 15:18 UTC (permalink / raw)
  To: Ramsay Jones
  Cc: Linux-Sparse, Uwe Kleine-König, Josh Triplett, Jeff Layton

On Thu, Nov 9, 2017 at 3:56 PM, Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
> On 09/11/17 06:46, Luc Van Oostenryck wrote:
>> --include local.mk
>> +-include .sparse.mk
>>  ########################################################################
>
> I don't see any reason to make this change. The commit message
> does not make a very convincing argument! :-D

Uwe had already the same reaction. Here was the exchange:
>> Hello Luc,
>>
>> > -local.mk
>> > +.sparse.mk
>>
>> what is the motivation to hide this file? IMHO it is better to be aware
>> of eventual changes to the build system and so don't hide the file.
>>
>> Having said that I question if it is a good idea at all to provide a way
>> to change the build without dirtying the working copy.
>
> I confess that this change is just for my own comfort.
> I often need to change the CFLAGS while debugging or profiling.
> I want that to be in a file, the file must of course not be under
> version control and like .bashrc, kernel's .config or GCC's generated
> .*.o.d files, I don't need to see this file and so I prefer it's a
> hidden one.
>
> I understand your worries but since it's a file purposely changed
> so that files are compiled differently, there are no surprises.
> For dirtying the build ... yes, something could be done but really,
> personally, I don't need this, I know when I need to clean my tree.

So, yes, certainly not a strong argument.

I think I'll take a slightly different way, one that will suit me even better,
something like:
-include local.mk
+SPARSE_LOCAL_MK ?= local.mk
+include ${SPARSE_LOCAL_MK}

Would this be less objectionable?

Regards,
-- Luc

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v3 27/37] build: use a dot file name instead of local.mk: .sparse.mk
  2017-11-09 15:18     ` Luc Van Oostenryck
@ 2017-11-09 15:28       ` Ramsay Jones
  0 siblings, 0 replies; 44+ messages in thread
From: Ramsay Jones @ 2017-11-09 15:28 UTC (permalink / raw)
  To: Luc Van Oostenryck
  Cc: Linux-Sparse, Uwe Kleine-König, Josh Triplett, Jeff Layton



On 09/11/17 15:18, Luc Van Oostenryck wrote:
> On Thu, Nov 9, 2017 at 3:56 PM, Ramsay Jones
> <ramsay@ramsayjones.plus.com> wrote:
>> On 09/11/17 06:46, Luc Van Oostenryck wrote:
>>> --include local.mk
>>> +-include .sparse.mk
>>>  ########################################################################
>>
>> I don't see any reason to make this change. The commit message
>> does not make a very convincing argument! :-D
> 
> Uwe had already the same reaction. Here was the exchange:
>>> Hello Luc,
>>>
>>>> -local.mk
>>>> +.sparse.mk
>>>
>>> what is the motivation to hide this file? IMHO it is better to be aware
>>> of eventual changes to the build system and so don't hide the file.
>>>
>>> Having said that I question if it is a good idea at all to provide a way
>>> to change the build without dirtying the working copy.
>>
>> I confess that this change is just for my own comfort.
>> I often need to change the CFLAGS while debugging or profiling.
>> I want that to be in a file, the file must of course not be under
>> version control and like .bashrc, kernel's .config or GCC's generated
>> .*.o.d files, I don't need to see this file and so I prefer it's a
>> hidden one.

Hmm, I *much* prefer that such a file is *not* a hidden one! ;-)

>> I understand your worries but since it's a file purposely changed
>> so that files are compiled differently, there are no surprises.
>> For dirtying the build ... yes, something could be done but really,
>> personally, I don't need this, I know when I need to clean my tree.
> 
> So, yes, certainly not a strong argument.
> 
> I think I'll take a slightly different way, one that will suit me even better,
> something like:
> -include local.mk
> +SPARSE_LOCAL_MK ?= local.mk
> +include ${SPARSE_LOCAL_MK}
> 
> Would this be less objectionable?

Yes, thanks.

ATB,
Ramsay Jones



^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v3 00/37] Makefile reorganization
  2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
                   ` (36 preceding siblings ...)
  2017-11-09  6:46 ` [PATCH v3 37/37] build: add rule to run a single test Luc Van Oostenryck
@ 2017-11-09 19:11 ` Christopher Li
  2017-11-09 20:54   ` Luc Van Oostenryck
  37 siblings, 1 reply; 44+ messages in thread
From: Christopher Li @ 2017-11-09 19:11 UTC (permalink / raw)
  To: Luc Van Oostenryck
  Cc: Linux-Sparse, Uwe Kleine-König, Josh Triplett, Jeff Layton

On Thu, Nov 9, 2017 at 2:46 PM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> The goal of this series is to reorganize sparse's Makefile
> in order to offer a few features asked by the distros:
> 1) allow CFLAGS & CPPFLAGS to be taken from the command line

That can be done in one patch.

> 2) allow PREFIX to be taken from the environment

Not straightly necessary. You can invoke "make PREFIX=$PREFIX".

I will have to hold of the review of this series as well
as I feel most of the review is not straightly necessary.

Some of the stuff get removed, I am actually still using.

Another thing is that, there is an earlier debug version of sparse
makefile change under discussion. I have express that I want to
hold off big Makefile changes until the debug version series
reach to some conclusion.

In general I don't like big rewrite and rename for the
sake of rewrite.

Chris

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v3 00/37] Makefile reorganization
  2017-11-09 19:11 ` [PATCH v3 00/37] Makefile reorganization Christopher Li
@ 2017-11-09 20:54   ` Luc Van Oostenryck
  2017-11-09 21:03     ` Christopher Li
  0 siblings, 1 reply; 44+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09 20:54 UTC (permalink / raw)
  To: Christopher Li
  Cc: Linux-Sparse, Uwe Kleine-König, Josh Triplett, Jeff Layton

On Fri, Nov 10, 2017 at 03:11:10AM +0800, Christopher Li wrote:
> On Thu, Nov 9, 2017 at 2:46 PM, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> > The goal of this series is to reorganize sparse's Makefile
> > in order to offer a few features asked by the distros:
> > 1) allow CFLAGS & CPPFLAGS to be taken from the command line
> 
> That can be done in one patch.
> 
> > 2) allow PREFIX to be taken from the environment
> 
> Not straightly necessary. You can invoke "make PREFIX=$PREFIX".
> 
> I will have to hold of the review of this series as well
> as I feel most of the review is not straightly necessary.
> 
> Some of the stuff get removed, I am actually still using.

Good.

> Another thing is that, there is an earlier debug version of sparse
> makefile change under discussion. I have express that I want to
> hold off big Makefile changes until the debug version series
> reach to some conclusion.

I know, and it's why I said earlier that these patches were for my
development tree, I never thought you could be interested in them.
 
Regards,
-- Luc

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v3 00/37] Makefile reorganization
  2017-11-09 20:54   ` Luc Van Oostenryck
@ 2017-11-09 21:03     ` Christopher Li
  0 siblings, 0 replies; 44+ messages in thread
From: Christopher Li @ 2017-11-09 21:03 UTC (permalink / raw)
  To: Luc Van Oostenryck
  Cc: Linux-Sparse, Uwe Kleine-König, Josh Triplett, Jeff Layton

On Fri, Nov 10, 2017 at 4:54 AM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:

>> Another thing is that, there is an earlier debug version of sparse
>> makefile change under discussion. I have express that I want to
>> hold off big Makefile changes until the debug version series
>> reach to some conclusion.
>
> I know, and it's why I said earlier that these patches were for my
> development tree, I never thought you could be interested in them.

Ah, sorry I did not get that earlier. Hopefully I can to the backlog
quickly. With that many patches it does get my stress level high :-)

Chris

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2017-11-09 21:03 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09  6:46 [PATCH v3 00/37] Makefile reorganization Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 01/37] build: make PREFIX overwritable from the environment Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 02/37] build: put comment about local.mk to the place where it is included Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 03/37] build: drop BASIC_CFLAGS and ALL_CFLAGS Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 04/37] build: drop -g from LDFLAGS Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 05/37] build: pass CPPFLAGS to compiler Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 06/37] build: fix effectiveness of generated dependencies Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 07/37] build: remove unused support for pkgconfig Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 08/37] build: use '_OBJS' instead of '_EXTRA_DEPS' Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 09/37] build: use '_LDLIBS' instead of '_EXTRA_OBJS' Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 10/37] build: allow target-specific CFLAGS, CPPFLAGS, LDFLAGS & LDLIBS Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 11/37] build: allow CFLAGS & friends from command line Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 12/37] build: avoid rule-specific CFLAGS Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 13/37] build: use $LIBS directly in the dependency list Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 14/37] build: no need to use wildcards for generated dependencies Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 15/37] build: reuse rule for ALL_OBJS Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 16/37] build: CHECKER_FLAGS=-Wno-vla for all targets Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 17/37] build: move tests near their use Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 18/37] build: only generate version.h when needed Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 19/37] build: add note about overwritable vars Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 20/37] build: remove references to unexisting pre-process.h Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 21/37] build: move clean & clean-check together Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 22/37] build: make clean targets quieter Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 23/37] build: remove rule for shared lib, it's unused Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 24/37] build: normalize rules Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 25/37] build: remove the dist rule since unused Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 26/37] build: use one line per item Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 27/37] build: use a dot file name instead of local.mk: .sparse.mk Luc Van Oostenryck
2017-11-09 14:56   ` Ramsay Jones
2017-11-09 15:18     ` Luc Van Oostenryck
2017-11-09 15:28       ` Ramsay Jones
2017-11-09  6:46 ` [PATCH v3 28/37] build: use standard rules for install Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 29/37] build: remove unused QUIET_INST_SH Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 30/37] build: let quiet commands use less indentation Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 31/37] build: simplify quiet commands Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 32/37] build: simplify clean pattern Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 33/37] build: add *.o to clean-check pattern Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 34/37] build: avoid foreach Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 35/37] build: reorg & add comment Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 36/37] build: use a single space before assignments Luc Van Oostenryck
2017-11-09  6:46 ` [PATCH v3 37/37] build: add rule to run a single test Luc Van Oostenryck
2017-11-09 19:11 ` [PATCH v3 00/37] Makefile reorganization Christopher Li
2017-11-09 20:54   ` Luc Van Oostenryck
2017-11-09 21:03     ` Christopher Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.