1 # subdirmk - rules for regenerating makefiles etc.
2 # Copyright 2019 Mark Wooding
3 # Copyright 2019 Ian Jackson
4 # SPDX-License-Identifier: LGPL-2.0-or-later
7 CONFIGURE_AC ?= $(CONFIGURE).ac
8 CONFIG_STATUS ?= config.status
10 CONFIGURE_ACS += $(CONFIGURE_AC)
11 CONFIGURE_ACS += subdirmk/subdirmk.ac
13 $(top_srcdir)/$(CONFIGURE): $(addprefix $(top_srcdir)/,$(CONFIGURE_ACS))
14 cd $(top_srcdir) && autoconf
16 $(CONFIG_STATUS): $(top_srcdir)/$(CONFIGURE)
17 ./$(CONFIG_STATUS) --recheck
19 MAKEFILE_TEMPLATES += $(top_srcdir)/Perdir.sd.mk
20 MAKEFILE_TEMPLATES += $(addprefix $(top_srcdir)/, $(addsuffix .in, \
21 @_SUBDIRMK_MAKEFILES@ \
24 main.mk $(MAKEFILES): .makefiles.stamp ;
26 $(top_srcdir)/subdirmk/generate \
29 # This filtering arranges that we can often run config.status to
30 # generate only particular output files. We look for *inputs* that
31 # have changed. If the only inputs that have changed are ones that we
32 # know affect only one output (Subdir.mk.in and regen.mk.in), we pass
33 # config.status the corresponding output file names. Otherwise we
34 # pass nothing and config.status does them all. We need to mention
35 # regen.mk.in twice because if $(top_srcdir) is `.', make elides the
36 # directory part from $?.
37 ./$(CONFIG_STATUS) $(if \
38 $(filter-out Subdir.sd.mk %/Subdir.sd.mk \
42 $(patsubst %.sd.mk,%.mk,$(filter %.sd.mk,$?)) \
43 $(patsubst %.mk.in,%.mk,$(filter %.mk.in,$?))))
47 $(RM) config.status config.log
48 $(RM) main.mk subdirmk/regen.mk $(MAKEFILES)
49 $(RM) $(addsuffix Makefile,$(dir $(MAKEFILES)))
51 -include $(ALL_DEPFILES)