Makefile.am 2.89 KB
Newer Older
1 2
# got some hints from https://gitorious.org/openismus-playground/examplelib/source

3 4
SUBDIRS = lib include libwget examples src

5
if HAVE_PO
6 7 8 9 10
SUBDIRS += po
endif

if WITH_DOCS
SUBDIRS += docs
11 12
endif

13
SUBDIRS += fuzz unit-tests
14 15 16 17

if WITH_MICROHTTPD
SUBDIRS += tests
endif
18 19

ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
Tim Rühsen's avatar
Tim Rühsen committed
20

21 22 23 24 25
## Install the generated pkg-config file (.pc) into the expected location for
## architecture-dependent package configuration information. Occasionally,
## pkg-config files are also used for architecture-independent data packages,
## in which case the correct install location would be $(datadir)/pkgconfig.
pkgconfigdir = $(libdir)/pkgconfig
26
pkgconfig_DATA = libwget.pc
27

Tim Rühsen's avatar
Tim Rühsen committed
28
EXTRA_DIST = cfg.mk build-aux/config.rpath m4/gnulib-cache.m4 README.md contrib/check_options
29

30 31 32 33 34
dist-hook: gen-ChangeLog

.PHONY: gen-ChangeLog check-valgrind

gen-ChangeLog:
35 36
	$(AM_V_GEN)if test -d .git; then \
	  git log --no-merges --date=short \
37
	    --pretty='format:%ad %an <%ae>%w(0,0,5)%+B' | sed '/^[1-9].*/G' \
38
	    > $(distdir)/ChangeLog; \
39 40 41
	fi

check-valgrind:
42
	TESTS_ENVIRONMENT="VALGRIND_TESTS=1" $(MAKE) check
43 44

clean-lcov:
45
	rm -rf wget2.info */*.gc?? */.libs/*.gc?? lcov/
46 47
	lcov --zerocounters --directory src/ --directory libwget/

48
LCOV_INFO=wget2.info
49 50
check-coverage: clean clean-lcov
	$(MAKE) CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage"
51
	lcov --capture --initial --directory src/ --directory libwget/.libs --output-file $(LCOV_INFO)
52
	$(MAKE) CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage" VALGRIND_TESTS=0 check
53
	lcov --capture --directory src/ --directory libwget/.libs --output-file $(LCOV_INFO)
54
	lcov --remove $(LCOV_INFO) '*/test_linking.c' '*/css_tokenizer.lex' -o $(LCOV_INFO)
55
	genhtml --prefix . --ignore-errors source $(LCOV_INFO) --legend --title "Wget2" --output-directory=lcov
56 57
	@echo
	@echo "You can now view the coverage report with 'xdg-open lcov/index.html'"
58

59
fuzz-coverage: clean clean-lcov
60 61
	$(MAKE) -C lib
	$(MAKE) -C libwget CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage"
Tim Rühsen's avatar
Tim Rühsen committed
62
	$(MAKE) -C src CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage"
63
	$(MAKE) -C fuzz check CFLAGS="$(CFLAGS) --coverage" LDFLAGS="$(LDFLAGS) --coverage"
Tim Rühsen's avatar
Tim Rühsen committed
64 65
	lcov --capture --initial --directory libwget/.libs --directory fuzz --directory src --output-file $(LCOV_INFO)
	lcov --capture --directory libwget/.libs --directory fuzz --directory src --output-file $(LCOV_INFO)
66
	lcov --remove $(LCOV_INFO) '*/test_linking.c' '*/css_tokenizer.lex' -o $(LCOV_INFO)
67
	genhtml --prefix . --ignore-errors source $(LCOV_INFO) --legend --title "Wget2-fuzz" --output-directory=lcov
68 69
	@echo
	@echo "You can now view the coverage report with 'xdg-open lcov/index.html'"
70

71
check-local:
72 73
	$(AM_V_at)$(MAKE) -s syntax-check >/dev/null
	$(AM_V_at)$(srcdir)/contrib/check_options $(srcdir)/docs/wget2.md $(builddir)/src/wget2$(EXEEXT)
74 75 76 77

# ppl often forget to run ldconfig after an install, so let's do it here
install-exec-hook:
	$(AM_V_at)$(LDCONFIG)