1top_builddir=.
2-include $(top_builddir)/Makefile.config
3
4SUBDIRS = doc src
5SUBDIRS-$(CONFIG_NLS) += po
6CLEAN	= features.log
7calltest = $1-$1
8
9all-recursive: config.h
10
11# Automagically rerun autotools
12$(top_builddir)/config.status: $(top_srcdir)/configure
13	cd $(top_builddir) && $(SHELL) ./config.status --recheck
14
15ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
16$(ACLOCAL_M4): $(top_srcdir)/configure.in $(top_srcdir)/acinclude.m4
17	cd $(top_srcdir) && $(ACLOCAL)
18
19$(top_srcdir)/configure: $(top_srcdir)/configure.in $(ACLOCAL_M4)
20	cd $(top_srcdir) && $(AUTOCONF)
21
22# Makefile.config doesn't need a separate timestamp file because
23# touching it doesn't directly cause other files to be rebuilt.
24$(top_builddir)/Makefile.config: $(top_srcdir)/Makefile.config.in $(top_builddir)/config.status
25	cd $(top_builddir) \
26	  && CONFIG_FILES=Makefile.config CONFIG_HEADERS= \
27	     $(SHELL) ./config.status
28
29$(top_builddir)/config.h: $(top_builddir)/stamp-h
30	@cd $(top_builddir) && \
31	if test ! -f $@; then \
32		rm -f stamp-h; \
33		$(MAKE) stamp-h; \
34	else :; fi
35
36$(top_builddir)/stamp-h: $(top_srcdir)/config.h.in $(top_builddir)/config.status
37	cd $(top_builddir) \
38	  && CONFIG_FILES= CONFIG_HEADERS=config.h \
39	     $(SHELL) ./config.status
40	@echo timestamp > stamp-h 2> /dev/null
41
42$(top_srcdir)/config.h.in: $(top_srcdir)/stamp-h.in
43	@if test ! -f $@; then \
44		rm -f $(top_srcdir)/stamp-h.in; \
45		$(MAKE) $(top_srcdir)/stamp-h.in; \
46	else :; fi
47
48$(top_srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
49	cd $(top_srcdir) && $(AUTOHEADER)
50	@echo timestamp > $(top_srcdir)/stamp-h.in 2> /dev/null
51
52
53# Makefile.lib heavily uses $(call ...), which was added in GNU Make 3.78.
54# An elinks-users post on 2007-12-04 reported trouble with GNU Make 3.68.
55# Detect this situation and give an error message.  $(MAKECMDGOALS) is
56# only defined by 3.76 and later, so specify the "all" target as well.
57# This check has been tested with GNU Make 3.68, 3.77, 3.78.1, and 3.81.
58ifneq ($(call calltest,ok),ok-ok)
59$(MAKECMDGOALS) default all:
60	@echo >&2 "You need GNU Make 3.78 or later"
61	@false
62else
63ifeq ($(wildcard Makefile.config),)
64# Catch all
65$(MAKECMDGOALS) default:
66	@echo "You need to first run ./configure"
67else
68include $(top_srcdir)/Makefile.lib
69endif
70endif
71