#
#  Windfreak Technologies SynthNV Series RF Signal Generator Library
#  Copyright © 2013 D Scott Guthridge <pdx_scooter@yahoo.com>
# 
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published
#  by the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
# 
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  General Public License for more details.
# 
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
DESTDIR=
VERSION=0.0.0
INCLUDEDIR=/usr/local/include
LIBDIR=/usr/local/lib
BINDIR=/usr/local/bin
MANDIR=/usr/local/share/man

CFLAGS=-Wall -O -I../libwfsyn

HDR=	main.h calibrate_detector.h calibrate_output.h command.h
SRC=	main.c calibrate_detector.c calibrate_output.c command.c
OBJ=	main.o calibrate_detector.o calibrate_output.o command.o

TARSRC=	Makefile ${HDR} ${SRC} wfsyn-cal.1

all: wfsyn-cal wfsyn-cal.1

wfsyn-cal: ${OBJ}
	${CC} -o "$@" ${CFLAGS} ${OBJ} -L../libwfsyn -Wl,-rpath=../libwfsyn \
		-lwfsyn -lm

wfsyn-cal.pdf: wfsyn-cal.1
	pdfroff -t -man --no-toc-relocation wfsyn-cal.1 > "$@"

clean:
	rm -f *.o wfsyn-cal wfsyn-cal.pdf

depend: ${HDR} ${SRC}
	makedepend ${HDR} ${SRC}

install: all
	install -d -m 755 ${DESTDIR}${BINDIR}
	install -c -m 555 wfsyn-cal ${DESTDIR}${BINDIR}
	install -d -m 755 ${DESTDIR}${MANDIR}/man1
	install -c -m 444 wfsyn-cal.1 ${DESTDIR}${MANDIR}/man1

tags: ${HDR} ${SRC} ${GENHDR} ${GENSRC}
	ctags ${HDR} ${SRC} ${GENHDR} ${GENSRC}

tarball: ${TARSRC}
	umask 022
	[ -d ../${NAME}-${VERSION} ] || mkdir ../${NAME}-${VERSION}
	rm -rf ../${NAME}-${VERSION}/wfsyn-cal
	mkdir ../${NAME}-${VERSION}/wfsyn-cal
	cp ${TARSRC} ../${NAME}-${VERSION}/wfsyn-cal

