File: Makefile.in

package info (click to toggle)
apcupsd 3.8.5-1.1.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 7,012 kB
  • ctags: 2,783
  • sloc: ansic: 26,374; sh: 3,012; makefile: 1,860; cpp: 1,713; perl: 191; sed: 93
file content (432 lines) | stat: -rw-r--r-- 13,195 bytes parent folder | download
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# Makefile template for apcupsd
#
# Copyright (C) 1999-2000 Riccardo Facchetti <riccardo@master.oasi.gpa.it>
#

PACKAGE = apcupsd

SUBDIRS = @INTLSUB@ @POSUB@  
DISTNAME=@DISTNAME@
DISTVER=@DISTVER@
MV = mv
ECHO = echo
RMF = rm -f
SED = sed

# Common prefix for machine-independent installed files.
prefix = @prefix@
# Common prefix for machine-dependent installed files.
exec_prefix = @exec_prefix@

# srcdir really should be a subdirectory
srcdir = @srcdir@
topdir = @srcdir@
sysconfdir = @sysconfdir@
VPATH = @srcdir@

thisdir = .

#
# this is a list of all subdirectories that contain or could contain Makefiles
#
subdirs = . @INTLSUB@ @POSUB@ cgi doc lib contrib distributions \
   distributions/debian distributions/engarde \
   distributions/freebsd distributions/hpux distributions/openbsd \
   distributions/redhat \
   distributions/slackware distributions/sun distributions/suse \
   distributions/unifix distributions/netbsd distributions/caldera win32

CC = @CC@

# For some losing Unix makes.
SHELL = /bin/sh
MAKE = make

CFLAGS = @CFLAGS@   @PTHREAD_CFLAGS@
LDFLAGS = @LDFLAGS@ @PTHREAD_LFLAGS@

# How to invoke ranlib.  This is only used by the `glob' subdirectory.
RANLIB = @RANLIB@

DEFS = @DEFS@ @EXTRADEFS@
defines = $(DEFS)

# If your system needs extra libraries loaded in, define them here.
# In particular, add -lresolv if you are running bind 4.9.5
LOADLIBS = @LIBS@ @INTLLIBS@ @WRAPLIBS@

# Directory in which to install.
sbindir = @sbindir@
# Directory to install the Info files in.
infodir = @infodir@
# Number to put on the man page filename.
manext = 8
# Directory to install the man page in.
mandir = @mandir@/man$(manext)

# Program to install `make'.
INSTALL_PROGRAM = @INSTALL_PROGRAM@
# Program to install the man page.
INSTALL_DATA = @INSTALL_DATA@
# Generic install program.
INSTALL = @INSTALL@

# Program to format Texinfo source into Info files.
MAKEINFO = makeinfo
# Program to format Texinfo source into DVI files.
TEXI2DVI = texi2dvi

# Programs to make tags files.
ETAGS = etags
CTAGS = ctags

apclib = lib/libapc.a

# extra items for linking on Win32
win32=win32/winmain.o win32/winlib.a win32/winres.res -luser32 -lgdi32

WLIBS = $(@WIN32@)

dobjs =  apcnet.o apcsetup.o apcreports.o apcsmart.o \
	 apcserial.o apcaction.o apcoptd.o apcnis.o


aobjs = apcaccess.o 
fobjs = powerflute.o
ndobjs = apcnisd.o 

srcs = $(srcdir)/apcupsd.c $(srcdir)/apcnet.c  \
       $(srcdir)/apcsetup.c $(srcdir)/apcreports.c $(srcdir)/apcsmart.c \
       $(srcdir)/apcaccess.c $(srcdir)/apcserial.c  \
       $(srcdir)/apcaction.c \
       $(srcdir)/powerflute.c	 \
       $(srcdir)/apcoptd.c $(srcdir)/apcnisd.c \
       $(srcdir)/apcnis.c \
       $(srcdir)/apctest.c

.SUFFIXES:
.SUFFIXES: .o .c .h .y .l .ps .dvi .info .texi

all: Makefile @INTLTARGET@ @WIN32@ apcupsd @UTILPROGS@ @POWERFLUTE@ po cgi apctest@WIN32@

# win32 specific stuff
win32:	dummy
	(cd win32; $(MAKE))

# Some makes apparently use .PHONY as the default goal if it is before `all'.
.PHONY: all

$(apclib): dummy
	(cd lib; $(MAKE))

apcupsd: apcupsd.o $(dobjs) $(apclib) @INTLLIBS@ @WIN32@ 
	$(CC) -Llib $(LDFLAGS) apcupsd.o $(dobjs) $(LOADLIBS) \
		$(WLIBS) -o apcupsd -lapc

apcaccess: $(aobjs) $(apclib) @INTLLIBS@
	$(CC) $(LDFLAGS) $(aobjs) $(apclib) $(LOADLIBS) \
		-o apcaccess

apcnisd: $(ndobjs) $(apclib) @INTLLIBS@
	$(CC) -Llib $(LDFLAGS) $(ndobjs) $(LOADLIBS) \
		-o apcnisd -lapc

apctest: apctest.o $(dobjs) $(apclib) @INTLLIBS@ @WIN32@ @WINLIBS@
	$(CC) -Llib $(LDFLAGS) apctest.o $(dobjs) $(LOADLIBS) \
		@WINLIBS@ -o apctest -lapc

# Link this as a standard TTY app, not a Windows app.
apctestwin32: apctest.o $(dobjs) $(apclib) @INTLLIBS@ @WIN32@ @WINLIBS@
	$(CC) -Llib apctest.o $(dobjs) $(LOADLIBS) \
		@WINLIBS@ -o apctest -lapc


powerflute: $(fobjs) $(apclib) @INTLLIBS@
	$(CC) -Llib $(LDFLAGS) $(fobjs) $(LOADLIBS) \
		@POWERLIBS@ -o powerflute -lapc

cgi:	dummy
	@CGIMAKE@

@INTLTARGET@: dummy
	@INTLMAKE@

po:	dummy
	@POMAKE@

Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
	cd $(topdir) \
	  && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

Makefiles:
	$(SHELL) config.status

configure: autoconf/configure.in autoconf/aclocal.m4 autoconf/acconfig.h autoconf/config.h.in
	cd $(srcdir);
	rm -f config.cache config.log config.status config.h
	autoconf --localdir=$(srcdir)/autoconf \
	autoconf/configure.in > configure
	chmod 755 configure

config.status:
	if test -x config.status; then config.status --recheck; \
	else $(SHELL) configure; fi

autoconf/config.h.in: autoconf/configure.in autoconf/acconfig.h
	cd $(srcdir);
	autoheader --localdir=$(srcdir)/autoconf \
	autoconf/configure.in > autoconf/config.h.in
	chmod 644 autoconf/config.h.in



dummy:

.c.o:
	$(CC) $(defines) -c -I$(srcdir) -I$(srcdir)/include @INTLINCLUDE@ $(CFLAGS) $<

tagsrcs = $(srcs)
TAGS: $(tagsrcs)
	$(ETAGS) $(tagsrcs)
tags: $(tagsrcs)
	$(CTAGS) $(tagsrcs)

.PHONY: install uninstall install- install-apcupsd install-powerflute install-cgi

install-:
	$(MAKE) dummy

install: install-apcupsd@WIN32@ install-@POWERFLUTE@ install-cgi @INSTALL_DISTDIR@ 

install-powerflute: powerflute
	@echo "Installing powerflute binary..."
	$(INSTALL_PROGRAM) ./powerflute $(sbindir)/powerflute

install-apcupsd: apcupsd apctest@WIN32@
	@echo "Creating installation directories..." 
# if we create sysconfdir, make it writable only by root
	if [ ! -d $(sysconfdir) ] ; then \
		$(SHELL) ${srcdir}/scripts/mkinstalldirs $(sysconfdir); \
		chmod 755 $(sysconfdir); \
	fi;
	$(SHELL) ${srcdir}/scripts/mkinstalldirs $(sbindir) $(mandir)
	@echo "Installing apcupsd binary..."
	@strip $(srcdir)/apcupsd $(srcdir)/apcaccess
	@strip $(srcdir)/apcnisd $(srcdir)/apctest
	$(INSTALL_PROGRAM) $(srcdir)/apcupsd $(sbindir)/apcupsd
	@echo "Installing apcnisd binary..."
	$(INSTALL_PROGRAM) $(srcdir)/apcnisd $(sbindir)/apcnisd
	@echo "Installing apcaccess binary..."
	$(INSTALL_PROGRAM) $(srcdir)/apcaccess $(sbindir)/apcaccess
	@echo "Installing apctest binary..."
	$(INSTALL_PROGRAM) $(srcdir)/apctest $(sbindir)/apctest
	@echo "Installing apccontrol script..."
	$(INSTALL_PROGRAM) -m 744 $(srcdir)/distributions/$(DISTNAME)/apccontrol.sh $(sysconfdir)/apccontrol
	@echo "Installing manual pages..."
	$(INSTALL_DATA) $(srcdir)/doc/apcupsd.man $(mandir)/apcupsd.$(manext)
	@echo "Installing language catalogs..."
	@POMAKE@ install
# don't overwrite any existing config file
	echo "Installing apcupsd.conf..."; \
	if [ -f $(srcdir)/distributions/$(DISTNAME)/apcupsd.conf ]; then \
		srcconf=$(srcdir)/distributions/$(DISTNAME)/apcupsd.conf; \
	else \
		srcconf=etc/apcupsd.conf; \
	fi; \
	if test -f $(sysconfdir)/apcupsd.conf; then \
		dstconf=apcupsd.conf.new; \
		echo "	found old apcupsd.conf, installing new conf file as $$dstconf"; \
	else \
		dstconf=apcupsd.conf; \
	fi; \
	echo "$(INSTALL_DATA) $$srcconf $(sysconfdir)/$$dstconf"; \
	$(INSTALL_PROGRAM) -m 644 $$srcconf $(sysconfdir)/$$dstconf
	$(INSTALL_PROGRAM) -m 744 $(srcdir)/etc/changeme $(sysconfdir)
	$(INSTALL_PROGRAM) -m 744 $(srcdir)/etc/commfailure $(sysconfdir)
	$(INSTALL_PROGRAM) -m 744 $(srcdir)/etc/commok $(sysconfdir)
	$(INSTALL_PROGRAM) -m 744 $(srcdir)/etc/onbattery $(sysconfdir)
	$(INSTALL_PROGRAM) -m 744 $(srcdir)/etc/mainsback $(sysconfdir)


install-apcupsdwin32: apcupsd
	(cd $(srcdir)/win32; \
	    $(MAKE) install)
	 

install-distdir:
	@if test @WIN32@x != win32x; then \
	   (cd $(srcdir)/distributions/$(DISTNAME); \
		$(MAKE) "DISTVER=$(DISTVER)" install); \
	fi

install-cgi:
	@CGIMAKE@ install

uninstall: uninstall-files uninstall-@DISTNAME@

uninstall-files:
	rm -f $(sbindir)/apcupsd $(sbindir)/apcnisd $(sbindir)/apcnetd
	rm -f $(sbindir)/apcaccess $(sbindir)/powerflute
	rm -f $(mandir)/apcupsd.$(manext)
	rm -f $(sysconfdir)/apccontrol
	rm -f $(sysconfdir)/changeme
	rm -f $(sysconfdir)/commfailure
	rm -f $(sysconfdir)/commok
	rm -f $(sysconfdir)/onbattery
	rm -f $(sysconfdir)/mainsback
	rm -f $(sysconfdir)/apcupsd.conf
	rm -f $(sysconfdir)/apcupsd.conf.new
	@CGIMAKE@ uninstall
	@POMAKE@ uninstall

uninstall-@DISTNAME@:
	@if test @WIN32@x != win32x; then \
	   (cd $(srcdir)/distributions/$(DISTNAME); \
		$(MAKE) "DISTVER=$(DISTVER)" uninstall); \
	fi


.PHONY: clean realclean distclean mostlyclean


#
# Look ma' ... find is the answer.
clean:
	-rm -f `find . \( -name '*~' -o -name '*.bak' -o -name '*.ESV' \
		-o -name '*.ASV' -o -name '*.orig' -o -name 'core' \) -print`
	-rm -f `find . -type f -size 0 -print`
	-rm -f *.lsm apcupsd-linux apcaccess-linux powerflute-linux
	-rm -f apcupsd apctest apcnisd apcnetd apcaccess powerflute 
	-rm -f *.o core apcupsd.dvi $(apclib)
	-rm -f core *.o *.exe *.res apctest.output	  
	(cd lib; $(MAKE) clean)
	(cd etc; $(MAKE) clean)
	if test -f win32/Makefile; then \
		(cd win32; $(MAKE) clean); \
	fi
	(cd distributions; $(MAKE) clean)
	if test -f intl/Makefile; then \
		(cd intl; $(MAKE) clean); \
	fi
	if test -f po/Makefile; then \
		(cd po; $(MAKE) clean); \
	fi
	if test -f cgi/Makefile; then \
		(cd cgi; $(MAKE) clean);	\
	fi
	-rm -f 1 2 3 include/1 include/2 include/3

clobber : distclean

distclean: clean
	if test -f intl/Makefile; then \
		(cd intl; $(MAKE) distclean); \
	fi
	if test -f po/Makefile; then \
		(cd po; $(MAKE) distclean); \
	fi
	if test -f cgi/Makefile; then \
		(cd cgi; $(MAKE) distclean); \
	fi
	(cd lib; $(MAKE) distclean)
	(cd etc; $(MAKE) distclean)
	if test -f win32/Makefile; then \
		(cd win32; $(MAKE) distclean); \
	fi
	(cd distributions; $(MAKE) distclean)
	-rm -f po/POTFILES intl/libintl.h intl/po2tbl.sed
	-rm -f `find . -name Makefile -print`
	-rm -f config.h TAGS tags
	-rm -f config.cache config.status config.log stamp-config
	-rm -f examples/safe.apccontrol

realclean: distclean
	-rm -f FAQ FEATURES NOTES MANIFEST 
	-rm -f config.cache config.log Makefile
	-rm -f apcupsd-*.tar.gz apcupsd-*.i386.rpm 

mostlyclean: clean

# This tells versions [3.59,3.63) of GNU make not to export all variables.
.NOEXPORT:

headers = $(srcdir)/include/apc_config.h $(srcdir)/include/apc_defines.h \
	  $(srcdir)/include/apc_extern.h $(srcdir)/include/apc_struct.h \
	  $(srcdir)/include/apc_version.h $(srcdir)/include/apc_i18n.h

extra = $(srcdir)/lib/getopt.[ch] $(srcdir)/lib/getopt1.c \
	$(srcdir)/lib/strcasecmp.c $(srcdir)/lib/strstr.c \
	$(srcdir)/lib/memmove.c $(srcdir)/lib/Makefile.in

docs = $(srcdir)/doc/* $(srcdir)/COPYING $(srcdir)/INSTALL \
	$(srcdir)/ChangeLog $(srcdir)/ABOUT-NLS $(srcdir)/MANIFEST \
	$(srcdir)/TODO $(srcdir)/examples/*

config = $(srcdir)/Makefile.in $(srcdir)/configure.in $(srcdir)/configure \
	$(srcdir)/config.guess $(srcdir)/config.h.in $(srcdir)/config.sub \
	$(srcdir)/acconfig.h $(srcdir)/aclocal.m4

scripts = $(srcdir)/scripts/install-sh $(srcdir)/scripts/mkinstalldirs \
	$(srcdir)/redhat/specgen.sh $(srcdir)/scripts/lsmgen.sh \
	$(srcdir)/scripts/* $(srcdir)/scripts/autoregen.sh

all = $(docs) $(config) $(srcs) $(parser) $(headers) $(extra) $(scripts) \
	$(srcdir)/distributions/redhat/* $(srcdir)/distributions/debian/* \
	$(srcdir)/distributions/slackware/* $(srcdir)/distributions/suse/* \
	$(srcdir)/distributions/unifix/* $(srcdir)/distributions/unknown/* \
	$(srcdir)/intl/* $(srcdir)/po/* $(srcdir)/etc/*

MANIFEST: $(srcdir) Makefile.in
	@echo $(all) | tr "[ \t]" '\n' | sed -e '/^\.\//s///' | sort >MANIFEST
	@wc -l MANIFEST

# Make distribution, update LSM with proper size, remake distribution
dist: Makefile.in  
	rm -f MANIFEST; make MANIFEST;
	touch apcupsd.lsm
	make apcupsd-$(VERSION).tar.gz 
	$(srcdir)/scripts/lsmgen.sh $(VERSION) \
		`wc -c apcupsd-$(VERSION).tar.gz` >apcupsd.lsm
	make apcupsd-$(VERSION).tar.gz
	ls -l apcupsd-$(VERSION).tar.gz
	@echo "Don't forget to build RPMs from root!"

apcupsd-$(VERSION).tar.gz: $(all)
	(cd ..; tar -czf apcupsd-$(VERSION).tar.gz `sed <apcupsd-$(VERSION)/MANIFEST s:^:apcupsd-$(VERSION)/:`)
	mv -f ../apcupsd-$(VERSION).tar.gz .

# Make RPMs.  You need to be root to make this work
RPMROOT=/usr/src/redhat
RPM = rpm
RPMFLAGS = -ba
rpm: dist
	cp apcupsd-$(VERSION).tar.gz doc/apcupsd.gif $(RPMROOT)/SOURCES;
	$(srcdir)/redhat/specgen.sh $(VERSION) >$(RPMROOT)/SPECS/apcupsd.spec
	cd $(RPMROOT)/SPECS; $(RPM) $(RPMFLAGS) apcupsd.spec	
	cp $(RPMROOT)/RPMS/`arch|sed 's/i[4-9]86/i386/'`/apcupsd-$(VERSION)*.rpm $(srcdir)
	cp $(RPMROOT)/SRPMS/apcupsd-$(VERSION)*.src.rpm $(srcdir)

# Semi-automatic generation of dependencies:
# Use gcc if possible because X11 `makedepend' doesn't work on all systems
# and it also includes system headers.

depend:
	(cd lib; make depend)
	@$(RMF) Makefile.bak
	@if test "$(CC)" = "gcc" ; then \
	   $(MV) Makefile Makefile.bak; \
	   $(SED) "/^# DO NOT DELETE THIS LINE/,$$ d" Makefile.bak > Makefile; \
	   $(ECHO) "# DO NOT DELETE THIS LINE -- make depend depends on it." >> Makefile; \
	   $(CC) -S -M $(CPPFLAGS) -I$(srcdir) -I$(srcdir)/include *.c >> Makefile; \
	else \
	   makedepend -- $(CFLAGS) -- -I$(srcdir) -I$(srcdir)/include *.c; \
	fi 
	@if test -f Makefile ; then \
	    $(RMF) Makefile.bak; \
	else \
	   $(MV) Makefile.bak Makefile; \
	   echo -e "Something went wrong with the make depend!\n\a\a\a\a"; \
	fi

# -----------------------------------------------------------------------
# DO NOT DELETE THIS LINE -- make depend depends on it.