#!/bin/sh

#
# shell script to create a Jamfile for all the tests:
#

all_source=""

#start Jamfile:
cat > Jamfile << EOF

subproject libs/type_traits/test ;

# bring in the rules for testing
SEARCH on testing.jam = \$(BOOST_BUILD_PATH) ;
include testing.jam ;

{

local TYPE_TRAIT_PATH = "" ;
local TEST_LIB_PATH = "../../test/build/" ;


EOF

for file in *.cpp ; do
	if [ $file != init.cpp ] ; then
		if [ $file != template.cpp ] ; then
		
			if [ a"$all_source" != "a" ] ; then
				all_source="\$(TYPE_TRAIT_PATH)$file $all_source"
			else
				all_source="\$(TYPE_TRAIT_PATH)$file"
			fi
			
			cat >> Jamfile_temp << EOF
			
	[ run \$(TYPE_TRAIT_PATH)$file
   		<lib>\$(TYPE_TRAIT_PATH)type_traits_init 
   		<lib>\$(TEST_LIB_PATH)unit_test_framework 
		:
			--report_level=detailed --build_info=yes --log_level=messages
		: 
		:
			<sysinclude>\$(BOOST_ROOT)
		:
		]
			
EOF
		fi
	fi
done

# finish off Jamfile:

cat >> Jamfile << EOF
	
test-suite type_traits :

	[ lib type_traits_init : \$(TYPE_TRAIT_PATH)init.cpp 
    	: 
        	<sysinclude>\$(BOOST_ROOT)
    	: 
    ]
    
    $(cat Jamfile_temp)

	[ run $all_source 
   		<lib>\$(TYPE_TRAIT_PATH)type_traits_init 
   		<lib>\$(TEST_LIB_PATH)unit_test_framework 
		:
			--report_level=detailed --build_info=yes --log_level=messages
		: 
		:
			<sysinclude>\$(BOOST_ROOT)
		:
			type_traits_tests
		]

;

}

EOF

rm Jamfile_temp


