SHELL := /bin/bash CUSTOMER := $(shell basename $(shell dirname $(shell pwd) ) ) INVOICE_DATE := $(shell basename $(shell pwd) ) #.PHONY: timesheet.txt timesheet.html invoice.html invoice.pdf default: invoice.pdf clean: rm -fv amount.sh.inc pay.url invoice-top.html billable.sql complete.sql timesheet.txt timesheet.html email.txt email-draft.txt invoice.html invoice.pdf amount.sh.inc: amount.sql billable.sql cat billable.sql amount.sql | ssh taskdb psql --tuples-only --quiet --no-align > $@ cat $@ pay.url: amount.sh.inc timesheet.txt # Double-check timesheet.txt # Duplicate product from previous month # Change amount and month in item description # Create payment link # When done, put the link into pay.url false invoice-top.html: invoice-top.html.in pay.url amount.sh.inc #false # render export CUSTOMER=$(CUSTOMER) INVOICE_DATE=$(INVOICE_DATE); source <(cat env.sh.inc amount.sh.inc | sed -e 's/^.*=/export &/') && envsubst < $< > $@ amount.sql: amount.sql.in env.sh.inc export CUSTOMER=$(CUSTOMER) INVOICE_DATE=$(INVOICE_DATE); source <(cat env.sh.inc | sed -e 's/^.*=/export &/') && envsubst < $< > $@.tmp mv $@.tmp $@ billable.sql: billable.sql.in env.sh.inc export CUSTOMER=$(CUSTOMER) INVOICE_DATE=$(INVOICE_DATE); source <(cat env.sh.inc | sed -e 's/^.*=/export &/') && envsubst < $< > $@.tmp mv $@.tmp $@ complete.sql: complete.sql.in billable.sql env.sh.inc cat billable.sql > $@.tmp export CUSTOMER=$(CUSTOMER) INVOICE_DATE=$(INVOICE_DATE); source <(cat env.sh.inc | sed -e 's/^.*=/export &/') && envsubst < $< >> $@.tmp mv $@.tmp $@ timesheet.txt: complete.sql ssh taskdb psql --quiet < complete.sql > $@.tmp mv $@.tmp $@ timesheet.html: complete.sql ssh taskdb psql -H --quiet < complete.sql > $@.tmp # avoid overflow on the right in PDF: sed -i -e 's/