-# This generates the hugehelp.c file
-hugehelp.c: $(README) $(MANPAGE) mkhelp.pl
- rm -f hugehelp.c
- $(NROFF) -man $(MANPAGE) | $(PERL) $(MKHELP) $(MKHELPOPT) $(README) > hugehelp.c
+if HAVE_LIBZ
+# This generates the tool_hugehelp.c file in both uncompressed and
+# compressed formats.
+$(HUGE): $(MANPAGE) $(README) $(MKHELP)
+ echo '#include "tool_setup.h"' > $(HUGE)
+ echo '#ifndef HAVE_LIBZ' >> $(HUGE)
+ $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
+ echo '#else' >> $(HUGE)
+ $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c $(README) >> $(HUGE)
+ echo '#endif /* HAVE_LIBZ */' >> $(HUGE)
+else # HAVE_LIBZ
+# This generates the tool_hugehelp.c file uncompressed only
+$(HUGE): $(MANPAGE) $(README) $(MKHELP)
+ echo '#include "tool_setup.h"' > $(HUGE)
+ $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
+endif
+
+else # USE_MANUAL
+# built-in manual has been disabled, make a blank file
+$(HUGE):
+ echo "/* built-in manual is disabled, blank function */" > $(HUGE)
+ echo '#include "tool_hugehelp.h"' >> $(HUGE)
+ echo "void hugehelp(void) {}" >>$(HUGE)
+endif
+
+# ignore tool_hugehelp.c since it is generated source code and it plays
+# by slightly different rules!
+checksrc:
+ @PERL@ $(top_srcdir)/lib/checksrc.pl -D$(srcdir) \
+ -W$(srcdir)/tool_hugehelp.c $(srcdir)/*.[ch]