I have a makefile that has multiple targets for outputting data in different formats, e.g. make html
, make pdf
, make txt
etc. and I would like to have pre-build and post-build steps that run when any of these options are used. I have the pre-build step sorted, but not sure how I can get the post-build step working properly.
.PHONY: html pdf txt pre-build post-build
pre-build:
do-pre-build-stuff
post-build:
do-post-build-stuff
html: data.dat
generate-html data.dat
pdf: data.dat
generate-pdf data.dat
txt: data.dat
generate-txt data.dat
data.dat: pre-build
generate-some-data > data.dat
How can I get the post-build
step to run after every target?