]> git.donarmstrong.com Git - lilypond.git/blobdiff - stepmake/stepmake/help2man-rules.make
* stepmake/stepmake/*:
[lilypond.git] / stepmake / stepmake / help2man-rules.make
index d199a6212692c907608f4acbd693b1e771e1459a..51073c20b1e183aad51a215d54a13c73fa053159 100644 (file)
@@ -1,3 +1,35 @@
+# We must invoke the generated $(outdir)/help2man script instead of
+# the help2man.pl source, which means that the buildscripts directory
+# must be built first.
+#
+# From the perlrun man-page:
+#
+#      If the #! line does not contain the word "perl", the
+#       program named after the #! is executed instead of the Perl
+#       interpreter.  This is slightly bizarre, but it helps
+#
+# Indeed it is.  Perl sucks.
+#
+# Two screenfulls explaining that the otherwise standard #! is broken
+# for perl, and arguing that this broken magic is better in some
+# cases.  Four more explaining what a line comment is, and that it may
+# be parsed, same here.
 
+HELP2MAN_COMMAND = $(PERL) $(top-build-dir)/buildscripts/$(outbase)/help2man $< > $@
+
+ifeq ($(strip $(CROSS)),no)
 $(outdir)/%.1: $(outdir)/%
-       $(PERL) $(depth)/buildscripts/help2man.pl $< > $@
+       $(HELP2MAN_COMMAND)
+else
+# When cross building, some manpages will not build because the
+# executable does not run.  We assume the manpages to be generated
+# during a previous compile for the build host, with config=for-build,
+# in the directory $(outdir)-for-build.
+$(outdir)/%.1: $(outdir:%=%-for-build)/%.1
+       cp $< $@
+endif
+
+ifneq ($(outdir),./out)
+$(outdir)/%.1: out/%.1
+       cp $< $@
+endif