Skip to content

Commit

Permalink
Merge pull request #15 from mjaschen/feat_make_makefile_behave_more_l…
Browse files Browse the repository at this point in the history
…ike_a_makefile

Add some tweaks to the Makefile to make it behave more like a Makefile
  • Loading branch information
hukl authored Feb 19, 2018
2 parents 24c364f + 44a1f65 commit c82ca56
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
src=hostmux.mandoc
tgt=man/hostmux.1

$(tgt): $(src)
mkdir -p $(shell dirname $(tgt))
mandoc -I os=sh -Tman $(src) > $(tgt)
# This target creates the manpage from its source file
#
# (1) Create target's directory if it doesn't exist
# (2) create the target $@ from the first prerequisite $<
# The shell redirection creates the target file before `mandoc` is
# actually executed. To avoid working further with an empty target file
# it's removed in case of an error and make exits with an error code.
man/hostmux.1: hostmux.mandoc
mkdir -p $(dir $@)
mandoc -I os=sh -Tman $< > $@ || { rm -f $@ ; exit 2 ; }

0 comments on commit c82ca56

Please sign in to comment.