Files
todo.txt-cli/Makefile
Alberto Fanjul 64f9c8295d new: Configurable config dir (#223)
- Configurable config dir
- Describe Makefile options
2017-10-16 10:01:47 -05:00

64 lines
1.6 KiB
Makefile

#
# Makefile for todo.txt
#
INSTALL_DIR=/usr/local/bin
CONFIG_DIR=/etc
BASH_COMPLETION_DIR=/etc/bash_completion.d
# Dynamically detect/generate version file as necessary
# This file will define a variable called VERSION.
.PHONY: .FORCE-VERSION-FILE
VERSION-FILE: .FORCE-VERSION-FILE
@./GEN-VERSION-FILE
-include VERSION-FILE
# Maybe this will include the version in it.
todo.sh: VERSION-FILE
# For packaging
DISTFILES := todo.cfg todo_completion
DISTNAME=todo.txt_cli-$(VERSION)
dist: $(DISTFILES) todo.sh
mkdir -p $(DISTNAME)
cp -f $(DISTFILES) $(DISTNAME)/
sed -e 's/@DEV_VERSION@/'$(VERSION)'/' todo.sh > $(DISTNAME)/todo.sh
tar cf $(DISTNAME).tar $(DISTNAME)/
gzip -f -9 $(DISTNAME).tar
zip -9r $(DISTNAME).zip $(DISTNAME)/
rm -r $(DISTNAME)
.PHONY: clean
clean: test-pre-clean
rm -f $(DISTNAME).tar.gz $(DISTNAME).zip
rm VERSION-FILE
install:
mkdir -p $(INSTALL_DIR)
install --mode=755 todo.sh $(INSTALL_DIR)
mkdir -p $(BASH_COMPLETION_DIR)
install --mode=644 todo_completion $(BASH_COMPLETION_DIR)/todo
mkdir -p $(CONFIG_DIR)/todo
[ -e $(CONFIG_DIR)/todo/config ] || \
sed "s/^\(export[ \t]*TODO_DIR=\).*/\1~\/.todo/" todo.cfg > $(CONFIG_DIR)/todo/config
#
# Testing
#
TESTS = $(wildcard tests/t[0-9][0-9][0-9][0-9]-*.sh)
#TEST_OPTIONS=--verbose
test-pre-clean:
rm -rf tests/test-results "tests/trash directory"*
aggregate-results: $(TESTS)
$(TESTS): test-pre-clean
cd tests && ./$(notdir $@) $(TEST_OPTIONS)
test: aggregate-results
tests/aggregate-results.sh tests/test-results/t*-*
rm -rf tests/test-results
# Force tests to get run every time
.PHONY: test test-pre-clean aggregate-results $(TESTS)