# This is the developer's makefile, not the user's makefile.
# Don't use it unless you know exactly what you do!

SHELL = /bin/sh

all : autoconf/aclocal.m4 configures

CONFIGURES = configure avcall/configure vacall/configure trampoline/configure
CONFIGURES_IN = configure.in avcall/configure.in vacall/configure.in trampoline/configure.in

ACLOCAL = ../src/autoconf/aclocal.m4
ACSELECT = ../src/autoconf/acselect

autoconf/aclocal.m4 : $(ACLOCAL)
	$(ACSELECT) `cat $(CONFIGURES_IN) | grep '^[A-Z][A-Z]_' | sed 's,[^A-Z_].*$$,,g' | sort | uniq` < $(ACLOCAL) > autoconf/aclocal.m4

configures : $(CONFIGURES)

AUTOCONF_FILES = autoconf/aclocal.m4 autoconf/acgeneral.m4 autoconf/acspecific.m4

configure : configure.in $(AUTOCONF_FILES)
	autoconf/autoconf -m autoconf

avcall/configure : avcall/configure.in $(AUTOCONF_FILES)
	cd avcall ; ../autoconf/autoconf -m ../autoconf

vacall/configure : vacall/configure.in $(AUTOCONF_FILES)
	cd vacall ; ../autoconf/autoconf -m ../autoconf

trampoline/configure : trampoline/configure.in $(AUTOCONF_FILES)
	cd trampoline ; ../autoconf/autoconf -m ../autoconf

check-configures : $(CONFIGURES)
	set -e; for f in $(CONFIGURES); do bash -x -n $$f; done

COMPILERS="cc -O" "gcc -freg-struct-return" "gcc -fpcc-struct-return"

multibuild : force
	for compiler in $(COMPILERS) ; do \
	  dir=build-`echo $$compiler | sed -e 's, ,,g' -e 's,/,_,g'`; \
	  mkdir $$dir; cd $$dir; \
	  CC="$$compiler" ../configure --srcdir=.. && make && make check; \
	  cd ..; \
	done

force :

