#
# * Copyright (c) 2011 QUALCOMM Incorporated.  All rights reserved.
# * The file License.txt specifies the terms for use, modification,
# * and redistribution.
# *
# * File        : Makefile.in
# * Project     : Qpopper Server
# * Comments    : 
# *
# *
# * Revisions   :
# * 07/14/09    [rcg]
# *       - Delete "@" from continuation lines.
# *       - Use mkdir-sh instead of 'mkdir'.
# * 06/21/08    [rcg]
# *       - Add 'tags' target for ctags call (note: assumes 'ctags' is
# *         installed in /usr/local/bin, so it isn't portable)
# *  05/07/08   [rg]
# *         - Replace "-d" flag with 'mkdir'
# *  05/28/07   [rg]
# *         - Added '-d' flag to 'install' (to create directories)
# *  03/19/07   [rg]
# *         - Added .* to 'realclean'
# *  12/05/05   [rg]
# *         - Added 'autom4te.cache' to 'realclean'
# *  11/26/00   [rg]
# *         - Added 'install' rule, based on patch by Nick Burrett.
# *  05/20/99   [rg]
# *         - Add more items to 'realclean'
# *  09/30/98   [rg]
# *         - Cleanup for v3.0
# *  05/05/98   [py]
# *         - File added.
# *
#
SHELL           =       /bin/sh
CC              =       @CC@
GPERF           =       @GPERF@
MAKEFILE        =       Makefile
YACC            =       @YACC@
LEX             =       @LEX@
INSTALL         =       @INSTALL@

@SET_MAKE@

top_srcdir      =       @top_srcdir@
srcdir          =       @srcdir@
builddir        =       ${top_srcdir}/build
VPATH           =       @srcdir@
prefix          =       @prefix@
exec_prefix     =       @exec_prefix@
installdir      =       @sbindir@
mandir          =       @mandir@


popper_srcdir   =       ${top_srcdir}/popper
mmangle_srcdir  =       ${top_srcdir}/mmangle
common_srcdir   =       ${top_srcdir}/common
password_srcdir =       ${top_srcdir}/password

base_dir        =       .
popper_dir      =       ${base_dir}/popper
mmangle_dir     =       ${base_dir}/mmangle
common_dir      =       ${base_dir}/common
password_dir    =       ${base_dir}/password



all: popper_server 

popper_server: 
	cd ${popper_dir}  && ${MAKE} all

install:
	@if [ ! -d ${prefix} ]; then \
		${base_dir}/mkdir-sh "${prefix}" "0755" "root" ; \
		fi

	@if [ ! -d ${mandir} ]; then \
		${base_dir}/mkdir-sh "${mandir}" "0755" "root" ; \
	fi

	@if [ ! -d ${mandir}/man8 ]; then \
		mkdir -m 0755 ${mandir}/man8; \
		chown root ${mandir}/man8; \
	fi

	@${INSTALL} -m 0644 -o root ${top_srcdir}/man/popper.8  ${mandir}/man8/
	@echo "Installed man/popper.8 as ${mandir}/man8/popper.8"

	@${INSTALL} -m 0644 -o root ${top_srcdir}/man/popauth.8 ${mandir}/man8/
	@echo "Installed man/popauth.8 as ${mandir}/man8/popauth.8"

	cd ${popper_dir} && ${MAKE} install

clean:
	cd ${popper_dir}  && ${MAKE} $@

realclean: 
	rm -f ${base_dir}/config.status ${base_dir}/config.h
	rm -f ${base_dir}/config.cache ${base_dir}/config.log
	rm -f *~ doc/*~
	rm -f Makefile
	rm -f core
	rm -f .[a-zA-Z]*
	rm -fr autom4te.cache
	rm -f tags TAGS
	cd ${popper_dir}  && ${MAKE} $@

tags:
# make tags file per BBEdit recommendation
	/usr/local/bin/ctags --excmd=number --tag-relative=no \
	                     --fields=+a+m+n+S -R `pwd`
	cd ${popper_dir}  && ${MAKE} $@
