~ubuntu-branches/debian/jessie/digitemp/jessie

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Jesus Roncero
  • Date: 2004-09-01 01:34:37 UTC
  • Revision ID: james.westby@ubuntu.com-20040901013437-eicsrrd40dr371u0
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Makefile for DigiTemp
 
3
#
 
4
# Copyright 1996-2004 by Brian C. Lane <bcl@brianlane.com>
 
5
# See COPYING for GNU Public License
 
6
#
 
7
# Please note that this Makefile *needs* GNU make. BSD make won't do.
 
8
#
 
9
# To enable USB you need to add -DOWUSB to CFLAGS for the SYSTYPE you are
 
10
# compiling on. Only tested on Linux
 
11
#
 
12
# To disable Lockfile support on Linux, remove the -DLOCKDEV and the
 
13
# -llockdev in the Linux SYSTYPE section
 
14
#
 
15
 
 
16
VERSION = 3.3.2
 
17
 
 
18
 
 
19
CC      = gcc
 
20
CFLAGS  = -I./src -I./userial -O2 # -g -Wall
 
21
LIBS    = -lm
 
22
 
 
23
OBJS            =       src/digitemp.o src/device_name.o
 
24
HDRS            =       src/digitemp.h src/device_name.h
 
25
 
 
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
 
31
 
 
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 \
 
35
                        src/ds9097.o
 
36
 
 
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 \
 
41
                        src/ds9097u.o
 
42
 
 
43
# DS2490 adapter support
 
44
DS2490OBJS      =       userial/ds2490/ownet.o userial/ds2490/owtran.o \
 
45
                        userial/ds2490/usblnk.o userial/ds2490/usbses.o \
 
46
                        src/ds2490.o
 
47
 
 
48
# -----------------------------------------------------------------------
 
49
# Sort out what operating system is being run and modify CFLAGS and LIBS
 
50
#
 
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)
 
55
 
 
56
ifeq ($(SYSTYPE), Linux)
 
57
  CFLAGS += -DLINUX
 
58
 
 
59
  # Set LOCK to yes for serial port locking support
 
60
  LOCK = yes
 
61
 
 
62
endif
 
63
 
 
64
ifeq ($(SYSTYPE), SunOS)
 
65
  CFLAGS += -DSOLARIS
 
66
  LIBS   += -lposix4
 
67
endif
 
68
 
 
69
ifeq ($(SYSTYPE), FreeBSD)
 
70
  CFLAGS += -DFREEBSD
 
71
endif
 
72
 
 
73
ifeq ($(SYSTYPE), OpenBSD)
 
74
  CFLAGS += -DOPENBSD
 
75
endif
 
76
 
 
77
# Untested, but should work.
 
78
ifeq ($(SYSTYPE), NetBSD)
 
79
  CFLAGS += -DNETBSD
 
80
endif
 
81
 
 
82
ifeq ($(SYSTYPE), Darwin)
 
83
  CFLAGS += -DDARWIN
 
84
endif
 
85
 
 
86
ifeq ($(SYSTYPE), AIX)
 
87
  CFLAGS += -DAIX
 
88
endif
 
89
 
 
90
ifeq ($(LOCK), yes)
 
91
  CFLAGS += -DLOCKDEV
 
92
  LIBS   += -llockdev
 
93
endif
 
94
 
 
95
 
 
96
# USB specific flags
 
97
ds2490:  CFLAGS += -DOWUSB
 
98
ds2490:  LIBS   += -lusb
 
99
 
 
100
 
 
101
help:
 
102
        @echo "  SYSTYPE = $(SYSTYPE)"
 
103
        @echo "  CFLAGS = $(CFLAGS)"
 
104
        @echo "  LIBS   = $(LIBS)"
 
105
        @echo ""
 
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)"
 
110
        @echo " "
 
111
        @echo ""
 
112
        @echo "Please note: You must use GNU make to compile digitemp"
 
113
        @echo ""
 
114
 
 
115
all:            help
 
116
 
 
117
 
 
118
# Build the Linux executable
 
119
ds9097:         $(OBJS) $(HDRS) $(ONEWIREOBJS) $(ONEWIREHDRS) $(DS9097OBJS)
 
120
                $(CC) $(OBJS) $(ONEWIREOBJS) $(DS9097OBJS) -o digitemp_DS9097 $(LIBS)
 
121
 
 
122
ds9097u:        $(OBJS) $(HDRS) $(ONEWIREOBJS) $(ONEWIREHDRS) $(DS9097UOBJS)
 
123
                $(CC) $(OBJS) $(ONEWIREOBJS) $(DS9097UOBJS) -o digitemp_DS9097U $(LIBS)
 
124
 
 
125
ds2490:         $(OBJS) $(HDRS) $(ONEWIREOBJS) $(ONEWIREHDRS) $(DS2490OBJS)
 
126
                $(CC) $(OBJS) $(ONEWIREOBJS) $(DS2490OBJS) -o digitemp_DS2490 $(LIBS)
 
127
 
 
128
 
 
129
# Clean up the object files and the sub-directory for distributions
 
130
clean:
 
131
                rm -f *~ src/*~ userial/*~ userial/ds9097/*~ userial/ds9097u/*~ userial/ds2490/*~
 
132
                rm -f $(OBJS) $(ONEWIREOBJS) $(DS9097OBJS) $(DS9097UOBJS) $(DS2490OBJS)
 
133
                rm -f core *.asc 
 
134
                rm -f perl/*~ rrdb/*~ .digitemprc digitemp-$(VERSION)-1.spec
 
135
                rm -rf digitemp-$(VERSION)
 
136
 
 
137
# Sign the binaries using gpg (www.gnupg.org)
 
138
# My key is available from www.brianlane.com
 
139
sign:
 
140
                gpg -ba digitemp_DS*
 
141
                echo
 
142
 
 
143
# Install digitemp into /usr/local/bin
 
144
install:        digitemp
 
145
                install -b -o root -g bin digitemp /usr/local/bin
 
146
 
 
147
# Build the archive of everything
 
148
archive:        clean
 
149
                cd .. && tar cvzf digitemp-$(VERSION).tar.gz digitemp-$(VERSION)/* --exclude *.o
 
150
 
 
151
# Build the source distribution
 
152
source:         archive
 
153
 
 
154
dist_ds9097:    ds9097 sign archive
 
155
                cd .. && mv digitemp-$(VERSION).tar.gz digitemp-$(VERSION)-ds9097.tar.gz
 
156
 
 
157
dist_ds9097u:   ds9097u sign archive
 
158
                cd .. && mv digitemp-$(VERSION).tar.gz digitemp-$(VERSION)-ds9097u.tar.gz
 
159
 
 
160
dist_ds2490:    ds2490 sign archive
 
161
                cd .. && mv digitemp-$(VERSION).tar.gz digitemp-$(VERSION)-ds2490.tar.gz
 
162
 
 
163
# Build RedHat binary and source RPMs
 
164
rpm_ds9097:     source
 
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"
 
169
 
 
170
rpm_ds9097u:    source
 
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"
 
175
 
 
176
rpm_ds2490:     source
 
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"
 
181