2023-01-29 07:26:46 +01:00
|
|
|
## Copyright (C) 2008-2023 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
2021-08-28 10:25:05 +02:00
|
|
|
##
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published by
|
|
|
|
## the Free Software Foundation; either version 3 of the License, or
|
|
|
|
## (at your option) any later version.
|
|
|
|
##
|
|
|
|
## This program is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
|
|
|
## You should have received a copy of the GNU General Public License
|
|
|
|
## along with this program; if not, write to the Free Software Foundation,
|
|
|
|
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
# Makefile with some useful targets for meson/ninja
|
|
|
|
|
2022-05-23 22:54:16 +02:00
|
|
|
NINJA ?= ninja
|
|
|
|
BUILDDIR ?= $(CURDIR)/build
|
|
|
|
COVERAGE_BUILDDIR ?= $(CURDIR)/build-coverage
|
|
|
|
MESON ?= meson
|
|
|
|
V ?= 0
|
2021-08-28 10:25:05 +02:00
|
|
|
|
2022-04-18 20:33:43 +02:00
|
|
|
ifneq ($(V),0)
|
|
|
|
VERBOSE=--verbose
|
|
|
|
endif
|
2022-02-18 06:11:18 +01:00
|
|
|
|
2022-12-12 22:51:31 +01:00
|
|
|
# when MU_HACKER is set, do a debug build
|
2023-01-29 07:26:46 +01:00
|
|
|
# MU_HACKER is for djcb & compatible developers
|
2022-12-12 22:51:31 +01:00
|
|
|
ifneq (${MU_HACKER},)
|
2023-01-29 07:26:46 +01:00
|
|
|
MESON_FLAGS:=$(MESON_FLAGS) '-Dbuildtype=debug' \
|
|
|
|
'-Db_sanitize=address' \
|
|
|
|
'-Dreadline=enabled'
|
2022-12-12 22:51:31 +01:00
|
|
|
endif
|
|
|
|
|
2022-05-27 20:06:29 +02:00
|
|
|
.PHONY: all
|
|
|
|
.PHONY: check test test-verbose-if-fail test-valgrind test-helgrind
|
|
|
|
.PHONY: benchmark coverage
|
2023-04-11 19:49:31 +02:00
|
|
|
.PHONY: dist install uninstall clean distclean
|
2022-05-27 20:06:29 +02:00
|
|
|
.PHONY: mu4e-doc-html
|
|
|
|
|
2022-02-18 06:11:18 +01:00
|
|
|
# MESON_FLAGS, e.g. "-Dreadline=enabled"
|
|
|
|
|
|
|
|
# examples:
|
|
|
|
# 1. build with clang, and the thread-sanitizer
|
|
|
|
# make clean all MESON_FLAGS="-Db_sanitize=thread" CXX=clang++ CC=clang
|
2021-08-28 10:25:05 +02:00
|
|
|
all: $(BUILDDIR)
|
2022-12-12 22:51:31 +01:00
|
|
|
@$(NINJA) -C $(BUILDDIR) $(VERBOSE)
|
2023-01-28 14:57:02 +01:00
|
|
|
@ln -sf $(BUILDDIR)/compile_commands.json $(CURDIR) || /bin/true
|
2021-08-28 10:25:05 +02:00
|
|
|
|
|
|
|
$(BUILDDIR):
|
2023-04-09 09:02:17 +02:00
|
|
|
@$(MESON) setup $(MESON_FLAGS) $(BUILDDIR)
|
2021-08-28 10:25:05 +02:00
|
|
|
|
|
|
|
check: test
|
|
|
|
|
2022-02-19 23:38:13 +01:00
|
|
|
test: all
|
2022-12-12 22:51:31 +01:00
|
|
|
@$(MESON) test $(VERBOSE) -C $(BUILDDIR)
|
2021-08-28 10:25:05 +02:00
|
|
|
|
2022-05-27 20:06:29 +02:00
|
|
|
install: $(BUILDDIR)
|
|
|
|
@cd $(BUILDDIR); $(MESON) install
|
|
|
|
|
2023-04-11 19:49:31 +02:00
|
|
|
uninstall: $(BUILDDIR)
|
|
|
|
@$(NINJA) -C $(BUILDDIR) uninstall
|
|
|
|
|
2022-05-27 20:06:29 +02:00
|
|
|
clean:
|
|
|
|
@rm -rf $(BUILDDIR) $(COVERAGE_BUILDDIR)
|
|
|
|
|
|
|
|
#
|
|
|
|
# below targets are just for development/testing/debugging. They may or
|
|
|
|
# may not work on your system.
|
|
|
|
#
|
|
|
|
|
2022-02-26 09:08:48 +01:00
|
|
|
test-verbose-if-fail: all
|
|
|
|
@cd $(BUILDDIR); $(MESON) test || $(MESON) test --verbose
|
|
|
|
|
2022-12-13 00:00:50 +01:00
|
|
|
vg_opts:=--enable-debuginfod=no --leak-check=full --error-exitcode=1
|
|
|
|
test-valgrind: export G_SLICE=always-malloc
|
|
|
|
test-valgrind: export G_DEBUG=gc-friendly
|
2021-10-20 22:05:48 +02:00
|
|
|
test-valgrind: $(BUILDDIR)
|
2022-12-13 00:00:50 +01:00
|
|
|
@cd $(BUILDDIR); $(MESON) test \
|
|
|
|
--wrap="valgrind $(vg_opts)" \
|
2022-04-09 18:17:49 +02:00
|
|
|
--timeout-multiplier 100
|
2021-10-20 22:05:48 +02:00
|
|
|
|
2022-06-08 06:51:23 +02:00
|
|
|
# we do _not_ pass helgrind; but this seems to be a false-alarm
|
|
|
|
# https://gitlab.gnome.org/GNOME/glib/-/issues/2662
|
|
|
|
# test-helgrind: $(BUILDDIR)
|
2022-12-12 22:51:31 +01:00
|
|
|
# @cd $(BUILDDIR); TEST=HELGRIND $(MESON) test \
|
|
|
|
# --wrap='valgrind --tool=helgrind --error-exitcode=1' \
|
|
|
|
# --timeout-multiplier 100
|
2022-02-18 06:11:18 +01:00
|
|
|
|
2022-05-27 20:06:29 +02:00
|
|
|
benchmark: $(BUILDDIR)
|
|
|
|
$(NINJA) -C $(BUILDDIR) benchmark
|
|
|
|
|
2022-05-23 22:54:16 +02:00
|
|
|
$(COVERAGE_BUILDDIR):
|
|
|
|
$(MESON) -Db_coverage=true --buildtype=debug $(COVERAGE_BUILDDIR)
|
|
|
|
|
|
|
|
covfile:=$(COVERAGE_BUILDDIR)/meson-logs/coverage.info
|
|
|
|
|
|
|
|
# generate by hand, meson's built-ins are unflexible
|
|
|
|
coverage: $(COVERAGE_BUILDDIR)
|
2022-05-27 20:06:29 +02:00
|
|
|
$(NINJA) -C $(COVERAGE_BUILDDIR) test
|
2022-05-23 22:54:16 +02:00
|
|
|
lcov --capture --directory . --output-file $(covfile)
|
2022-05-24 18:36:39 +02:00
|
|
|
@lcov --remove $(covfile) '/usr/*' '*guile*' '*thirdparty*' '*/tests/*' '*mime-object*' --output $(covfile)
|
2022-06-29 21:20:44 +02:00
|
|
|
@lcov --remove $(covfile) '*mu/mu/*' --output $(covfile)
|
2022-05-24 18:36:39 +02:00
|
|
|
@mkdir -p $(COVERAGE_BUILDDIR)/meson-logs/coverage
|
|
|
|
@genhtml $(covfile) --output-directory $(COVERAGE_BUILDDIR)/meson-logs/coverage/
|
2022-06-02 20:02:11 +02:00
|
|
|
@echo "coverage report at: file://$(COVERAGE_BUILDDIR)/meson-logs/coverage/index.html"
|
2021-08-28 10:25:05 +02:00
|
|
|
dist: $(BUILDDIR)
|
|
|
|
@cd $(BUILDDIR); $(MESON) dist
|
|
|
|
|
2022-05-27 20:06:29 +02:00
|
|
|
distclean: clean
|
2021-08-28 10:25:05 +02:00
|
|
|
|
2021-09-04 09:41:07 +02:00
|
|
|
HTMLPATH=${BUILDDIR}/mu4e/mu4e
|
|
|
|
mu4e-doc-html:
|
|
|
|
@mkdir -p ${HTMLPATH} && cp mu4e/texinfo-klare.css ${HTMLPATH}
|
2023-03-26 09:10:15 +02:00
|
|
|
@makeinfo -I ${BUILDDIR}/mu4e --html --css-ref=texinfo-klare.css -o ${HTMLPATH} mu4e/mu4e.texi
|