PATH=$(HOME)/local/bin:/bin/:/usr/bin
TESTS = keyword_cast.t  valid.t valid_fcall.t valid_pointer.t func_pointer.t typedef_bool.t struct.t
BAD = keyword_cast_bad.bad check_rv.bad invalid_fcall.bad invalid_pointer.bad func_pointer_bad.bad func_pointer_evil.bad struct_bad.bad
CXX = $(shell which g++-3.4 2> /dev/null || which g++34) 

all: $(TESTS) $(BAD)

%.ii: %.cc
	$(CXX) -E -Wp,-K -Wp,-W0 $< -o $@

%.t: %.ii prcheck
	[[ `./prcheck -pr-debug -o-lang GNU_Cplusplus $<` = "" ]]
	touch $@

%.bad: %.ii prcheck
	[[ ! `./prcheck -pr-debug $<` = "" ]] 
	touch $@

prcheck:
#make -C .. prcheck
	ln -s ../prcheck .

clean:
	rm -f $(TESTS) $(BAD) prcheck *.ii *~
