# Copyright (C) Martin Buchholz 2003
#
#  Permission to copy, use, sell and distribute this software is granted
#  provided this copyright notice appears in all copies.
#  Permission to modify the code and to distribute modified code is granted
#  provided this copyright notice appears in all copies, and a notice
#  that the code was modified is included with the copyright notice.
#
#  This software is provided "as is" without express or implied warranty,
#  and with no claim as to its suitability for any purpose.

# ----------------------------------------------------------------
# You'll need to, at least, modify these variables
GNUG_COMPILERS = \
	/usr/bin/g++ \
	/usr/local/bin/g++ \
	/hack/gcc/gcc-3.3-branch-inst/bin/g++ \
	/hack/gcc/gcc-cvs-inst/bin/g++

GNUC_COMPILERS := $(GNUG_COMPILERS:%/g++=%/gcc)

# ----------------------------------------------------------------
.PHONY : tests c++ c

tests : c++ c

c++ :
	for CC in $(GNUG_COMPILERS); do \
	  for double_align in "" -malign-double; do \
	    for long_double_align in "" -m128bit-long-double; do \
	      $$CC $$double_align $$long_double_align -Wall -I. main.cc \
		&& ./a.out; \
	    done; \
	  done; \
	done
	icc -I. main.cc && ./a.out

c :
	for CC in $(GNUC_COMPILERS); do \
	  for double_align in "" -malign-double; do \
	    for long_double_align in "" -m128bit-long-double; do \
	      $$CC $$double_align $$long_double_align -Wall -I. main.c \
		&& ./a.out; \
	    done; \
	  done; \
	done
	icc -I. main.c && ./a.out

# ----------------------------------------------------------------
RM = rm -f

clean:
	$(RM) *.o main core a.out

dist: clean
	@DIRNAME=`pwd | sed 's:.*/::'`; \
	cd ..; \
	echo tar czf $$DIRNAME.tar.gz $$DIRNAME; \
	tar czf $$DIRNAME.tar.gz $$DIRNAME
