chiark / gitweb /
Documentation for regen.mk
[secnet.git] / subdirmk / regen.mk.in
index bd56a24e677174d10a57d362d272ecc0158e1d84..83952c9e648527eaf74b85b1c68317f13718ef50 100644 (file)
@@ -3,6 +3,20 @@
 #  Copyright 2019 Ian Jackson
 # SPDX-License-Identifier: LGPL-2.0-or-later
 
+# Usage:
+#   include subdirmk/regen.mk
+# (probably in toplevel Subdir.sd.mk)
+#
+# Arranges that config.status is automatically rerun to update
+# makefiles from templates, whenever a template *.sd.mk or *.mk.in is
+# edited; and that autoconf is rerun if configure's inputs are edited.
+#
+# If you add includes to configure.ac, add them to CONFIGURE_ACS.
+#
+# Also provides a `realclean::' target at the toplevel which deletes
+# the autoconf output.  This may be made into a recursive target
+# by mentioning &TARGETS_realclean in appropriate .sd.mk.
+
 CONFIGURE      ?= configure
 CONFIGURE_AC   ?= $(CONFIGURE).ac
 CONFIG_STATUS  ?= config.status
@@ -16,7 +30,7 @@ $(top_srcdir)/$(CONFIGURE): $(addprefix $(top_srcdir)/,$(CONFIGURE_ACS))
 $(CONFIG_STATUS): $(top_srcdir)/$(CONFIGURE)
        ./$(CONFIG_STATUS) --recheck
 
-MAKEFILE_TEMPLATES += $(top_srcdir)/Perdir.sd.mk
+# Normally, generate will add all the inputs to MAKEFILE_TEMPLATES.
 MAKEFILE_TEMPLATES += $(addprefix $(top_srcdir)/, $(addsuffix .in, \
        @_SUBDIRMK_MAKEFILES@ \
        ))
@@ -45,7 +59,7 @@ main.mk $(MAKEFILES): .makefiles.stamp ;
 
 realclean:: clean
        $(RM) config.status config.log
-       $(RM) main.mk subdirmk/regen.mk $(MAKEFILES)
+       $(RM) main.mk $(MAKEFILES) @_SUBDIRMK_MAKEFILES@
        $(RM) $(addsuffix Makefile,$(dir $(MAKEFILES)))
 
 -include $(ALL_DEPFILES)