2
# Makefile for DigiTemp
4
# Copyright 1996-2004 by Brian C. Lane <bcl@brianlane.com>
5
# See COPYING for GNU Public License
7
# Please note that this Makefile *needs* GNU make. BSD make won't do.
9
# To enable USB you need to add -DOWUSB to CFLAGS for the SYSTYPE you are
10
# compiling on. Only tested on Linux
12
# To disable Lockfile support on Linux, remove the -DLOCKDEV and the
13
# -llockdev in the Linux SYSTYPE section
20
CFLAGS = -I./src -I./userial -O2 # -g -Wall
23
OBJS = src/digitemp.o src/device_name.o
24
HDRS = src/digitemp.h src/device_name.h
26
# Common userial header/source
27
HDRS += userial/ownet.h userial/owproto.h userial/ad26.h \
28
src/device_name.h src/digitemp.h
29
OBJS += userial/crcutil.o userial/ioutil.o userial/swt1f.o \
30
userial/owerr.o userial/cnt1d.o userial/ad26.o
32
# DS9097 passive adapter support source
33
DS9097OBJS = userial/ds9097/ownet.o userial/ds9097/linuxlnk.o \
34
userial/ds9097/linuxses.o userial/ds9097/owtran.o \
37
# DS9097-U adapter support source
38
DS9097UOBJS = userial/ds9097u/ds2480ut.o userial/ds9097u/ownetu.o \
39
userial/ds9097u/owllu.o userial/ds9097u/owsesu.o \
40
userial/ds9097u/owtrnu.o userial/ds9097u/linuxlnk.o \
43
# DS2490 adapter support
44
DS2490OBJS = userial/ds2490/ownet.o userial/ds2490/owtran.o \
45
userial/ds2490/usblnk.o userial/ds2490/usbses.o \
48
# -----------------------------------------------------------------------
49
# Sort out what operating system is being run and modify CFLAGS and LIBS
51
# If you add a new OSTYPE here please email it to me so that I can add
52
# it to the distribution in the next release
53
# -----------------------------------------------------------------------
54
SYSTYPE := $(shell uname -s)
56
ifeq ($(SYSTYPE), Linux)
59
# Set LOCK to yes for serial port locking support
64
ifeq ($(SYSTYPE), SunOS)
69
ifeq ($(SYSTYPE), FreeBSD)
73
ifeq ($(SYSTYPE), OpenBSD)
77
# Untested, but should work.
78
ifeq ($(SYSTYPE), NetBSD)
82
ifeq ($(SYSTYPE), Darwin)
86
ifeq ($(SYSTYPE), AIX)
97
ds2490: CFLAGS += -DOWUSB
102
@echo " SYSTYPE = $(SYSTYPE)"
103
@echo " CFLAGS = $(CFLAGS)"
104
@echo " LIBS = $(LIBS)"
106
@echo "Pick one of the following targets:"
107
@echo -e "\tmake ds9097\t- Build version for DS9097 (passive)"
108
@echo -e "\tmake ds9097u\t- Build version for DS9097U"
109
@echo -e "\tmake ds2490\t- Build version for DS2490 (USB) (edit Makefile) (BROKEN)"
112
@echo "Please note: You must use GNU make to compile digitemp"
118
# Build the Linux executable
119
ds9097: $(OBJS) $(HDRS) $(ONEWIREOBJS) $(ONEWIREHDRS) $(DS9097OBJS)
120
$(CC) $(OBJS) $(ONEWIREOBJS) $(DS9097OBJS) -o digitemp_DS9097 $(LIBS)
122
ds9097u: $(OBJS) $(HDRS) $(ONEWIREOBJS) $(ONEWIREHDRS) $(DS9097UOBJS)
123
$(CC) $(OBJS) $(ONEWIREOBJS) $(DS9097UOBJS) -o digitemp_DS9097U $(LIBS)
125
ds2490: $(OBJS) $(HDRS) $(ONEWIREOBJS) $(ONEWIREHDRS) $(DS2490OBJS)
126
$(CC) $(OBJS) $(ONEWIREOBJS) $(DS2490OBJS) -o digitemp_DS2490 $(LIBS)
129
# Clean up the object files and the sub-directory for distributions
131
rm -f *~ src/*~ userial/*~ userial/ds9097/*~ userial/ds9097u/*~ userial/ds2490/*~
132
rm -f $(OBJS) $(ONEWIREOBJS) $(DS9097OBJS) $(DS9097UOBJS) $(DS2490OBJS)
134
rm -f perl/*~ rrdb/*~ .digitemprc digitemp-$(VERSION)-1.spec
135
rm -rf digitemp-$(VERSION)
137
# Sign the binaries using gpg (www.gnupg.org)
138
# My key is available from www.brianlane.com
143
# Install digitemp into /usr/local/bin
145
install -b -o root -g bin digitemp /usr/local/bin
147
# Build the archive of everything
149
cd .. && tar cvzf digitemp-$(VERSION).tar.gz digitemp-$(VERSION)/* --exclude *.o
151
# Build the source distribution
154
dist_ds9097: ds9097 sign archive
155
cd .. && mv digitemp-$(VERSION).tar.gz digitemp-$(VERSION)-ds9097.tar.gz
157
dist_ds9097u: ds9097u sign archive
158
cd .. && mv digitemp-$(VERSION).tar.gz digitemp-$(VERSION)-ds9097u.tar.gz
160
dist_ds2490: ds2490 sign archive
161
cd .. && mv digitemp-$(VERSION).tar.gz digitemp-$(VERSION)-ds2490.tar.gz
163
# Build RedHat binary and source RPMs
165
su -c "cp ../digitemp-$(VERSION).tar.gz /usr/src/redhat/SOURCES"
166
rm -f digitemp-$(VERSION)-1.spec
167
ln -s digitemp_9097.spec digitemp-$(VERSION)-1.spec
168
su -c "rpmbuild -ba -vv digitemp-$(VERSION)-1.spec"
171
su -c "cp ../digitemp-$(VERSION).tar.gz /usr/src/redhat/SOURCES"
172
rm -f digitemp-$(VERSION)-1.spec
173
ln -s digitemp_9097u.spec digitemp-$(VERSION)-1.spec
174
su -c "rpmbuild -ba -vv digitemp-$(VERSION)-1.spec"
177
su -c "cp ../digitemp-$(VERSION).tar.gz /usr/src/redhat/SOURCES"
178
rm -f digitemp-$(VERSION)-1.spec
179
ln -s digitemp_2490.spec digitemp-$(VERSION)-1.spec
180
su -c "rpmbuild -ba -vv digitemp-$(VERSION)-1.spec"