Imported Upstream version 3.5.1
[platform/upstream/ccache.git] / dev.mk.in
index 914786e..a1ee969 100644 (file)
--- a/dev.mk.in
+++ b/dev.mk.in
@@ -1,6 +1,6 @@
 # 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
@@ -38,7 +38,9 @@ headers = \
     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 \
@@ -87,6 +89,7 @@ source_dist_files = \
     src/confitems_lookup.c \
     src/envtoconfitems.gperf \
     src/envtoconfitems_lookup.c \
+    src/getopt_long.c \
     src/main.c \
     src/zlib/*.c \
     src/zlib/*.h \
@@ -110,8 +113,8 @@ src/version.o: src/version.c
 
 %_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)
@@ -136,8 +139,8 @@ $(dist_archives): $(dist_files)
         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)/$< && \
@@ -145,24 +148,18 @@ distcheck: $(firstword $(dist_archives))
         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)
@@ -197,6 +194,7 @@ check-syntax:
 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