# 'make install' installs files into:
#       ${INSTALL_DIR}/include/
#       ${INSTALL_DIR}/lib/
#       ${INSTALL_DIR}/man/man3/
#       ${INSTALL_DIR}/doc/argtable/
# Edit INSTALL_DIR to be your chosen install path.
INSTALL_DIR = /usr

help: Makefile.config
	@echo "all        builds all targets"
	@echo "obj        builds all object files and libraries"
	@echo "exe        builds all executables"
	@echo "docs       builds all documentation"
	@echo "runtest    run system tests"
	@echo "clean      removes all executables, libraries, and object files"
	@echo "install    installs files into INSTALL_DIR (${INSTALL_DIR})"
	@echo "uninstall  removes installed files from INSTALL_DIR"
	@echo "dist       builds a tar distribution (for maintainer only)"
	@echo "distclean  clean + removes documentation (for maintainer only)"

all:	obj exe

obj:    Makefile.config
	cd src; make obj
	cd example; make obj

exe:    Makefile.config
	cd src; make exe
	cd example; make exe

docs:   Makefile.config
	cd src; make doc

runtest: Makefile.config
	cd src; make runtest

clean:  Makefile.config
	cd src; make clean
	cd example; make clean
	-rm -f *~

dist: clean docs Makefile.config
	cd ..; 	tar -cvf argtable-1.1.tar --exclude CVS --exclude .cvsignore --exclude Makefile.config argtable

distclean: clean Makefile.config
	cd src; make distclean;
	-rm Makefile.config

install: Makefile.config
	cd src; make install INSTALL_DIR=${INSTALL_DIR}
	@echo "installing to ${INSTALL_DIR}/doc/argtable"
	cp -ir doc/* ${INSTALL_DIR}/doc/argtable
	@echo "installing to ${INSTALL_DIR}/man/man3/"
	cp -i man/man3/arg_* ${INSTALL_DIR}/man/man3

uninstall: Makefile.config
	cd src; make uninstall INSTALL_DIR=${INSTALL_DIR}
	@echo "uninstalling files from ${INSTALL_DIR}/man/man3/"
	-cd ${INSTALL_DIR}/man/man3; rm -f arg_catargs.3 arg_glossary.3 arg_scanstr.3 arg_spec.3 arg_typestr.3 arg_dump.3 arg_scanargv.3  arg_syntax.3 
	@echo "uninstalling ${INSTALL_DIR}/doc/argtable/"
	-rm -rf ${INSTALL_DIR}/doc/argtable

Makefile.config:
	@echo "WARNING: you must run the 'configure' script before calling make."
