X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=Makefile;h=d53e89f4d1ca9556e64187e4d3a1a63272b64c74;hp=ff0bad4e91acfd32d7a0e60366850b41b0c23ba8;hb=HEAD;hpb=2ee3b7c5586c283412ace072eed9d70a86368efd diff --git a/Makefile b/Makefile index ff0bad4e..875e99f2 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,10 @@ all:: # Our flags for building WARN_CFLAGS := -Wall -Wstrict-prototypes -Wold-style-definition -Wundef \ - -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wwrite-strings + -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wwrite-strings -Wshadow=local DEP_CFLAGS = -MMD -MP -MF$(@:%=%.d) -MT$@ CCAN_CFLAGS := -g3 -ggdb $(WARN_CFLAGS) -DCCAN_STR_DEBUG=1 -I. $(CFLAGS) +CFLAGS_FORCE_C_SOURCE := -x c # Anything with an _info file is a module ... INFO_SRCS := $(wildcard ccan/*/_info ccan/*/*/_info) @@ -18,7 +19,7 @@ ALL_INFOS := $(INFO_SRCS:%_info=%info) ALL_MODULES := $(ALL_INFOS:%/info=%) # ... Except stuff that needs external dependencies, which we exclude -EXCLUDE := altstack generator jmap jset nfs ogg_to_pcm tal/talloc wwviaudio +EXCLUDE := altstack jmap jset nfs ogg_to_pcm tal/talloc wwviaudio MODULES:= $(filter-out $(EXCLUDE:%=ccan/%), $(ALL_MODULES)) # Sources are C files in each module, objects the resulting .o files @@ -32,7 +33,7 @@ DEPS := $(OBJS:%=%.d) # _info files are compiled into executables and don't need dependencies %info : %_info config.h - $(PRE)$(CC) $(CCAN_CFLAGS) -I. -o $@ -x c $< + $(PRE)$(CC) $(CCAN_CFLAGS) -I. -o $@ $(CFLAGS_FORCE_C_SOURCE) $< # config.h is built by configurator which has no ccan dependencies CONFIGURATOR := tools/configurator/configurator @@ -45,7 +46,7 @@ config.h: $(CONFIGURATOR) Makefile TOOLS := tools/ccan_depends tools/doc_extract tools/namespacize tools/modfiles TOOLS_SRCS := $(filter-out $(TOOLS:%=%.c), $(wildcard tools/*.c)) TOOLS_DEPS := $(TOOLS_SRCS:%.c=%.d) $(TOOLS:%=%.d) -TOOLS_CCAN_MODULES := err foreach hash htable list noerr opt rbuf \ +TOOLS_CCAN_MODULES := asort err foreach hash htable list membuf noerr opt rbuf \ read_write_all str take tal tal/grab_file tal/link tal/path tal/str time TOOLS_CCAN_SRCS := $(wildcard $(TOOLS_CCAN_MODULES:%=ccan/%/*.c)) TOOLS_OBJS := $(TOOLS_SRCS:%.c=%.o) $(TOOLS_CCAN_SRCS:%.c=%.o) @@ -55,12 +56,15 @@ tools/% : tools/%.c $(TOOLS_OBJS) # ccanlint LINT := tools/ccanlint/ccanlint LINT_OPTS.ok := -s -LINT_OPTS.fast.ok := -s -x tests_pass_valgrind -x tests_compile_coverage +LINT_OPTS.fast-ok := -s -x tests_pass_valgrind -x tests_compile_coverage LINT_SRCS := $(filter-out $(LINT).c, $(wildcard tools/ccanlint/*.c tools/ccanlint/tests/*.c)) LINT_DEPS := $(LINT_SRCS:%.c=%.d) $(LINT).d -LINT_CCAN_MODULES := asort autodata dgraph ilog lbalance ptr_valid strmap +LINT_CCAN_MODULES := autodata dgraph ilog lbalance ptr_valid strmap LINT_CCAN_SRCS := $(wildcard $(LINT_CCAN_MODULES:%=ccan/%/*.c)) LINT_OBJS := $(LINT_SRCS:%.c=%.o) $(LINT_CCAN_SRCS:%.c=%.o) $(TOOLS_OBJS) +ifneq ($(GCOV),) +LINT_GCOV = --gcov="$(GCOV)" +endif $(LINT): $(LINT).c $(LINT_OBJS) $(PRE)$(CC) $(CCAN_CFLAGS) $(DEP_CFLAGS) $(LINT).c $(LINT_OBJS) -lm -o $@ @@ -70,12 +74,14 @@ $(LINT): $(LINT).c $(LINT_OBJS) TEST_DEPS := $(MODULES:%=%/.d) # We produce .ok files when the tests succeed -%.ok: $(LINT) - $(PRE)$(LINT) $(LINT_OPTS$(notdir $@)) --deps-fail-ignore $(LINTFLAGS) $(dir $*) && touch $@ +%.ok: $(LINT) %info + $(PRE)$(LINT) $(LINT_OPTS.ok) --deps-fail-ignore $(LINT_GCOV) $(LINTFLAGS) $(dir $*) && touch $@ + +%.fast-ok: $(LINT) %info + $(PRE)$(LINT) $(LINT_OPTS.fast-ok) --deps-fail-ignore $(LINT_GCOV) $(LINTFLAGS) $(dir $*) && touch $@ check: $(MODULES:%=%/.ok) -fastcheck: $(MODULES:%=%/.fast.ok) -fullcheck: $(MODULES:%=%/.full.ok) +fastcheck: $(MODULES:%=%/.fast-ok) ifeq ($(strip $(filter clean config.h, $(MAKECMDGOALS))),) -include $(DEPS) $(LINT_DEPS) $(TOOLS_DEPS) $(TEST_DEPS)