chiark / gitweb /
various stuff into submakefiles
[subdirmk.git] / subdirmk / regen.mk.in
1
2 CONFIGURE       ?= configure
3 CONFIGURE_AC    ?= $(CONFIGURE).ac
4 CONFIG_STATUS   ?= config.status
5
6 CONFIGURE_ACS   += $(CONFIGURE_AC)
7 CONFIGURE_ACS   += subdirmk/subdirmk.ac
8
9 $(top_srcdir)/$(CONFIGURE): $(addprefix $(top_srcdir)/,$(CONFIGURE_ACS))
10         cd $(top_srcdir) && autoconf
11
12 $(CONFIG_STATUS): $(top_srcdir)/$(CONFIGURE)
13         ./$(CONFIG_STATUS) --recheck
14
15 MAKEFILES += subdirmk/regen.mk
16
17 MAKEFILE_TEMPLATES += $(top_srcdir)/Perdir.mk.in
18
19 main.mk $(MAKEFILES): .makefiles.stamp ;
20 .makefiles.stamp:                                               \
21                 $(top_srcdir)/subdirmk/generate                 \
22                 $(CONFIG_STATUS)                                \
23                 $(MAKEFILE_TEMPLATES)                           \
24                 $(foreach m,$(MAKEFILES),$(top_srcdir)/$(m).in)
25 # This filtering arranges that we can often run config.status to
26 # generate only particular output files.  We look for *inputs* that
27 # have changed.  If the only inputs that have changed are ones that we
28 # know affect only one output (Subdir.mk.in and regen.mk.in), we pass
29 # config.status the corresponding output file names.  Otherwise we
30 # pass nothing and config.status does them all.  We need to mention
31 # regen.mk.in twice because if $(top_srcdir) is `.', make elides the
32 # directory part from $?.
33         ./$(CONFIG_STATUS) $(if                                 \
34                 $(filter-out Subdir.mk.in %/Subdir.mk.in        \
35                         subdirmk/regen.mk.in                    \
36                         $(top_srcdir)/subdirmk/regen.mk.in      \
37                         , $?),,                                 \
38                 $(patsubst %.mk.in,%.mk,$(filter %.mk.in,$?)))
39         touch $@
40
41 realclean:: clean
42         $(RM) config.status config.log
43         $(RM) main.mk subdirmk/regen.mk $(MAKEFILES)
44         $(RM) $(addsuffix Makefile,$(dir $(MAKEFILES)))
45
46 -include $(ALL_DEPFILES)