# # mmap-unifont - Global Makefile # Copyright (c) 2012-2014 David Herrmann # # # Global Configurations and Initializations # ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} AM_MAKEFLAGS = --no-print-directory AUTOMAKE_OPTIONS = color-tests SUBDIRS = . .DELETE_ON_ERROR: include_HEADERS = EXTRA_DIST = \ README \ COPYING \ NEWS \ DOCUMENTATION CLEANFILES = pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = dist_pkgdata_DATA = TPHONY = TESTS = MEMTESTS = check_PROGRAMS = bin_PROGRAMS = lib_LTLIBRARIES = noinst_LTLIBRARIES = # # Default CFlags # AM_CFLAGS = \ -Wall \ -pipe \ -fno-common \ -ffast-math \ -fdiagnostics-show-option \ -fno-strict-aliasing \ -fvisibility=hidden \ -ffunction-sections \ -fdata-sections AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ -I $(srcdir)/src \ '-DPKGDATADIR="$(pkgdatadir)"' AM_LDFLAGS = \ -Wl,--as-needed \ -Wl,--gc-sections \ -Wl,-z,relro \ -Wl,-z,now # # mmap-unifont # pkgconfig_DATA += src/mmap-unifont.pc EXTRA_DIST += \ src/compile-unifont.py \ src/mmap-unifont.pc.in \ src/unifont.hex dist_pkgdata_DATA += src/mmap-unifont.bin src/mmap-unifont.bin: src/compile-unifont.py src/unifont.hex $(AM_V_GEN)cat $(top_srcdir)/src/unifont.hex | $(PYTHON) $< >$@ src/mmap-unifont.cmp: src/compile-unifont.py src/mmap-unifont.bin $(AM_V_GEN)cat $(top_srcdir)/src/mmap-unifont.bin | $(PYTHON) $< verify >$@ test-unifont: src/mmap-unifont.bin src/mmap-unifont.cmp @RET=`diff -u src/unifont.hex src/mmap-unifont.cmp | wc -l` ; \ if test "x$$?" != "x0" -o "x$$RET" != "x0" ; then \ echo "Generated Unifont-file differs from original; generator probably broken" ; \ exit 1 ; \ fi @echo "mmap-unifont.bin has been regenerated" # # Tests # We add a separate "memcheck" target which runs valgrind on all tests in # MEMTESTS. Note that we fail if _any_ leak is detected by valgrind. Thus, you # need to have valgrind installed and libcheck running properly (without leaks) # to make memcheck succeed. # A separate memcheck-verify actually runs a faulty test and verifies the # valgrind tests work properly. # if BUILD_HAVE_CHECK MEMTESTS += \ test-example check_PROGRAMS += \ $(MEMTESTS) \ test-valgrind TESTS += \ $(MEMTESTS) \ test-valgrind endif test_sources = \ test/test-common.h test_libs = \ $(CHECK_LIBS) test_cflags = \ $(AM_CPPFLAGS) \ $(CHECK_CFLAGS) test_lflags = \ $(AM_LDFLAGS) test_example_SOURCES = test/test-example.c $(test_sources) test_example_CPPFLAGS = $(test_cflags) test_example_LDADD = $(test_libs) test_example_LDFLAGS = $(test_lflags) test_valgrind_SOURCES = test/test-valgrind.c $(test_sources) test_valgrind_CPPFLAGS = $(test_cflags) test_valgrind_LDADD = $(test_libs) test_valgrind_LDFLAGS = $(test_lflags) EXTRA_DIST += test.supp VALGRIND = CK_FORK=no valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --leak-resolution=high --error-exitcode=1 --suppressions=$(top_builddir)/test.supp # verify that test-valgrind actually leaks data memcheck-verify: check $(AM_V_GEN)$(VALGRIND) --log-file=/dev/null ./test-valgrind >/dev/null ; test 1 = $$? TPHONY += memcheck-verify # run memcheck tests via valgrind memcheck: memcheck-verify $(AM_V_GEN)for i in $(MEMTESTS) ; do \ $(VALGRIND) --log-file=$(top_builddir)/$$i.memlog \ $(top_builddir)/$$i >/dev/null || (echo "memcheck failed on: $$i" ; exit 1) ; \ done TPHONY += memcheck memcheck-verify distcheck-hook: test-unifont memcheck # # Phony targets # .PHONY: $(TPHONY) # # Empty .SECONDARY target causes alle intermediate files to be treated as # secondary files. That is, they don't get deleted after make finished. # .SECONDARY: