# -*- makefile -*-
# This file contains special make rules to generate codelets.
# This file requires GNU make .

CODLIST = codlist.c
CODELET_NAME=codelet_

# rule to build codlist
$(CODLIST): Makefile
	(								\
	echo "#include \"ifftw.h\"";					\
	echo;								\
	for i in $(ALL_CODELETS) NIL; do				\
	   if test "$$i" != NIL; then					\
	     j=`basename $$i | sed -e 's/[.][cS]$$//g'`;		\
             echo "extern void X($(CODELET_NAME)$$j)(planner *);";	\
           fi								\
	done;								\
	echo;								\
	echo;								\
	echo "extern const solvtab $(SOLVTAB_NAME);";		        \
	echo "const solvtab $(SOLVTAB_NAME) = {";		        \
	for i in $(ALL_CODELETS) NIL; do				\
	   if test "$$i" != NIL; then					\
	     j=`basename $$i | sed -e 's/[.][cS]$$//g'`;		\
	     echo "   SOLVTAB(X($(CODELET_NAME)$$j)),";			\
	   fi								\
	done;								\
	echo "   SOLVTAB_END";						\
	echo "};";							\
	) >$@

clean-local:
	rm -f codlist.c

if MAINTAINER_MODE

INDENT = indent -kr -cs -i5 -l800 -fca -nfc1 -sc -sob -cli4 -TR -Tplanner -TV
GENFFTDIR = ${top_builddir}/genfft
K7GENFFTDIR = ${top_builddir}/genfft-k7
GEN_NOTW = ${GENFFTDIR}/gen_notw
GEN_NOTW_NOINLINE = ${GENFFTDIR}/gen_notw_noinline
GEN_NOTW_C = ${GENFFTDIR}/gen_notw_c
GEN_NOTW_NOINLINE_C = ${GENFFTDIR}/gen_notw_noinline_c
K7GEN_NOTW = ${K7GENFFTDIR}/gen_notw
GEN_TWIDDLE = ${GENFFTDIR}/gen_twiddle
GEN_TWIDDLE_C = ${GENFFTDIR}/gen_twiddle_c
K7GEN_TWIDDLE = ${K7GENFFTDIR}/gen_twiddle
GEN_TWIDSQ = ${GENFFTDIR}/gen_twidsq
GEN_TWIDSQ_C = ${GENFFTDIR}/gen_twidsq_c
GEN_R2HC = ${GENFFTDIR}/gen_r2hc
GEN_R2HC_NOINLINE = ${GENFFTDIR}/gen_r2hc_noinline
GEN_HC2R = ${GENFFTDIR}/gen_hc2r
GEN_HC2R_NOINLINE = ${GENFFTDIR}/gen_hc2r_noinline
GEN_HC2HC = ${GENFFTDIR}/gen_hc2hc
GEN_R2R = ${GENFFTDIR}/gen_r2r
PRELUDE_DFT = ${top_srcdir}/support/codelet_prelude.dft
PRELUDE_RDFT = ${top_srcdir}/support/codelet_prelude.rdft
ASMPRELUDE = ${top_srcdir}/support/codelet_asmprelude
ADD_DATE = sed -e s/@DATE@/"`date`"/

COPYRIGHT=${top_srcdir}/COPYRIGHT
CODELET_DEPS=$(COPYRIGHT) $(PRELUDE) $(ASMPRELUDE)
PRELUDE_COMMANDS_DFT=cat $(COPYRIGHT) $(PRELUDE_DFT)
PRELUDE_COMMANDS_RDFT=cat $(COPYRIGHT) $(PRELUDE_RDFT)
ASMPRELUDE_COMMANDS=cat $(COPYRIGHT) $(ASMPRELUDE)

if FMA
FLAGS_FMA = -fma
else
FLAGS_FMA =
endif

FLAGS_COMMON = -compact -variables 4 $(FLAGS_FMA) #-no-randomized-cse
DFT_FLAGS_COMMON = $(FLAGS_COMMON) 
RDFT_FLAGS_COMMON = $(FLAGS_COMMON)

# cancel the hideous builtin rules that cause an infinite loop
%: %.o
%: %.s
%: %.c
%: %.S

endif # MAINTAINER_MODE
