#  You may get better performance with these 2.0.1 flags
#  OPTFLAGS = -xcg89 -Wa,-cg92 
CFLAGS = $(OPTFLAGS) -I$(XILHOME)/include -I$(OPENWINHOME)/include

LIBS = -L$(XILHOME)/lib -L$(OPENWINHOME)/lib -R/opt/SUNWits/Graphics-sw/xil/lib:/usr/openwin/lib

install := LIBS += -lxil -lX11 -ldl -ldga -lthread 
debug_install := LIBS += -lxil -lX11 -ldl -ldga -lthread 
debug_install := CFLAGS += -g

install: example1 brainscan.header brainscan.data
debug_install: example1 brainscan.header brainscan.data

debug: debug_install

example1: example1.o window.o fileio.o
	$(CC) -o example1 example1.o window.o fileio.o $(LIBS) 

clean:
	rm -f a.out core *.o example1

# Won't work unless building within the project domains 
brainscan.data:
	@if [  "$(EX_DATA_DIR)" ]; then \
		echo "Linking $@..." ; \
		ln -s $(EX_DATA_DIR)/images/$@ . ; \
	else \
		if [ -f $(XIL_DATA_DIR)/images/$@ ]; then \
			echo "Copying $@..." ; \
			cp -p $(XIL_DATA_DIR)/images/$@ . ; \
		else \
			echo "Cannot install $@" ; \
		fi ; \
	fi
