include make_config.inc
include make_defs.inc

HDRS	:= $(wildcard FL/*.H)

##### Rules

all:	lib test doc

lib:
	${MAKE} -C src

test: lib
	${MAKE} -C test

clean:
	${MAKE} -C src  clean
	${MAKE} -C test clean
	rm -f fltk-mt.html fltk-mt.3

distclean: clean
	rm -f make_config.inc ${TARBALL}

install:
	@echo Asserting directories in ${INST_DIR}
	@install -d ${INST_DIR}/include/FL ${INST_DIR}/man/man3/ ${INST_DIR}/lib
	@echo Installing headers
	@install ${HDRS} ${INST_DIR}/include/FL
	@echo Installing library
	@install lib/${LIB_NAME} ${INST_DIR}/lib/${LIB_QQ_NAME}
	@( cd ${INST_DIR}/lib; \
	  ln -sf ${LIB_QQ_NAME} ${LIB_Q_NAME}; \
	  ln -sf ${LIB_QQ_NAME} ${LIB_NAME} )
	@echo Installing docs
	@install fltk-mt.3 ${INST_DIR}/man/man3/fltk-mt.3

uninstall:
	@echo Uninstalling headers
	@(cd ${INST_DIR}/include; rm -f ${HDRS})
	@echo Uninstalling library
	@(cd ${INST_DIR}/lib; rm -f ${LIB_NAME} ${LIB_Q_NAME} ${LIB_QQ_NAME} )
	@echo Uninstalling docs
	@rm -f ${INST_DIR}/man/man3/fltk-mt.3

doc:
	pod2html < fltk-mt.pod > fltk-mt.html
	pod2man  -c "FLTK bazaar docs" -s 3 fltk-mt.pod > fltk-mt.3
	@rm -f pod2htm* # Where are these jokers coming from?

dist:
	svn co ${SVN_REPO} ${FULL_PACKAGE}
	find ${FULL_PACKAGE} -type d -name .svn | xargs rm -r
	tar czf ${TARBALL} ${FULL_PACKAGE}
	rm -rf ${FULL_PACKAGE}

.PHONY:	lib test install dist
