Browse Source

makefiles: add "scores" target.

Rusty Russell 15 years ago
parent
commit
5c5cd4b84c
3 changed files with 27 additions and 6 deletions
  1. 19 3
      Makefile
  2. 8 2
      Makefile-ccan
  3. 0 1
      Makefile-web

+ 19 - 3
Makefile

@@ -14,9 +14,13 @@
 # dependencies you don't have.
 EXCLUDE=wwviaudio ogg_to_pcm
 
-# Anything with an _info file is a module.
-ALL=$(filter-out $(EXCLUDE), $(patsubst ccan/%/_info, %, $(wildcard ccan/*/_info)))
-ALL_DEPENDS=$(patsubst %, ccan/%/.depends, $(ALL))
+# Where make scores puts the results
+SCOREDIR=scores/$(shell whoami)/$(shell uname -s)-$(shell uname -m)-$(CC)
+
+ALL=$(filter-out $(EXCLUDE), $(REALLY_ALL))
+
+ALL_DEPENDS=$(patsubst %, ccan/%/.depends, $(REALLY_ALL))
+
 # Not all modules have tests.
 ALL_TESTS=$(patsubst ccan/%/test/, %, $(foreach dir, $(ALL), $(wildcard ccan/$(dir)/test/)))
 
@@ -70,6 +74,18 @@ check: $(ALL_TESTS:%=summary-check-%)
 distclean: clean
 	rm -f $(ALL_DEPENDS)
 
+scores: $(SCOREDIR)/SUMMARY
+
+$(SCOREDIR)/SUMMARY: $(patsubst ccan/%/_info, $(SCOREDIR)/score-%, $(wildcard ccan/*/_info))
+	git describe --always > $@
+	uname -a >> $@
+	$(CC) -v >> $@
+	cat $^ | grep 'Total score:' >> $@
+
+$(SCOREDIR)/score-%: ccan/%/_info tools/ccanlint/ccanlint $(OBJFILES)
+	mkdir -p $(SCOREDIR)
+	tools/ccanlint/ccanlint -v -s -d ccan/$* > $@ || true
+
 $(ALL_DEPENDS): %/.depends: %/_info tools/ccan_depends
 	tools/ccan_depends $* > $@ || ( rm -f $@; exit 1 )
 

+ 8 - 2
Makefile-ccan

@@ -13,8 +13,14 @@ default: libccan.a
 DEPGEN=-MD
 -include ccan/*/*.d
 
-# Every directory with .c files is included.
-DIRS=$(filter-out $(foreach d,$(EXCLUDE),ccan/$d), $(patsubst %/, %, $(sort $(dir $(wildcard ccan/*/*.c)))))
+# Anything with an _info file is a module.
+REALLY_ALL=$(patsubst ccan/%/_info, %, $(wildcard ccan/*/_info))
+
+# Exclude any modules we can't build.
+ALL=$(filter-out $(EXCLUDE), $(REALLY_ALL))
+
+# Anything with C files needs building; dir leaves / on, sort uniquifies
+DIRS=$(patsubst %/, %, $(sort $(foreach m, $(ALL), $(dir $(wildcard ccan/$m/*.c)))))
 
 # Generate everyone's separate Makefiles.
 -include $(foreach dir, $(DIRS), $(dir)-Makefile)

+ 0 - 1
Makefile-web

@@ -2,7 +2,6 @@
 WEBDIR=/home/rusty/www/html/ccan
 
 # Ignore EXCLUDE when making webpages.
-REALLY_ALL=$(patsubst ccan/%/_info, %, $(wildcard ccan/*/_info))
 ALL_PAGES=$(patsubst %, $(WEBDIR)/info/%.html, $(REALLY_ALL))
 DIRECT_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/%.tar.bz2, $(REALLY_ALL))
 DEPEND_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(REALLY_ALL))