#
# Makefile for DigiTemp v1.3
#
# Copyright (c) 1996-2000 by Brian C. Lane
# All Rights Reserved
# See COPYING for GNU Public License information
#
# Linux/Solaris makefile
#

VERSION = 1.3

CC	= gcc
CFLAGS	= -I. -O2 -Wall # -g
LIBS	= -lm
OBJS	= digitemp.o ds1820.o onewire.o
HDRS	= ds1820.h onewire.h

# !!!!!!!
# To enable Solaris support uncomment the following line
# !!!!!!!
#CFLAGS	+= -DSOLARIS


all:
	@echo
	@echo "Type 'make digitemp' to build a linux binary"
	@echo "To build the Solaris version, edit the Makefile and type 'make digitemp'"
	@echo

# Build the Linux executable
digitemp:	$(OBJS) $(HDRS)
		$(CC) $(OBJS) -o digitemp $(LIBS)

# Clean up the object files and the sub-directory for distributions
clean:
		rm -f *~ $(OBJS) core *.asc
		rm -rf digitemp-$(VERSION)


# Sign the binaries using gpg
sign:
		gpg -ba digitemp


install:	digitemp
		cp -f digitemp /usr/local/bin/digitemp

# Build the archive of everything (same as source?)
archive:	digitemp clean sign
		mkdir digitemp-$(VERSION)
		cp -f `find -type f ! -name \*zip ! -name \*gz` digitemp-$(VERSION)/
		tar cvzf digitemp-$(VERSION).src.tar.gz digitemp-$(VERSION)/*

# Build the source distribution
source:		archive
dist:		archive