.PHONY: all clean test \ check \ static \ go_files \ lcov.info GUILE := guile export GUILE GUILD := guild GUILE_VERSION=$(shell $(GUILE) -c '(display (version))') GUILE_SITE_DIR=$(shell $(GUILE) -c "(display (%site-dir))") GUILE_CCACHE_DIR=$(shell $(GUILE) -c "(display (%site-ccache-dir))") scm_files = \ base64 \ c/ast \ c/compiler \ c/cpp-environment \ c/cpp-types \ c/cpp-util \ c/eval-basic \ c/eval2 \ c/flatten-begin \ c/lex2 \ c/line-fold \ c/old/cpp \ c/old/lex \ c/old/operators \ c/old/parse \ c/parse2 \ c/preprocessor2 \ c/to-token \ c/trigraph \ c/unlex \ calp \ calp/benchmark/parse \ calp/config-base \ calp/entry-points/benchmark \ calp/entry-points/convert \ calp/entry-points/html \ calp/entry-points/ical \ calp/entry-points/import \ calp/entry-points/server \ calp/entry-points/terminal \ calp/entry-points/text \ calp/entry-points/tidsrapport \ calp/entry-points/update-zoneinfo \ calp/html/caltable \ calp/html/components \ calp/html/config \ calp/html/filter \ calp/html/util \ calp/html/vcomponent \ calp/html/view/calendar \ calp/html/view/calendar/month \ calp/html/view/calendar/shared \ calp/html/view/calendar/week \ calp/html/view/search \ calp/html/view/small-calendar \ calp/main \ calp/repl \ calp/server/routes \ calp/server/server \ calp/terminal \ calp/translation \ calp/util/config \ calp/util/exceptions \ calp/util/hooks \ calp/util/time \ crypto \ datetime \ datetime/instance \ datetime/timespec \ datetime/zic \ glob \ hnh/util \ hnh/util/env \ hnh/util/exceptions \ hnh/util/graph \ hnh/util/io \ hnh/util/language \ hnh/util/lens \ hnh/util/object \ hnh/util/options \ hnh/util/path \ hnh/util/tree \ hnh/util/type \ hnh/util/uuid \ hnh/util/values \ srfi/srfi-41/util \ srfi/srfi-64/test-error \ srfi/srfi-64/util \ sxml/html \ sxml/namespace \ sxml/transformations \ text/flow \ text/markup \ text/numbers \ text/numbers/en \ text/numbers/sv \ text/util \ vcomponent \ vcomponent/base \ vcomponent/config \ vcomponent/control \ vcomponent/datetime \ vcomponent/datetime/output \ vcomponent/duration \ vcomponent/formats/common/types \ vcomponent/formats/ical/output \ vcomponent/formats/ical/parse \ vcomponent/formats/ical/types \ vcomponent/formats/vdir/parse \ vcomponent/formats/vdir/save-delete \ vcomponent/formats/xcal/output \ vcomponent/formats/xcal/parse \ vcomponent/formats/xcal/types \ vcomponent/geo \ vcomponent/recurrence \ vcomponent/recurrence/display \ vcomponent/recurrence/display/common \ vcomponent/recurrence/display/en \ vcomponent/recurrence/display/sv \ vcomponent/recurrence/generate \ vcomponent/recurrence/internal \ vcomponent/recurrence/parse \ vcomponent/util/control \ vcomponent/util/describe \ vcomponent/util/group \ vcomponent/util/instance \ vcomponent/util/instance/methods \ vcomponent/util/parse-cal-path \ vcomponent/util/search \ vulgar \ vulgar/color \ vulgar/components \ vulgar/info \ vulgar/termios \ web/http/make-routes \ web/query \ web/uri-query \ xdg/basedir SCM_FILES = $(scm_files:%=module/%.scm) GO_FILES = $(SCM_FILES:module/%.scm=obj-$(GUILE_VERSION)/%.go) GUILE_ENV = GUILE_LOAD_PATH=$(PWD)/module \ GUILE_LOAD_COMPILED_PATH=$(PWD)/obj-$(GUILE_VERSION) GUILE_C_FLAGS = -Lmodule \ -Wshadowed-toplevel -Wunbound-variable \ -Wmacro-use-before-definition -Warity-mismatch \ -Wduplicate-case-datum -Wbad-case-datum # All po-files inside po/, except new.po, and hidden files PO_FILES = $(shell find po -type f -name \*.po -and -not -name new.po -and -not -name .\*) LOCALIZATIONS = $(PO_FILES:po/%.po=localization/%/LC_MESSAGES/calp.mo) # Limit test to these files LIMIT_FILES=$(LIMIT:%=--only %) # Skip these files when testing SKIP=--skip $(PWD)/tests/test/web-server.scm all: go_files README static $(LOCALIZATIONS) $(MAKE) -C doc/ref XGETTEXT_FLAGS = --from-code=UTF-8 --add-comments --indent -k_ static: $(MAKE) -C static obj-$(GUILE_VERSION)/%.go: module/%.scm @echo $(GUILD) $(GUILE_VERSION) compile $< @env $(GUILE_ENV) $(GUILD) compile $(GUILE_C_FLAGS) -o $@ $< >/dev/null # Phony target used by test/run-tests.scm and main to # automatically compile everything before they run. go_files: $(GO_FILES) po/%.po: $(SCM_FILES) xgettext $(XGETTEXT_FLAGS) --output $@ -L scheme $^ --join-existing --omit-header --no-location po/new.po: $(SCM_FILES) xgettext $(XGETTEXT_FLAGS) --output $@ -L scheme $^ localization/%/LC_MESSAGES/calp.mo: po/%.po -@mkdir -p $(shell dirname $@) msgfmt --check -o $@ $< clean: -$(MAKE) -C static clean -rm -r obj-* install: all install -d $(DESTDIR)$(GUILE_SITE_DIR) $(DESTDIR)$(GUILE_CCACHE_DIR) rsync -a module/ $(DESTDIR)$(GUILE_SITE_DIR) rsync -a obj-$(GUILE_VERSION)/ $(DESTDIR)$(GUILE_CCACHE_DIR) install -d $(DESTDIR)/usr/share/calp/www $(MAKE) -C static install $(MAKE) -C system install $(MAKE) -C doc/ref install install -m 644 -D -t $(DESTDIR)/usr/share/doc/calp README install -m 755 -D -t $(DESTDIR)/usr/lib/calp/ scripts/tzget install -m755 -D production-main $(DESTDIR)/usr/bin/calp README: README.in ./main text < README.in | sed "s/<>/`date -I`/" > README lcov.info: $(GO_FILES) env DEBUG=0 tests/run-tests.scm --coverage=$@ $(if $(VERBOSE),--verbose) $(SKIP) $(LIMIT_FILES) test: coverage GENHTML_FLAGS=--show-details \ --prefix $(shell pwd)/module \ --no-function-coverage \ --quiet coverage: lcov.info genhtml $(GENHTML_FLAGS) --output-directory $@ $< check: tests/run-tests.scm $(if $(VERBOSE),--verbose) $(SKIP) $(LIMIT_FILES)