# GNU make syntax reigns in this file.
-all_cflags += -Werror
+all_cflags += -Werror @more_warnings@
all_cppflags += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$<)).d
A2X = a2x
src/ccache.h \
src/compopt.h \
src/conf.h \
+ src/confitems.h \
src/counters.h \
+ src/envtoconfitems.h \
src/getopt_long.h \
src/hash.h \
src/hashtable.h \
src/confitems_lookup.c \
src/envtoconfitems.gperf \
src/envtoconfitems_lookup.c \
+ src/getopt_long.c \
src/main.c \
src/zlib/*.c \
src/zlib/*.h \
%_lookup.c: %.gperf
$(if $(quiet),@echo " GPERF $@")
- $(Q)$(GPERF) $< | awk '/#ifdef __GNUC__/ { ++i; if (i == 2) { print "static"; }} {print}' >$@
- $(Q)echo "static const size_t $$(echo $(notdir $*) | tr a-z A-Z)_TOTAL_KEYWORDS = $$(sed -nr 's/.*TOTAL_KEYWORDS = ([0-9]+).*/\1/p' $@);" >>$@
+ $(Q)$(GPERF) $< >$@
+ $(Q)echo "size_t $$(echo '$(notdir $*)_count(void)') { return $$(sed -nr 's/.*TOTAL_KEYWORDS = (.+),.*/\1/p' $@); }" >>$@
.PHONY: dist
dist: $(dist_archives)
tar -c $$tarcompression -f $(CURDIR)/$@ $(dist_dir)) && \
rm -rf $$tmpdir
-.PHONY: distcheck
-distcheck: $(firstword $(dist_archives))
+# $(1): extra configure options
+define do_distcheck
tmpdir=$$(mktemp -d /tmp/tmp-ccache-distcheck.XXXXXX) && \
(cd $$tmpdir && \
tar xf $(CURDIR)/$< && \
chmod -R a-w $(dist_dir) && \
chmod u+w $(dist_dir)/build && \
cd $(dist_dir)/build && \
- ../configure --prefix=$$tmpdir/root && \
- $(MAKE) install && \
+ ../configure --enable-more-warnings --prefix=$$tmpdir/root $(1) && \
+ $(MAKE) install CFLAGS=-Werror V=1 && \
$(MAKE) installcheck) && \
chmod -R u+w $$tmpdir/$(dist_dir) && \
rm -rf $$tmpdir
+endef
- tmpdir=$$(mktemp -d /tmp/tmp-ccache-distcheck.XXXXXX) && \
- (cd $$tmpdir && \
- tar xf $(CURDIR)/$< && \
- mkdir -p $(dist_dir)/build && \
- chmod -R a-w $(dist_dir) && \
- chmod u+w $(dist_dir)/build && \
- cd $(dist_dir)/build && \
- ../configure --prefix=$$tmpdir/root --with-bundled-zlib && \
- $(MAKE) install && \
- $(MAKE) installcheck) && \
- chmod -R u+w $$tmpdir/$(dist_dir) && \
- rm -rf $$tmpdir
+.PHONY: distcheck
+distcheck: $(firstword $(dist_archives))
+ $(call do_distcheck, --without-bundled-zlib)
+ $(call do_distcheck, --with-bundled-zlib)
+ $(call do_distcheck, CC=clang)
.PHONY: docs
docs: $(generated_docs)
cppcheck:
$(CPPCHECK) --suppressions-list=$(CPPCHECK_SUPPRESSIONS) \
--inline-suppr -q --enable=all --force -I . \
+ --template='cppcheck: warning: {id}:{file}:{line}: {message}' \
$(non_3pp_sources) src/main.c $(test_sources)
.PHONY: shellcheck