#makefile for fltk program
CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe -fno-exceptions -fno-rtti"
PROG=dirwin
PROG_CAPS=DirWin
DESC="File Manager"
TCEDIR=`cat /opt/.tce_dir`
BASEDIR=`pwd`


all:  ${PROG}.cxx
	gcc ${CXXFLAGS} `fltk-config --cxxflags` -c ${PROG}.cxx
	gcc ${CXXFLAGS} `fltk-config --cxxflags` -c ${PROG}_core.cxx
	gcc `fltk-config --ldflags` -lfltk_images ${PROG}.o ${PROG}_core.o -o ${PROG}
	strip ${PROG}
	sudo cp ${PROG} /home/tc/bin
	sudo cp ${PROG}_help.htm /usr/local/share/doc/dirwin/
	sudo cp ${PROG}.png /usr/local/share/doc/dirwin/
	ls -l ${PROG}
#	sudo cp ${PROG}_help.htm /usr/share/doc/tc/

debug:  ${PROG}.cxx
	gcc ${CXXFLAGS} `fltk-config --cxxflags` -c -g ${PROG}.cxx
	gcc ${CXXFLAGS} `fltk-config --cxxflags` -c -g ${PROG}_core.cxx
	gcc `fltk-config --ldflags` -lfltk_images ${PROG}.o ${PROG}_core.o -o ${PROG}
	sudo cp ${PROG} /home/tc/bin

${PROG}.cxx: ${PROG}.fi
	fluid -c ${PROG}.fi

#.SUFFIXES: .fl .cxx .h
#.fl.h .fl.cxx:
#	fluid -c $<

clean:
	rm *.o ${PROG}

install: ${PROG}
	sudo cp ${PROG} /usr/local/bin
	sudo cp ${PROG}_help.htm /usr/local/share/doc/dirwin/
	sudo cp ${PROG}.png /usr/local/share/pixmaps/

run:
	dirwin &
	
package:
	./build-tcz.sh ${PROG} ${PROG_CAPS} ${BASEDIR} ${DESC}

deploy: package
	echo "TCE DIR is ${TCEDIR}"
	cp ${BASEDIR}/${PROG}.tcz ${TCEDIR}/optional
	
tarball:
	tar -czf ${PROG}_src.tar.gz ${PROG}_core.cxx ${PROG}_core.h ${PROG}.fi ${PROG}.png ${PROG}_help.htm build-tcz.sh Makefile ${PROG}.tcz.info
	
unpack:
	tar -xzf ${PROG}_src.tar.gz
