Makefile: list modules explicitly.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 22 Nov 2012 00:32:15 +0000 (11:02 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 22 Nov 2012 00:32:15 +0000 (11:02 +1030)
Clumsier than using wildcards, but that breaks down with nested modules
anyway.  In the longer term, we want ccantool to do the building, but for
the moment make is a necessary evil.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Makefile
Makefile-ccan
Makefile-web

index b36aca6b2a5b020bd483737fb551a74740523f3c..c50894d7a79771d27919ceb12aa9e8c799e86802 100644 (file)
--- a/Makefile
+++ b/Makefile
 #        Especially tools/ccanlint/ccanlint and tools/namespacize.
 # distclean: destroy everything back to pristine state
 
-# Trying to build the whole repo is usually a lose; there will be some
-# dependencies you don't have.
-EXCLUDE=wwviaudio ogg_to_pcm jmap jset nfs
-
 # Where make scores puts the results
 SCOREDIR=scores/$(shell whoami)/$(shell uname -s)-$(shell uname -m)-$(CC)-$(shell git describe --always --dirty)
 
-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/)))
-
 # Here's my rough logarithmic timeout graph for my laptop:
 #
 # 302                                                  -     
@@ -65,18 +54,20 @@ FASTTIMEOUT=750
 
 default: libccan.a
 
+ALL_DEPENDS=$(patsubst %, ccan/%/.depends, $(MODS_NORMAL) $(MODS_EXTERNAL))
+
 include Makefile-ccan
 
-fastcheck: $(ALL_TESTS:%=summary-fastcheck-%)
+fastcheck: $(MODS_NORMAL:%=summary-fastcheck-%)
 
-check: $(ALL_TESTS:%=summary-check-%)
+check: $(MODS_NORMAL:%=summary-check-%)
 
 distclean: clean
        rm -f $(ALL_DEPENDS)
 
 scores: $(SCOREDIR)/SUMMARY
 
-$(SCOREDIR)/SUMMARY: $(patsubst ccan/%/_info, $(SCOREDIR)/score-%, $(wildcard ccan/*/_info))
+$(SCOREDIR)/SUMMARY: $(MODS:%=$(SCOREDIR)/score-%)
        git describe --always > $@
        uname -a >> $@
        $(CC) -v >> $@
index fc0488d40f52cd34a00da1594a7df60729ac8158..39e5c69579a767e4fcf1b99a21e166d30df44456 100644 (file)
@@ -6,6 +6,93 @@
 CCAN_CFLAGS=-g3 -ggdb -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wwrite-strings -Wundef -DCCAN_STR_DEBUG=1
 CFLAGS = $(CCAN_CFLAGS) -I. $(DEPGEN)
 
+# Normal modules: no external dependencies, just a header:
+MODS_NORMAL_NO_SRC := alignof \
+       array_size \
+       asearch \
+       build_assert \
+       bytestring \
+       cast \
+       check_type \
+       compiler \
+       container_of \
+       darray \
+       endian \
+       objset \
+       short_types \
+       tcon \
+       tlist \
+       typesafe_cb
+
+# No external dependencies, with C code:
+MODS_NORMAL_WITH_SRC := alloc \
+       antithread \
+       asort \
+       asprintf \
+       autodata \
+       avl \
+       bdelta \
+       block_pool \
+       btree \
+       ccan_tokenizer \
+       charset \
+       ciniparser \
+       crc \
+       crcsync \
+       daemonize \
+       daemon_with_notify \
+       dgraph \
+       err \
+       failtest \
+       foreach \
+       grab_file \
+       hash \
+       htable \
+       idtree \
+       ilog \
+       isaac \
+       iscsi \
+       json \
+       lbalance \
+       likely \
+       list \
+       md4 \
+       net \
+       noerr \
+       opt \
+       ptr_valid \
+       rbtree \
+       read_write_all \
+       rfc822 \
+       sparse_bsearch \
+       str \
+       stringmap \
+       strmap \
+       strset \
+       str_talloc \
+       take \
+       tal \
+       talloc \
+       talloc_link \
+       tally \
+       tap \
+       time \
+       ttxml
+
+MODS_NORMAL:=$(MODS_NORMAL_WITH_SRC) $(MODS_NORMAL_NO_SRC)
+
+# Modules which require external dependencies, thus may not pass check.
+MODS_EXTERNAL_NO_SRC:=
+
+MODS_EXTERNAL_WITH_SRC:=jmap \
+       jset \
+       nfs \
+       ogg_to_pcm \
+       wwviaudio
+
+MODS_EXTERNAL:=$(MODS_EXTERNAL_NO_SRC) $(MODS_EXTERNAL_WITH_SRC)
+
+MODS:=$(MODS_EXTERNAL) $(MODS_NORMAL)
 
 default: libccan.a
 
@@ -13,14 +100,8 @@ default: libccan.a
 DEPGEN=-MD
 -include ccan/*/*.d
 
-# 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)))))
+DIRS=$(patsubst %/, %, $(sort $(foreach m, $(MODS_NORMAL_WITH_SRC), $(dir $(wildcard ccan/$m/*.c)))))
 
 # Generate everyone's separate Makefiles.
 -include $(foreach dir, $(DIRS), $(dir)-Makefile)
index 10671edc74efa7aa66c806ce25bbe4e4565655bc..78954661da0b1091329c01f20ce72a6ba8e826b4 100644 (file)
@@ -1,23 +1,26 @@
 # This can be overridden on cmdline to generate pages elsewhere.
 WEBDIR=/home/rusty/www/html/ccan
 
-# Ignore EXCLUDE when making webpages.
-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))
+ALL_PAGES=$(patsubst %, $(WEBDIR)/info/%.html, $(MODS_NORMAL) $(MODS_EXTERNAL))
+DIRECT_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/%.tar.bz2, $(MODS_NORMAL) $(MODS_EXTERNAL))
+DEPEND_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(MODS_NORMAL) $(MODS_EXTERNAL))
 WEB_SUBDIRS=$(WEBDIR)/tarballs $(WEBDIR)/junkcode $(WEBDIR)/tarballs/with-deps $(WEBDIR)/info
 JUNKDIRS=$(wildcard junkcode/*)
 JUNKPAGES=$(JUNKDIRS:%=$(WEBDIR)/%.html)
 JUNKBALLS=$(JUNKDIRS:%=$(WEBDIR)/%.tar.bz2)
 
-upload: fastcheck
+upload: fastcheck modcheck
        git push origin HEAD:master
        git push github HEAD:master
 
+# Check MODS list in Makefile-ccan matches modules we find.
+modcheck:
+       @FOUND=$$(echo $$(find ccan -name _info | sed 's,ccan/\(.*\)/_info,\1,' | sort) ); LISTED=$$(echo $$(echo $(MODS) | tr ' ' '\012' | sort) ); if [ "$$FOUND" = "$$LISTED" ]; then exit 0; fi; while true; do a="$${FOUND%% *}"; b="$${LISTED%% *}"; if [ "$$a" != "$$b" ]; then echo "$$a found but $$b in MOD" >&2; exit 1; fi; FOUND="$${FOUND#* }"; LISTED="$${LISTED#* }"; done
+
 clean-tree:
        ! git status --porcelain | grep .
 
-webpages: clean-tree $(WEB_SUBDIRS) $(WEBDIR)/index.html $(WEBDIR)/upload.html $(WEBDIR)/uploader.php $(WEBDIR)/example-config.h $(WEBDIR)/ccan.jpg $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(WEBDIR)/Makefile-ccan $(ALL_PAGES) junkpages
+webpages: modcheck clean-tree $(WEB_SUBDIRS) $(WEBDIR)/index.html $(WEBDIR)/upload.html $(WEBDIR)/uploader.php $(WEBDIR)/example-config.h $(WEBDIR)/ccan.jpg $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(WEBDIR)/Makefile-ccan $(ALL_PAGES) junkpages
 
 junkpages: $(WEBDIR)/list.html $(WEBDIR)/junkcode $(JUNKPAGES) $(JUNKBALLS)
 $(WEB_SUBDIRS): $(WEBDIR)