File: Makefile

package info (click to toggle)
upsd 2.6-5
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 228 kB
  • ctags: 112
  • sloc: ansic: 1,040; sh: 333; makefile: 106
file content (109 lines) | stat: -rw-r--r-- 2,499 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#-------------------------------------------------------------------
#
#  Makefile for "upsd"
#
#  make all     = Make upsd
#  make install = Make all, then copy to install dirs
#
#  $Id: Makefile,v 2.3 2000/06/08 15:33:00 mikr Exp mikr $
#-------------------------------------------------------------------

#BINDIR=/usr/local/bin
BINDIR=$(DESTDIR)/sbin
CFGDIR=$(DESTDIR)/etc
MANDIR=$(DESTDIR)/usr/share/man/man8

CC=gcc
LD=gcc
#CFLAGS=-g -Wall -DDEBUG
CFLAGS=-Wall -O2
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) 
CFLAGS+=-g -DDEBUG
endif


# WARNING, socks only!
#  use an IP address rather than a 
# host name in libsocks5.conf to avoid
# permanent lockup on initialization due
# to the way the socks library handles
# failed proxy hostname resolution.
#
# define SOCKS5 to support socks5 firewall
# comment out to remove socks5 support
#SOCKS5=yes

ifdef SOCKS5
  CFLAGS+=-include /usr/local/include/socks.h -DSOCKS
  LDFLAGS=-lsocks5
else
# for socks5 -- does not work
# CFLAGS=-Wall -O2
  LDFLAGS=
endif

#  Change this to reflect where your init requires the power status 
#  file to be.  Some Linux systems want it in /var/run/powerstatus.

CFGFILE=-DCFGFILE="\"/etc/upsd.conf\""
PWRSTAT=-DPWRSTAT="\"/etc/powerstatus\""
UPSSTAT=-DUPSSTAT="\"/etc/upstatus\""

#  No user-serviceable parts below here
#-------------------------------------------------------------------
DISTLVL=2.6
REVLEVL=
DISTVER=upsd-$(DISTLVL)$(REVLEVL)
VER=-DVERSION="\"v$(DISTLVL)$(REVLEVL)\""

OBJS=common.o net.o upsd.o ups.o mapping.o
DIST=$(DISTVER)/README $(DISTVER)/COPYING $(DISTVER)/Makefile \
     $(DISTVER)/upsd.halt $(DISTVER)/upsd.init \
     $(DISTVER)/*.8 $(DISTVER)/*.c $(DISTVER)/*.h \
     $(DISTVER)/rc.upsd $(DISTVER)/upsdummy $(DISTVER)/Changes.txt \
     $(DISTVER)/upsd.conf \
     $(DISTVER)/*.lsm

all: makeall

ifeq (.depend,$(wildcard .depend))
include .depend
makeall: upsd
else
makeall: depend upsd
endif
	strip upsd

depend dep: 
	$(CC) -M *.c $(CFLAGS) > .depend;

clean:
	rm -f $(OBJS)
	rm -f .depend

realclean: clean
	rm -f upsd

dist: 
	cd ..; tar cfz $(DISTVER).tgz $(DIST)

install: install-upsd install-man

install-upsd: makeall
	cp upsd $(BINDIR)
	chmod 755 $(BINDIR)/upsd
	cp upsd.conf $(CFGDIR)
	chmod 644 upsd.conf

install-man:
	cp upsd.8 $(MANDIR)
	chmod 644 $(MANDIR)/upsd.8
	cp rc.upsd.8 $(MANDIR)
	chmod 644 $(MANDIR)/rc.upsd.8

upsd : $(OBJS)
	$(LD) $(OBJS) $(LDFLAGS) -o $@

.c.o:
	$(CC) $(DEBUG) $(CFLAGS) $(PWRSTAT) \
	$(CFGFILE) $(UPSSTAT) $(VER) -c $< -o $@