All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/36] Makefile reorganization
@ 2017-11-05 16:24 Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 01/36] build: make PREFIX overwritable from the environment Luc Van Oostenryck
                   ` (36 more replies)
  0 siblings, 37 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:24 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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 series is available for review & testing at:
  git://github.com/lucvoo/sparse.git make-cleanup

-- Luc Van Oostenryck

Luc Van Oostenryck (30):
  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: no need to clean *.so and SLIB_FILE
  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 git-clean
  build: use standard rules for install
  build: remove unused QUIET_INST_SH
  build: let quiet commands use less indentation
  build: simpler logic for quiet commands
  build: avoid foreach
  build: reorg & add comment
  build: use a single space before assignments

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     | 309 ++++++++++++++++++++++++++++-------------------------------
 sparse.pc.in |   9 --
 3 files changed, 150 insertions(+), 172 deletions(-)
 delete mode 100644 sparse.pc.in

-- 
2.14.0


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

* [PATCH 01/36] build: make PREFIX overwritable from the environment
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 17:44   ` Josh Triplett
  2017-11-05 16:25 ` [PATCH 02/36] build: put comment about local.mk to the place where it is included Luc Van Oostenryck
                   ` (35 subsequent siblings)
  36 siblings, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 02/36] build: put comment about local.mk to the place where it is included
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 01/36] build: make PREFIX overwritable from the environment Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 17:44   ` Josh Triplett
  2017-11-05 16:25 ` [PATCH 03/36] build: drop BASIC_CFLAGS and ALL_CFLAGS Luc Van Oostenryck
                   ` (34 subsequent siblings)
  36 siblings, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, Luc Van Oostenryck

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

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.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] 67+ messages in thread

* [PATCH 03/36] build: drop BASIC_CFLAGS and ALL_CFLAGS
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 01/36] build: make PREFIX overwritable from the environment Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 02/36] build: put comment about local.mk to the place where it is included Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 04/36] build: drop -g from LDFLAGS Luc Van Oostenryck
                   ` (33 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 04/36] build: drop -g from LDFLAGS
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (2 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 03/36] build: drop BASIC_CFLAGS and ALL_CFLAGS Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 17:45   ` Josh Triplett
  2017-11-05 16:25 ` [PATCH 05/36] build: pass CPPFLAGS to compiler Luc Van Oostenryck
                   ` (32 subsequent siblings)
  36 siblings, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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>
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] 67+ messages in thread

* [PATCH 05/36] build: pass CPPFLAGS to compiler
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (3 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 04/36] build: drop -g from LDFLAGS Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 17:46   ` Josh Triplett
  2017-11-05 16:25 ` [PATCH 06/36] build: fix effectiveness of generated dependencies Luc Van Oostenryck
                   ` (31 subsequent siblings)
  36 siblings, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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>
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] 67+ messages in thread

* [PATCH 06/36] build: fix effectiveness of generated dependencies
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (4 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 05/36] build: pass CPPFLAGS to compiler Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 07/36] build: remove unused support for pkgconfig Luc Van Oostenryck
                   ` (30 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 07/36] build: remove unused support for pkgconfig
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (5 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 06/36] build: fix effectiveness of generated dependencies Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 08/36] build: use '_OBJS' instead of '_EXTRA_DEPS' Luc Van Oostenryck
                   ` (29 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 08/36] build: use '_OBJS' instead of '_EXTRA_DEPS'
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (6 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 07/36] build: remove unused support for pkgconfig Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 09/36] build: use '_LDLIBS' instead of '_EXTRA_OBJS' Luc Van Oostenryck
                   ` (28 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 09/36] build: use '_LDLIBS' instead of '_EXTRA_OBJS'
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (7 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 08/36] build: use '_OBJS' instead of '_EXTRA_DEPS' Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 10/36] build: allow target-specific CFLAGS, CPPFLAGS, LDFLAGS & LDLIBS Luc Van Oostenryck
                   ` (27 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 10/36] build: allow target-specific CFLAGS, CPPFLAGS, LDFLAGS & LDLIBS
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (8 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 09/36] build: use '_LDLIBS' instead of '_EXTRA_OBJS' Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 11/36] build: allow CFLAGS & friends from command line Luc Van Oostenryck
                   ` (26 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 11/36] build: allow CFLAGS & friends from command line
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (9 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 10/36] build: allow target-specific CFLAGS, CPPFLAGS, LDFLAGS & LDLIBS Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 12/36] build: avoid rule-specific CFLAGS Luc Van Oostenryck
                   ` (25 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 12/36] build: avoid rule-specific CFLAGS
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (10 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 11/36] build: allow CFLAGS & friends from command line Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 13/36] build: use $LIBS directly in the dependency list Luc Van Oostenryck
                   ` (24 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 13/36] build: use $LIBS directly in the dependency list
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (11 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 12/36] build: avoid rule-specific CFLAGS Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 14/36] build: no need to use wildcards for generated dependencies Luc Van Oostenryck
                   ` (23 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 14/36] build: no need to use wildcards for generated dependencies
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (12 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 13/36] build: use $LIBS directly in the dependency list Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 15/36] build: reuse rule for ALL_OBJS Luc Van Oostenryck
                   ` (22 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 15/36] build: reuse rule for ALL_OBJS
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (13 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 14/36] build: no need to use wildcards for generated dependencies Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 16/36] build: CHECKER_FLAGS=-Wno-vla for all targets Luc Van Oostenryck
                   ` (21 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 16/36] build: CHECKER_FLAGS=-Wno-vla for all targets
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (14 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 15/36] build: reuse rule for ALL_OBJS Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 17/36] build: move tests near their use Luc Van Oostenryck
                   ` (20 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 17/36] build: move tests near their use
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (15 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 16/36] build: CHECKER_FLAGS=-Wno-vla for all targets Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 18/36] build: only generate version.h when needed Luc Van Oostenryck
                   ` (19 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 18/36] build: only generate version.h when needed
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (16 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 17/36] build: move tests near their use Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 19/36] build: add note about overwritable vars Luc Van Oostenryck
                   ` (18 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 19/36] build: add note about overwritable vars
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (17 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 18/36] build: only generate version.h when needed Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 20/36] build: remove references to unexisting pre-process.h Luc Van Oostenryck
                   ` (17 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 20/36] build: remove references to unexisting pre-process.h
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (18 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 19/36] build: add note about overwritable vars Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 21/36] build: no need to clean *.so and SLIB_FILE Luc Van Oostenryck
                   ` (16 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 21/36] build: no need to clean *.so and SLIB_FILE
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (19 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 20/36] build: remove references to unexisting pre-process.h Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 17:48   ` Josh Triplett
  2017-11-05 16:25 ` [PATCH 22/36] build: move clean & clean-check together Luc Van Oostenryck
                   ` (15 subsequent siblings)
  36 siblings, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, Luc Van Oostenryck

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 a8578c305..23c334132 100644
--- a/Makefile
+++ b/Makefile
@@ -207,7 +207,7 @@ version.h: FORCE
 
 
 clean: clean-check
-	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) version.h
+	rm -f *.[oa] .*.d $(PROGRAMS) $(SLIB_FILE) version.h
 
 dist:
 	@if test "$(SPARSE_VERSION)" != "v$(VERSION)" ; then \
-- 
2.14.0


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

* [PATCH 22/36] build: move clean & clean-check together
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (20 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 21/36] build: no need to clean *.so and SLIB_FILE Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 23/36] build: make clean targets quieter Luc Van Oostenryck
                   ` (14 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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 23c334132..bc161fd7f 100644
--- a/Makefile
+++ b/Makefile
@@ -206,9 +206,6 @@ version.h: FORCE
 	fi
 
 
-clean: clean-check
-	rm -f *.[oa] .*.d $(PROGRAMS) $(SLIB_FILE) version.h

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

* [PATCH 23/36] build: make clean targets quieter
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (21 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 22/36] build: move clean & clean-check together Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 24/36] build: remove rule for shared lib, it's unused Luc Van Oostenryck
                   ` (13 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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 bc161fd7f..8132142af 100644
--- a/Makefile
+++ b/Makefile
@@ -218,9 +218,10 @@ check: all
 
 
 clean: clean-check
-	rm -f *.[oa] .*.d $(PROGRAMS) $(SLIB_FILE) version.h
+	@rm -f *.[oa] .*.d $(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] 67+ messages in thread

* [PATCH 24/36] build: remove rule for shared lib, it's unused
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (22 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 23/36] build: make clean targets quieter Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 25/36] build: normalize rules Luc Van Oostenryck
                   ` (12 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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 8132142af..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] 67+ messages in thread

* [PATCH 25/36] build: normalize rules
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (23 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 24/36] build: remove rule for shared lib, it's unused Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 26/36] build: remove the dist rule since unused Luc Van Oostenryck
                   ` (11 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 26/36] build: remove the dist rule since unused
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (24 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 25/36] build: normalize rules Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 27/36] build: use one line per item Luc Van Oostenryck
                   ` (10 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 27/36] build: use one line per item
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (25 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 26/36] build: remove the dist rule since unused Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 28/36] build: use a dot file name instead of local.mk: .sparse.mk Luc Van Oostenryck
                   ` (9 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 28/36] build: use a dot file name instead of local.mk: .sparse.mk
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (26 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 27/36] build: use one line per item Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-06  8:57   ` Uwe Kleine-König
  2017-11-05 16:25 ` [PATCH 29/36] build: use git-clean Luc Van Oostenryck
                   ` (8 subsequent siblings)
  36 siblings, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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] 67+ messages in thread

* [PATCH 29/36] build: use git-clean
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (27 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 28/36] build: use a dot file name instead of local.mk: .sparse.mk Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 17:41   ` Josh Triplett
  2017-11-08 11:42   ` Jeff Layton
  2017-11-05 16:25 ` [PATCH 30/36] build: use standard rules for install Luc Van Oostenryck
                   ` (7 subsequent siblings)
  36 siblings, 2 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, Luc Van Oostenryck

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

diff --git a/Makefile b/Makefile
index afc1efe98..f0f7a5b69 100644
--- a/Makefile
+++ b/Makefile
@@ -233,16 +233,8 @@ check: all
 	$(Q)cd validation && ./test-suite
 
 
-clean: clean-check
-	@rm -f *.[oa] .*.d $(PROGRAMS) version.h
-clean-check:
+clean: FORCE
 	@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 {} \;
+	@git clean -q -d -x -e .sparse.mk -e '*.[ch]'
 
 .PHONY: FORCE
-- 
2.14.0


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

* [PATCH 30/36] build: use standard rules for install
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (28 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 29/36] build: use git-clean Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 31/36] build: remove unused QUIET_INST_SH Luc Van Oostenryck
                   ` (6 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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 f0f7a5b69..a418bf897 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] 67+ messages in thread

* [PATCH 31/36] build: remove unused QUIET_INST_SH
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (29 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 30/36] build: use standard rules for install Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 32/36] build: let quiet commands use less indentation Luc Van Oostenryck
                   ` (5 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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 a418bf897..1e3612210 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] 67+ messages in thread

* [PATCH 32/36] build: let quiet commands use less indentation
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (30 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 31/36] build: remove unused QUIET_INST_SH Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 33/36] build: simpler logic for quiet commands Luc Van Oostenryck
                   ` (4 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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 1e3612210..bdef09f70 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
 
@@ -213,7 +213,7 @@ check: all
 
 
 clean: FORCE
-	@echo '     CLEAN'
+	@echo "  CLEAN"
 	@git clean -q -d -x -e .sparse.mk -e '*.[ch]'
 
 
-- 
2.14.0


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

* [PATCH 33/36] build: simpler logic for quiet commands
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (31 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 32/36] build: let quiet commands use less indentation Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-06  8:15   ` Uwe Kleine-König
  2017-11-05 16:25 ` [PATCH 34/36] build: avoid foreach Luc Van Oostenryck
                   ` (3 subsequent siblings)
  36 siblings, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, Luc Van Oostenryck

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 bdef09f70..7f1b9508f 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)
 
@@ -225,8 +222,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] 67+ messages in thread

* [PATCH 34/36] build: avoid foreach
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (32 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 33/36] build: simpler logic for quiet commands Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 35/36] build: reorg & add comment Luc Van Oostenryck
                   ` (2 subsequent siblings)
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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 7f1b9508f..82ca2fe06 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] 67+ messages in thread

* [PATCH 35/36] build: reorg & add comment
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (33 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 34/36] build: avoid foreach Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-05 16:25 ` [PATCH 36/36] build: use a single space before assignments Luc Van Oostenryck
  2017-11-06  5:50 ` [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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 82ca2fe06..5ce359492 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] 67+ messages in thread

* [PATCH 36/36] build: use a single space before assignments
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (34 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 35/36] build: reorg & add comment Luc Van Oostenryck
@ 2017-11-05 16:25 ` Luc Van Oostenryck
  2017-11-06  5:50 ` [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 16:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, 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 5ce359492..ece04bb9f 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] 67+ messages in thread

* Re: [PATCH 29/36] build: use git-clean
  2017-11-05 16:25 ` [PATCH 29/36] build: use git-clean Luc Van Oostenryck
@ 2017-11-05 17:41   ` Josh Triplett
  2017-11-05 20:16     ` Luc Van Oostenryck
  2017-11-05 23:09     ` Christopher Li
  2017-11-08 11:42   ` Jeff Layton
  1 sibling, 2 replies; 67+ messages in thread
From: Josh Triplett @ 2017-11-05 17:41 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 05:25:37PM +0100, Luc Van Oostenryck wrote:
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  Makefile | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index afc1efe98..f0f7a5b69 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -233,16 +233,8 @@ check: all
>  	$(Q)cd validation && ./test-suite
>  
>  
> -clean: clean-check
> -	@rm -f *.[oa] .*.d $(PROGRAMS) version.h
> -clean-check:
> +clean: FORCE
>  	@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 {} \;
> +	@git clean -q -d -x -e .sparse.mk -e '*.[ch]'

No, you can't use git-clean here, for two reasons.

First, it has to be possible to build, and clean, sparse from a
tarball release, not just a git repository.

And second, even if not for that, this should *not* use -x or -d, *only*
-X. Otherwise, you might remove, say, a pile of carefully written
patches and cover letters sitting in the user's Sparse source directory.

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

* Re: [PATCH 01/36] build: make PREFIX overwritable from the environment
  2017-11-05 16:25 ` [PATCH 01/36] build: make PREFIX overwritable from the environment Luc Van Oostenryck
@ 2017-11-05 17:44   ` Josh Triplett
  2017-11-05 18:54     ` Uwe Kleine-König
  0 siblings, 1 reply; 67+ messages in thread
From: Josh Triplett @ 2017-11-05 17:44 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 05:25:09PM +0100, Luc Van Oostenryck wrote:
> 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.

You can already use "make PREFIX=/usr install" to do this, which seems
far more conventional, and seems less error-prone (e.g. it won't pick up
something random from the environment, only something intentionally put
on the command line).

Any particular reason to do this?

>  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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 02/36] build: put comment about local.mk to the place where it is included
  2017-11-05 16:25 ` [PATCH 02/36] build: put comment about local.mk to the place where it is included Luc Van Oostenryck
@ 2017-11-05 17:44   ` Josh Triplett
  0 siblings, 0 replies; 67+ messages in thread
From: Josh Triplett @ 2017-11-05 17:44 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 05:25:10PM +0100, Luc Van Oostenryck wrote:
> From: Uwe Kleine-König <uwe@kleine-koenig.org>
> 
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

>  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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 04/36] build: drop -g from LDFLAGS
  2017-11-05 16:25 ` [PATCH 04/36] build: drop -g from LDFLAGS Luc Van Oostenryck
@ 2017-11-05 17:45   ` Josh Triplett
  0 siblings, 0 replies; 67+ messages in thread
From: Josh Triplett @ 2017-11-05 17:45 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 05:25:12PM +0100, Luc Van Oostenryck wrote:
> 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>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

>  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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 05/36] build: pass CPPFLAGS to compiler
  2017-11-05 16:25 ` [PATCH 05/36] build: pass CPPFLAGS to compiler Luc Van Oostenryck
@ 2017-11-05 17:46   ` Josh Triplett
  0 siblings, 0 replies; 67+ messages in thread
From: Josh Triplett @ 2017-11-05 17:46 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 05:25:13PM +0100, Luc Van Oostenryck wrote:
> 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>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

>  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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 21/36] build: no need to clean *.so and SLIB_FILE
  2017-11-05 16:25 ` [PATCH 21/36] build: no need to clean *.so and SLIB_FILE Luc Van Oostenryck
@ 2017-11-05 17:48   ` Josh Triplett
  2017-11-05 20:06     ` Luc Van Oostenryck
  0 siblings, 1 reply; 67+ messages in thread
From: Josh Triplett @ 2017-11-05 17:48 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 05:25:29PM +0100, Luc Van Oostenryck wrote:
> 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 a8578c305..23c334132 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -207,7 +207,7 @@ version.h: FORCE
>  
>  
>  clean: clean-check
> -	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) version.h
> +	rm -f *.[oa] .*.d $(PROGRAMS) $(SLIB_FILE) version.h

You didn't remove SLIB_FILE here. And also, this should get squashed
into the patch that stops building these.

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

* Re: [PATCH 01/36] build: make PREFIX overwritable from the environment
  2017-11-05 17:44   ` Josh Triplett
@ 2017-11-05 18:54     ` Uwe Kleine-König
  2017-11-05 20:30       ` Josh Triplett
  0 siblings, 1 reply; 67+ messages in thread
From: Uwe Kleine-König @ 2017-11-05 18:54 UTC (permalink / raw)
  To: Josh Triplett, Luc Van Oostenryck; +Cc: linux-sparse


[-- Attachment #1.1: Type: text/plain, Size: 1048 bytes --]

Hello Josh,

On 11/05/2017 06:44 PM, Josh Triplett wrote:
> On Sun, Nov 05, 2017 at 05:25:09PM +0100, Luc Van Oostenryck wrote:
>> 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.
> 
> You can already use "make PREFIX=/usr install" to do this, which seems
> far more conventional, and seems less error-prone (e.g. it won't pick up
> something random from the environment, only something intentionally put
> on the command line).

Having PREFIX in the build environment and then being surprised that
it's picked up by a build isn't something I'd show consideration for.

> Any particular reason to do this?

I had this patch in my stack for the sparse debian package because
with debhelper it is easier to put something into the environment than
to overwrite the make command line. (But having said that, the currently
used packaging doesn't rely on this feature any more.)

Best regards
Uwe


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 21/36] build: no need to clean *.so and SLIB_FILE
  2017-11-05 17:48   ` Josh Triplett
@ 2017-11-05 20:06     ` Luc Van Oostenryck
  2017-11-05 20:30       ` Josh Triplett
  0 siblings, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 20:06 UTC (permalink / raw)
  To: Josh Triplett; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 09:48:07AM -0800, Josh Triplett wrote:
> On Sun, Nov 05, 2017 at 05:25:29PM +0100, Luc Van Oostenryck wrote:
> > 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 a8578c305..23c334132 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -207,7 +207,7 @@ version.h: FORCE
> >  
> >  
> >  clean: clean-check
> > -	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) version.h
> > +	rm -f *.[oa] .*.d $(PROGRAMS) $(SLIB_FILE) version.h
> 
> You didn't remove SLIB_FILE here. And also, this should get squashed
> into the patch that stops building these.

I know, this patch only remove the '*.so' which was redundant with
$(SLIB_FILE).
This was before I decided to remove everything related to shared lib.

And yes, once shared are removed, it's simpler to remove everything
at the same time. I'll do that in next version.

Thanks for the review,
-- Luc

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

* Re: [PATCH 29/36] build: use git-clean
  2017-11-05 17:41   ` Josh Triplett
@ 2017-11-05 20:16     ` Luc Van Oostenryck
  2017-11-05 20:38       ` Josh Triplett
  2017-11-05 23:09     ` Christopher Li
  1 sibling, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 20:16 UTC (permalink / raw)
  To: Josh Triplett; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 09:41:02AM -0800, Josh Triplett wrote:
> On Sun, Nov 05, 2017 at 05:25:37PM +0100, Luc Van Oostenryck wrote:
> > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> > ---
> >  Makefile | 12 ++----------
> >  1 file changed, 2 insertions(+), 10 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index afc1efe98..f0f7a5b69 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -233,16 +233,8 @@ check: all
> >  	$(Q)cd validation && ./test-suite
> >  
> >  
> > -clean: clean-check
> > -	@rm -f *.[oa] .*.d $(PROGRAMS) version.h
> > -clean-check:
> > +clean: FORCE
> >  	@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 {} \;
> > +	@git clean -q -d -x -e .sparse.mk -e '*.[ch]'
> 
> No, you can't use git-clean here, for two reasons.
> 
> First, it has to be possible to build, and clean, sparse from a
> tarball release, not just a git repository.
> 
> And second, even if not for that, this should *not* use -x or -d, *only*
> -X. Otherwise, you might remove, say, a pile of carefully written
> patches and cover letters sitting in the user's Sparse source directory.

Hehe, I thought this would be somehow controversial ;)

TBH, I'm far from conviced for the first point.
There hasn't been any tarbal release since 2014 and, unless I'm
mistaken, people can't anymore get a tarball from kernel.org's cgit.
The real question would be: "is there anybody, doing some kind of
development on sparse and who won't use git?"

For the second point, well ... I purposely added '-e *.[ch]' to
avoid some problems and if I call 'make clean' I expect that things
like patches and cover letter are removed, but I agree that my
expectations here most probably doesn't match other's.

I think I'll drop this patch and continue to directly use
'git clean -x' when I needed it.


Thanks for the review,
-- Luc

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

* Re: [PATCH 01/36] build: make PREFIX overwritable from the environment
  2017-11-05 18:54     ` Uwe Kleine-König
@ 2017-11-05 20:30       ` Josh Triplett
  0 siblings, 0 replies; 67+ messages in thread
From: Josh Triplett @ 2017-11-05 20:30 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Luc Van Oostenryck, linux-sparse

On Sun, Nov 05, 2017 at 07:54:52PM +0100, Uwe Kleine-König wrote:
> Hello Josh,
> 
> On 11/05/2017 06:44 PM, Josh Triplett wrote:
> > On Sun, Nov 05, 2017 at 05:25:09PM +0100, Luc Van Oostenryck wrote:
> >> 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.
> > 
> > You can already use "make PREFIX=/usr install" to do this, which seems
> > far more conventional, and seems less error-prone (e.g. it won't pick up
> > something random from the environment, only something intentionally put
> > on the command line).
> 
> Having PREFIX in the build environment and then being surprised that
> it's picked up by a build isn't something I'd show consideration for.

I could *imagine* it happening by way of using that variable as an
intermediate step in, say, .bashrc, and not unsetting it; I don't know
offhand of any other package that would be affected by it, since most
use things like autotools and cmake that would not pick it up by the
environment.

I'm not saying that this is common, just that picking something up from
the environment seems marginally more error-prone.

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

* Re: [PATCH 21/36] build: no need to clean *.so and SLIB_FILE
  2017-11-05 20:06     ` Luc Van Oostenryck
@ 2017-11-05 20:30       ` Josh Triplett
  0 siblings, 0 replies; 67+ messages in thread
From: Josh Triplett @ 2017-11-05 20:30 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 09:06:31PM +0100, Luc Van Oostenryck wrote:
> On Sun, Nov 05, 2017 at 09:48:07AM -0800, Josh Triplett wrote:
> > On Sun, Nov 05, 2017 at 05:25:29PM +0100, Luc Van Oostenryck wrote:
> > > 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 a8578c305..23c334132 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -207,7 +207,7 @@ version.h: FORCE
> > >  
> > >  
> > >  clean: clean-check
> > > -	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) version.h
> > > +	rm -f *.[oa] .*.d $(PROGRAMS) $(SLIB_FILE) version.h
> > 
> > You didn't remove SLIB_FILE here. And also, this should get squashed
> > into the patch that stops building these.
> 
> I know, this patch only remove the '*.so' which was redundant with
> $(SLIB_FILE).
> This was before I decided to remove everything related to shared lib.

Ah, I see. The subject seemed likt it was saying "no need to clean
either of these", rather than "no need to clean both, one suffices".

> And yes, once shared are removed, it's simpler to remove everything
> at the same time. I'll do that in next version.

Thanks!

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

* Re: [PATCH 29/36] build: use git-clean
  2017-11-05 20:16     ` Luc Van Oostenryck
@ 2017-11-05 20:38       ` Josh Triplett
  2017-11-05 20:50         ` Uwe Kleine-König
  2017-11-05 20:56         ` Luc Van Oostenryck
  0 siblings, 2 replies; 67+ messages in thread
From: Josh Triplett @ 2017-11-05 20:38 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 09:16:31PM +0100, Luc Van Oostenryck wrote:
> On Sun, Nov 05, 2017 at 09:41:02AM -0800, Josh Triplett wrote:
> > On Sun, Nov 05, 2017 at 05:25:37PM +0100, Luc Van Oostenryck wrote:
> > > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> > > ---
> > >  Makefile | 12 ++----------
> > >  1 file changed, 2 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/Makefile b/Makefile
> > > index afc1efe98..f0f7a5b69 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -233,16 +233,8 @@ check: all
> > >  	$(Q)cd validation && ./test-suite
> > >  
> > >  
> > > -clean: clean-check
> > > -	@rm -f *.[oa] .*.d $(PROGRAMS) version.h
> > > -clean-check:
> > > +clean: FORCE
> > >  	@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 {} \;
> > > +	@git clean -q -d -x -e .sparse.mk -e '*.[ch]'
> > 
> > No, you can't use git-clean here, for two reasons.
> > 
> > First, it has to be possible to build, and clean, sparse from a
> > tarball release, not just a git repository.
> > 
> > And second, even if not for that, this should *not* use -x or -d, *only*
> > -X. Otherwise, you might remove, say, a pile of carefully written
> > patches and cover letters sitting in the user's Sparse source directory.
> 
> Hehe, I thought this would be somehow controversial ;)
> 
> TBH, I'm far from conviced for the first point.
> There hasn't been any tarbal release since 2014 and, unless I'm
> mistaken, people can't anymore get a tarball from kernel.org's cgit.

As far as I can tell,
https://git.kernel.org/pub/scm/devel/sparse/sparse.git/snapshot/sparse-0.5.1.tar.gz
still works, for instance.

> The real question would be: "is there anybody, doing some kind of
> development on sparse and who won't use git?"

Sure: anyone doing packaging. If someone wants to package Sparse for a
distribution, they'll likely do so in a way that does not include .git
in the source package. And if that package wants to "make clean" for any
reason, or if someone grabs the source from that distribution for
development and happens to run "make clean", that would be *bad*.

Worse yet: I keep my home directory in git, and would very much not like
"git clean" run in *that* if .git doesn't exist in Sparse. I'd be
immediately filing a "critical" bug report about data loss against the
package, and trying to restore what data I can from backups.

> For the second point, well ... I purposely added '-e *.[ch]' to
> avoid some problems and if I call 'make clean' I expect that things
> like patches and cover letter are removed, but I agree that my
> expectations here most probably doesn't match other's.

I most assuredly would not expect "make clean" to do this. I regularly
"make clean" in repositories while having valuable files in the
directory: patches, cover-letters, lists of email addresess to CC
patches to, benchmark results, etc.

> I think I'll drop this patch and continue to directly use
> 'git clean -x' when I needed it.

Thank you.

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

* Re: [PATCH 29/36] build: use git-clean
  2017-11-05 20:38       ` Josh Triplett
@ 2017-11-05 20:50         ` Uwe Kleine-König
  2017-11-05 20:58           ` Luc Van Oostenryck
  2017-11-05 20:56         ` Luc Van Oostenryck
  1 sibling, 1 reply; 67+ messages in thread
From: Uwe Kleine-König @ 2017-11-05 20:50 UTC (permalink / raw)
  To: Josh Triplett, Luc Van Oostenryck; +Cc: linux-sparse


[-- Attachment #1.1: Type: text/plain, Size: 944 bytes --]

On 11/05/2017 09:38 PM, Josh Triplett wrote:
> On Sun, Nov 05, 2017 at 09:16:31PM +0100, Luc Van Oostenryck wrote:
>> The real question would be: "is there anybody, doing some kind of
>> development on sparse and who won't use git?"
> 
> Sure: anyone doing packaging. If someone wants to package Sparse for a
> distribution, they'll likely do so in a way that does not include .git
> in the source package. And if that package wants to "make clean" for any
> reason, or if someone grabs the source from that distribution for
> development and happens to run "make clean", that would be *bad*.

Ack with my sparse Debian package maintainer hat on. If you check the
Debian build logs (e.g.
https://buildd.debian.org/status/fetch.php?pkg=sparse&arch=arm64&ver=0.5.1-2&stamp=1506419417&raw=0)
you can see that the first relevant step after extracting the source tar
and applying patches is to run make clean.

Best regards
Uwe


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 29/36] build: use git-clean
  2017-11-05 20:38       ` Josh Triplett
  2017-11-05 20:50         ` Uwe Kleine-König
@ 2017-11-05 20:56         ` Luc Van Oostenryck
  1 sibling, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 20:56 UTC (permalink / raw)
  To: Josh Triplett; +Cc: linux-sparse, Uwe Kleine-König

On Sun, Nov 05, 2017 at 12:38:45PM -0800, Josh Triplett wrote:
> On Sun, Nov 05, 2017 at 09:16:31PM +0100, Luc Van Oostenryck wrote:
> > 
> > Hehe, I thought this would be somehow controversial ;)
> > 
> > TBH, I'm far from conviced for the first point.
> > There hasn't been any tarbal release since 2014 and, unless I'm
> > mistaken, people can't anymore get a tarball from kernel.org's cgit.
> 
> As far as I can tell,
> https://git.kernel.org/pub/scm/devel/sparse/sparse.git/snapshot/sparse-0.5.1.tar.gz
> still works, for instance.

Ah good, it's no more accessible directly from the summary page but
still there in the release/tag page.

> > The real question would be: "is there anybody, doing some kind of
> > development on sparse and who won't use git?"
> 
> Sure: anyone doing packaging. If someone wants to package Sparse for a
> distribution, they'll likely do so in a way that does not include .git
> in the source package. And if that package wants to "make clean" for any
> reason, or if someone grabs the source from that distribution for
> development and happens to run "make clean", that would be *bad*.

I don't think it can be a problem for Debian or Fedora but I agree
there is a unneeded risk here.

> Worse yet: I keep my home directory in git, and would very much not like

Hehe, glad to hear that I'm not alone doing that :)

> "git clean" run in *that* if .git doesn't exist in Sparse. I'd be
> immediately filing a "critical" bug report about data loss against the
> package, and trying to restore what data I can from backups.
> 
> > For the second point, well ... I purposely added '-e *.[ch]' to
> > avoid some problems and if I call 'make clean' I expect that things
> > like patches and cover letter are removed, but I agree that my
> > expectations here most probably doesn't match other's.
> 
> I most assuredly would not expect "make clean" to do this. I regularly

Yes, it would be something for distclean or mrproper and such.

> "make clean" in repositories while having valuable files in the
> directory: patches, cover-letters, lists of email addresess to CC
> patches to, benchmark results, etc.

Of course, I never do that :)

> > I think I'll drop this patch and continue to directly use
> > 'git clean -x' when I needed it.
> 
> Thank you.

-- Luc

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

* Re: [PATCH 29/36] build: use git-clean
  2017-11-05 20:50         ` Uwe Kleine-König
@ 2017-11-05 20:58           ` Luc Van Oostenryck
  0 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-05 20:58 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Josh Triplett, linux-sparse

On Sun, Nov 05, 2017 at 09:50:17PM +0100, Uwe Kleine-König wrote:
> On 11/05/2017 09:38 PM, Josh Triplett wrote:
> > On Sun, Nov 05, 2017 at 09:16:31PM +0100, Luc Van Oostenryck wrote:
> >> The real question would be: "is there anybody, doing some kind of
> >> development on sparse and who won't use git?"
> > 
> > Sure: anyone doing packaging. If someone wants to package Sparse for a
> > distribution, they'll likely do so in a way that does not include .git
> > in the source package. And if that package wants to "make clean" for any
> > reason, or if someone grabs the source from that distribution for
> > development and happens to run "make clean", that would be *bad*.
> 
> Ack with my sparse Debian package maintainer hat on. If you check the
> Debian build logs (e.g.
> https://buildd.debian.org/status/fetch.php?pkg=sparse&arch=arm64&ver=0.5.1-2&stamp=1506419417&raw=0)
> you can see that the first relevant step after extracting the source tar
> and applying patches is to run make clean.

OK, then it's definitively not an option.

Thanks to both of you.

-- Luc

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

* Re: [PATCH 29/36] build: use git-clean
  2017-11-05 17:41   ` Josh Triplett
  2017-11-05 20:16     ` Luc Van Oostenryck
@ 2017-11-05 23:09     ` Christopher Li
  1 sibling, 0 replies; 67+ messages in thread
From: Christopher Li @ 2017-11-05 23:09 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Luc Van Oostenryck, Linux-Sparse, Uwe Kleine-König

On Mon, Nov 6, 2017 at 1:41 AM, Josh Triplett <josh@joshtriplett.org> wrote:
> No, you can't use git-clean here, for two reasons.
>
> First, it has to be possible to build, and clean, sparse from a
> tarball release, not just a git repository.

I totally agree with Josh,

Sparse should be able to build clean from just tar balls
without git.

You can still download the sparse tar ball from KORG
using snapshot for example.

https://git.kernel.org/pub/scm/devel/sparse/sparse.git/snapshot/sparse-0.5.1.tar.gz

Chris

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

* Re: [PATCH 00/36] Makefile reorganization
  2017-11-05 16:24 [PATCH 00/36] Makefile reorganization Luc Van Oostenryck
                   ` (35 preceding siblings ...)
  2017-11-05 16:25 ` [PATCH 36/36] build: use a single space before assignments Luc Van Oostenryck
@ 2017-11-06  5:50 ` Luc Van Oostenryck
  36 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-06  5:50 UTC (permalink / raw)
  To: linux-sparse; +Cc: Uwe Kleine-König, Jeff Layton, Josh Triplett

I've updated the series witht the feedback I received yesterday.

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 updated series is available for review & testing at:
    git://github.com/lucvoo/sparse.git make-cleanup-v2

Thanks for the reviewers.

-- Luc Van Oostenryck

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

* Re: [PATCH 33/36] build: simpler logic for quiet commands
  2017-11-05 16:25 ` [PATCH 33/36] build: simpler logic for quiet commands Luc Van Oostenryck
@ 2017-11-06  8:15   ` Uwe Kleine-König
  2017-11-06  8:28     ` Luc Van Oostenryck
  0 siblings, 1 reply; 67+ messages in thread
From: Uwe Kleine-König @ 2017-11-06  8:15 UTC (permalink / raw)
  To: Luc Van Oostenryck, linux-sparse


[-- Attachment #1.1: Type: text/plain, Size: 530 bytes --]

Hello Luc,

On 11/05/2017 05:25 PM, Luc Van Oostenryck wrote:
> @@ -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 $@

Is it intended that you introduce changed behaviour here? Now you get
the pretty printed output when building with V=1.

Best regards
Uwe


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 33/36] build: simpler logic for quiet commands
  2017-11-06  8:15   ` Uwe Kleine-König
@ 2017-11-06  8:28     ` Luc Van Oostenryck
  2017-11-06  8:44       ` Uwe Kleine-König
  0 siblings, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-06  8:28 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Linux-Sparse

On Mon, Nov 6, 2017 at 9:15 AM, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
> Hello Luc,
>
> On 11/05/2017 05:25 PM, Luc Van Oostenryck wrote:
>> @@ -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 $@
>
> Is it intended that you introduce changed behaviour here? Now you get
> the pretty printed output when building with V=1.

It was not the intention as such but, yes, I knew the behaviour changed.
I don't think the new behaviour is a problem, on the contrary, but if it is
a problem it can be changed back.

-- Luc

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

* Re: [PATCH 33/36] build: simpler logic for quiet commands
  2017-11-06  8:28     ` Luc Van Oostenryck
@ 2017-11-06  8:44       ` Uwe Kleine-König
  2017-11-06  8:55         ` Luc Van Oostenryck
  0 siblings, 1 reply; 67+ messages in thread
From: Uwe Kleine-König @ 2017-11-06  8:44 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Linux-Sparse


[-- Attachment #1.1: Type: text/plain, Size: 1106 bytes --]

On 11/06/2017 09:28 AM, Luc Van Oostenryck wrote:
> On Mon, Nov 6, 2017 at 9:15 AM, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
>> Hello Luc,
>>
>> On 11/05/2017 05:25 PM, Luc Van Oostenryck wrote:
>>> @@ -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 $@
>>
>> Is it intended that you introduce changed behaviour here? Now you get
>> the pretty printed output when building with V=1.
> 
> It was not the intention as such but, yes, I knew the behaviour changed.
> I don't think the new behaviour is a problem, on the contrary, but if it is
> a problem it can be changed back.

I don't consider it problematic, the added benefit is that it becomes
easier to relate a V=1 build with a V=0 build. But IMHO this should not
be sold as "simpler logic" without any further comment.

Best regards
Uwe


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 33/36] build: simpler logic for quiet commands
  2017-11-06  8:44       ` Uwe Kleine-König
@ 2017-11-06  8:55         ` Luc Van Oostenryck
  2017-11-06 19:40           ` Luc Van Oostenryck
  0 siblings, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-06  8:55 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Linux-Sparse

On Mon, Nov 6, 2017 at 9:44 AM, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
> On 11/06/2017 09:28 AM, Luc Van Oostenryck wrote:
>> On Mon, Nov 6, 2017 at 9:15 AM, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
>>> Hello Luc,
>>>
>>> On 11/05/2017 05:25 PM, Luc Van Oostenryck wrote:
>>>> @@ -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 $@
>>>
>>> Is it intended that you introduce changed behaviour here? Now you get
>>> the pretty printed output when building with V=1.
>>
>> It was not the intention as such but, yes, I knew the behaviour changed.
>> I don't think the new behaviour is a problem, on the contrary, but if it is
>> a problem it can be changed back.
>
> I don't consider it problematic, the added benefit is that it becomes
> easier to relate a V=1 build with a V=0 build.

Indeed.

> But IMHO this should not
> be sold as "simpler logic" without any further comment.

Yes. It's not the only patch in this series which commit message
should be improved.

-- Luc

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

* Re: [PATCH 28/36] build: use a dot file name instead of local.mk: .sparse.mk
  2017-11-05 16:25 ` [PATCH 28/36] build: use a dot file name instead of local.mk: .sparse.mk Luc Van Oostenryck
@ 2017-11-06  8:57   ` Uwe Kleine-König
  2017-11-06 15:43     ` Luc Van Oostenryck
  2017-11-09 19:29     ` Christopher Li
  0 siblings, 2 replies; 67+ messages in thread
From: Uwe Kleine-König @ 2017-11-06  8:57 UTC (permalink / raw)
  To: Luc Van Oostenryck, linux-sparse


[-- Attachment #1.1: Type: text/plain, Size: 341 bytes --]

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.

Best regards
Uwe


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 28/36] build: use a dot file name instead of local.mk: .sparse.mk
  2017-11-06  8:57   ` Uwe Kleine-König
@ 2017-11-06 15:43     ` Luc Van Oostenryck
  2017-11-09 19:06       ` Uwe Kleine-König
  2017-11-09 19:29     ` Christopher Li
  1 sibling, 1 reply; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-06 15:43 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: linux-sparse

On Mon, Nov 06, 2017 at 09:57:23AM +0100, Uwe Kleine-König wrote:
> 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 confort.
I often need to change 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 an 
hidden one.

I understand your worries but since it's a file purposely changed
so that files are compiled differently, there is no surprises.
For dirtying the build ... yes, something could be done but really,
personnaly, I don't need this, I know when I need to clean my tree.

Regards,
-- Luc

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

* Re: [PATCH 33/36] build: simpler logic for quiet commands
  2017-11-06  8:55         ` Luc Van Oostenryck
@ 2017-11-06 19:40           ` Luc Van Oostenryck
  0 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-06 19:40 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Linux-Sparse

On Mon, Nov 06, 2017 at 09:55:26AM +0100, Luc Van Oostenryck wrote:
> On Mon, Nov 6, 2017 at 9:44 AM, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
> > But IMHO this should not
> > be sold as "simpler logic" without any further comment.
> 
> Yes. It's not the only patch in this series which commit message
> should be improved.

Here is the updated commit message, no changes in the patch itself:
	Subject: [PATCH v3 31/36] build: simplify quiet commands

	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.

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

* Re: [PATCH 29/36] build: use git-clean
  2017-11-05 16:25 ` [PATCH 29/36] build: use git-clean Luc Van Oostenryck
  2017-11-05 17:41   ` Josh Triplett
@ 2017-11-08 11:42   ` Jeff Layton
  2017-11-08 12:01     ` Uwe Kleine-König
  2017-11-08 19:55     ` Luc Van Oostenryck
  1 sibling, 2 replies; 67+ messages in thread
From: Jeff Layton @ 2017-11-08 11:42 UTC (permalink / raw)
  To: Luc Van Oostenryck, linux-sparse; +Cc: Uwe Kleine-König

On Sun, 2017-11-05 at 17:25 +0100, Luc Van Oostenryck wrote:
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  Makefile | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index afc1efe98..f0f7a5b69 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -233,16 +233,8 @@ check: all
>  	$(Q)cd validation && ./test-suite
>  
>  
> -clean: clean-check
> -	@rm -f *.[oa] .*.d $(PROGRAMS) version.h
> -clean-check:
> +clean: FORCE
>  	@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 {} \;
> +	@git clean -q -d -x -e .sparse.mk -e '*.[ch]'
>  
>  .PHONY: FORCE

This seems wrong. It's certainly possible to build sparse out of a
tarball that was generated from (e.g.) git-archive. In fact that's
generally how fedora (and I imagine Debian) build packages.

This would break the ability to do "make clean" in that setup.
-- 
Jeff Layton <jlayton@redhat.com>

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

* Re: [PATCH 29/36] build: use git-clean
  2017-11-08 11:42   ` Jeff Layton
@ 2017-11-08 12:01     ` Uwe Kleine-König
  2017-11-08 19:55     ` Luc Van Oostenryck
  1 sibling, 0 replies; 67+ messages in thread
From: Uwe Kleine-König @ 2017-11-08 12:01 UTC (permalink / raw)
  To: Jeff Layton, Luc Van Oostenryck, linux-sparse


[-- Attachment #1.1: Type: text/plain, Size: 899 bytes --]

Hello,

On 11/08/2017 12:42 PM, Jeff Layton wrote:
>>  	@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 {} \;
>> +	@git clean -q -d -x -e .sparse.mk -e '*.[ch]'
>>  
>>  .PHONY: FORCE
> 
> This seems wrong. It's certainly possible to build sparse out of a
> tarball that was generated from (e.g.) git-archive. In fact that's
> generally how fedora (and I imagine Debian) build packages.
> 
> This would break the ability to do "make clean" in that setup.

That was already discussed and Luc dropped this change for that reason
in his v2.

Best regards
Uwe


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 29/36] build: use git-clean
  2017-11-08 11:42   ` Jeff Layton
  2017-11-08 12:01     ` Uwe Kleine-König
@ 2017-11-08 19:55     ` Luc Van Oostenryck
  1 sibling, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-08 19:55 UTC (permalink / raw)
  To: Jeff Layton; +Cc: linux-sparse, Uwe Kleine-König, Josh Triplett

On Wed, Nov 08, 2017 at 06:42:36AM -0500, Jeff Layton wrote:
> On Sun, 2017-11-05 at 17:25 +0100, Luc Van Oostenryck wrote:
> > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> > ---
> >  Makefile | 12 ++----------
> >  1 file changed, 2 insertions(+), 10 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index afc1efe98..f0f7a5b69 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -233,16 +233,8 @@ check: all
> >  	$(Q)cd validation && ./test-suite
> >  
> >  
> > -clean: clean-check
> > -	@rm -f *.[oa] .*.d $(PROGRAMS) version.h
> > -clean-check:
> > +clean: FORCE
> >  	@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 {} \;
> > +	@git clean -q -d -x -e .sparse.mk -e '*.[ch]'
> >  
> >  .PHONY: FORCE
> 
> This seems wrong. It's certainly possible to build sparse out of a
> tarball that was generated from (e.g.) git-archive. In fact that's
> generally how fedora (and I imagine Debian) build packages.
> 
> This would break the ability to do "make clean" in that setup.

Yes, it's very wrong.
As you have probably already seen in Uwe's reply, he and Josh have
also reported this and I have since dropped this patch.
I guess that I'm too used to use git ...

It's really good to know that people are looking closely at these patches.
I appreciate this very much.

-- Luc

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

* Re: [PATCH 28/36] build: use a dot file name instead of local.mk: .sparse.mk
  2017-11-06 15:43     ` Luc Van Oostenryck
@ 2017-11-09 19:06       ` Uwe Kleine-König
  2017-11-09 20:48         ` Luc Van Oostenryck
  0 siblings, 1 reply; 67+ messages in thread
From: Uwe Kleine-König @ 2017-11-09 19:06 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse


[-- Attachment #1.1: Type: text/plain, Size: 2036 bytes --]

Hello Luc,

On 11/06/2017 04:43 PM, Luc Van Oostenryck wrote:
> On Mon, Nov 06, 2017 at 09:57:23AM +0100, Uwe Kleine-König wrote:
>>> -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 confort.
> I often need to change 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 an 
> hidden one.
>
> I understand your worries but since it's a file purposely changed
> so that files are compiled differently, there is no surprises.

<sarcasm>
We could also add

	#include ".sparse.c"

at the end of sparse.c (and touch this file in Makefile) in case you
want to add a function there without dirtying the working copy. This
could be used to overwrite weak functions for example.

Oh, and given that order in Makefile sometimes matter, we could add an
sinclude sparse-pre.mk at the start of Makefile.
</sarcasm>

IMHO these suggestions (that I hope you find absurd, too) are only
little worse than your justification above.

If I'd want to change CFLAGS, I'd do that directly in Makefile. git is
powerful enough that this isn't in the way of committing and I
personally like being remembered that I changed something. Of course
this is subjective.

> For dirtying the build ... yes, something could be done but really,
> personnaly, I don't need this, I know when I need to clean my tree

famous words. How often did it happen to you that you thought you'd
remember stuff when you need it and then only managed to do this after a
2 hour long debug session?

Best regards
Uwe


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 28/36] build: use a dot file name instead of local.mk: .sparse.mk
  2017-11-06  8:57   ` Uwe Kleine-König
  2017-11-06 15:43     ` Luc Van Oostenryck
@ 2017-11-09 19:29     ` Christopher Li
  1 sibling, 0 replies; 67+ messages in thread
From: Christopher Li @ 2017-11-09 19:29 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Luc Van Oostenryck, Linux-Sparse

On Mon, Nov 6, 2017 at 4:57 PM, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
>
> 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 think I am the one that introduce the local.mk. I can explain some of
my usage of it.

I think there are two kind of people.
1) people don't use local.mk. People like to keep the tree clean with
git etc. They don't have local.mk. This does not concern them.

2) People like me using the local.mk.
I mostly use local.mk for the rules that is
1) local. e.g. how many jobs to invoke when start building
2) rules that I need which is local and I need it for every git branch.
   e.g. my rules for the stress test. I want to be able to run stress test
          on each branch as needed. Those stress test has external reference
          point to the Linux kernel compile results. It is not
suitable to check in
          into git.

Chris

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

* Re: [PATCH 28/36] build: use a dot file name instead of local.mk: .sparse.mk
  2017-11-09 19:06       ` Uwe Kleine-König
@ 2017-11-09 20:48         ` Luc Van Oostenryck
  0 siblings, 0 replies; 67+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09 20:48 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: linux-sparse

On Thu, Nov 09, 2017 at 08:06:40PM +0100, Uwe Kleine-König wrote:
> Hello Luc,
> 
> On 11/06/2017 04:43 PM, Luc Van Oostenryck wrote:
> > On Mon, Nov 06, 2017 at 09:57:23AM +0100, Uwe Kleine-König wrote:
> >>> -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 confort.
> > I often need to change 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 an 
> > hidden one.
> >
> > I understand your worries but since it's a file purposely changed
> > so that files are compiled differently, there is no surprises.
> 
> <sarcasm>
> We could also add
> 
> 	#include ".sparse.c"
> 
> at the end of sparse.c (and touch this file in Makefile) in case you
> want to add a function there without dirtying the working copy. This
> could be used to overwrite weak functions for example.
> 
> Oh, and given that order in Makefile sometimes matter, we could add an
> sinclude sparse-pre.mk at the start of Makefile.
> </sarcasm>
> 
> IMHO these suggestions (that I hope you find absurd, too) are only
> little worse than your justification above.

:)

Yes, it's absurd.
I certainly don't want to hide .c files or .h, the Makefile also I don't
want to hide. These files contains the meat, the logic, they are the
objects on which developement are done, it make no sense to me to hide them.

It's very different for this file: I suppose for most dev, most of the time
we even don't need of this file but sometimes, for a specific purpose, for
a little while, we need some other flags. While this file is needed (for me,
it's 98% of the time for debugging and 2% of the time for profiling), I'll
make some commits, use 'git status' or 'git add -p' and such, so the strict
minima is that this file is ignored by the version control.

*Personally*, I also prefer that this file is not in the way in any possible
way, so yes, I prefer to not see it, I prefer even more that it's even not
in the tree.

For me, it's very very similar to all the .dot file we have in our home dirs
or simply the .git and .gitignore in the working tree.
Why are those files hidden? Will it be a good thing to make them visible?
I don't think so.

Others may have other preferences and other way of working, no problem,
I totally respect that and try to find the best for everyone.

> If I'd want to change CFLAGS, I'd do that directly in Makefile.

Doing it in the Makefile, is exactly the thing I don't want to do:
I want and I need to have my tree clean of this sort of things.

> git is
> powerful enough that this isn't in the way of committing and I
> personally like being remembered that I changed something. Of course
> this is subjective.

Yes, like this whole subject.

> > For dirtying the build ... yes, something could be done but really,
> > personnaly, I don't need this, I know when I need to clean my tree
> 
> famous words. How often did it happen to you that you thought you'd
> remember stuff when you need it and then only managed to do this after a
> 2 hour long debug session?

Honestly, it doesn't matter.
Even if I forget, what matters to me is "how much time will I waste?"
a few seconds, a few minutes or several hours of work?
In this case, it's a few seconds or at worst two minutes.

-- Luc

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

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

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

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.