]> git.donarmstrong.com Git - lilypond.git/blob - stepmake/stepmake/help2man-rules.make
Imported Upstream version 2.19.45
[lilypond.git] / stepmake / stepmake / help2man-rules.make
1 # We must invoke the generated $(outdir)/help2man script instead of
2 # the help2man.pl source, which means that the scripts/build directory
3 # must be built first.
4 #
5 # From the perlrun man-page:
6 #
7 #       If the #! line does not contain the word "perl", the
8 #       program named after the #! is executed instead of the Perl
9 #       interpreter.  This is slightly bizarre, but it helps
10 #
11 # Indeed it is.  Perl sucks.
12 #
13 # Two screenfulls explaining that the otherwise standard #! is broken
14 # for perl, and arguing that this broken magic is better in some
15 # cases.  Four more explaining what a line comment is, and that it may
16 # be parsed, same here.
17
18 ifeq ($(PYTHON),$(TARGET_PYTHON))
19 HELP2MAN_COMMAND = $(buildscript-dir)/help2man $< > $@
20 else
21 HELP2MAN_COMMAND = $(buildscript-dir)/help2man "env $$(basename $$(head -1 $<)) $<" > $@
22 endif
23
24 ifeq ($(strip $(CROSS)),no)
25 $(outdir)/%.1: $(outdir)/% $(buildscript-dir)/help2man
26         echo $(buildscript-dir)/help2man
27         $(HELP2MAN_COMMAND)
28 else
29 # When cross building, some manpages will not build because the
30 # executable does not run.  We assume the manpages to be generated
31 # during a previous compile for the build host, with config=for-build,
32 # in the directory $(outdir)-for-build.
33 $(outdir)/%.1: $(outdir:%=%-for-build)/%.1
34         cp $< $@
35 endif
36
37 ifneq ($(outdir),./out)
38 $(outdir)/%.1: out/%.1
39         cp $< $@
40 endif
41
42 $(buildscript-dir)/help2man:
43         $(MAKE) -C $(depth)/scripts/build