OUTPARAMDEL = ../outparamdel
OPDFLAGS =
MCPP = $(shell which g++-3.4 2> /dev/null || which g++34) 

all: outparams.o queryinterface.o
	rm $(subst .o,.cc,$+)

%.o: %.ii %.diff
	patch -p0 < $(subst .ii,.diff,$<)
	rm $<
	$(MAKE) $<
	$(CXX) -c $<

%.cc: %.cpp $(OUTPARAMDEL)
	$(CXX) -c $< -o $@
	rm -f $(subst .cpp,.ii,$<)
	rm $@
	cp $< $@

%.ii: %.cc
	$(CXX) -E $< -o $@

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

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

%.diff: %.ii $(OUTPARAMDEL)
	$(OUTPARAMDEL) $(OPDFLAGS) -od-list $(subst .ii,.txt,$<) $(PWD)/$< > $@

%.cc: %.ii
	cp $< $@

clean:
	rm -f *.o *.cc *.ii .diff

#get rid of default make rules
.SUFFIXES:
