summaryrefslogtreecommitdiffstats
path: root/misc/afbackup/files/Makefile.in
blob: fdd7d7ba76d75e896011887510299d55b69de6ca (plain)
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
SHELL		=	/bin/sh

CC		=	@CC@

MAKECMD		=	make

OSNAME		=	@osname@

PACKAGE		=	@PACKAGE@
VERSION		=	@VERSION@

SUBDIRS		=	intl po

X_INCLUDE	=	.
X_LIBS		=	.

OPTIMIZE	=	
DEBUG		=	

INCLUDES	=	-I$(X_INCLUDE) @DESINCLUDEPATH@ @ZLIB_INCLUDEPATH@
DEFINES		=	-D$(OSNAME) -DOSNAME=$(OSNAME) @DESDEFINES@ @ZLIB_DEFINES@

CFLAGS		=	@CFLAGS@ $(INCLUDES) $(DEFINES) $(DEBUG) $(OPTIMIZE)	\
				$(EXTRA_CFLAGS) @EXTRACFLAGS@ \
				-DLOCALEDIR=\"$(LOCALEDIR)\" 

UTILSLIB	=	x_utils

X_HEADERS	=	crptauth.h	\
			fileutil.h	\
			mvals.h		\
			netutils.h	\
			packer.h	\
			sysutils.h	\
			utils.h		\
			x_data.h	\
			x_defs.h	\
			x_errno.h	\
			x_regex.h	\
			x_timer.h	\
			x_types.h	\
			zutils.h

X_LIBTOOLS	=	prosname.sh	\
			prosspec.sh


BULIB		=	afbackup

LIBRARIES	=	-l$(BULIB) -l$(UTILSLIB) @LIBS@ @DESLIBPATH@ \
			@DESLIB@ @ZLIB_LIBPATH@ @ZLIB_LIB@ -lm @INTLLIBS@

LDFLAGS		=	-L$(X_LIBS) $(LIBRARIES) $(EXTRA_LD_FLAGS)

X_LIBSRCS	=	crptauth.c	\
			pack.c		\
			unpack.c	\
			utils.c		\
			goptions.c	\
			fileutil.c	\
			x_regex.c	\
			mutils.c	\
			sysutils.c	\
			netutils.c	\
			timeutil.c	\
			typeutil.c	\
			safewrap.c	\
			zutils.c

X_LIBOBJS	=	$(X_LIBSRCS:.c=.o)

BULIBSRCS	=	buutil.c	\
			prot.c

BULIBOBJS	=	$(BULIBSRCS:.c=.o)

CRYPTKEY	=	cryptkey.h

CL_HELPERS	=	__piper __packpats @DESCRPT@ @ZIP@
SV_HELPERS	=	__numset

PROGRAMS	=	afserver afmserver afclient cartready label_tape \
				full_backup $(CL_HELPERS) $(SV_HELPERS)

RESTRCLNTPROGS	=	afclient afbackup afrestore afverify copy_tape \
			full_backup incr_backup afbackout update_indexes \
			__descrpt __z
CLIENTPROGRAMS	=	$(RESTRCLNTPROGS) autocptapes afclientconfig \
			xafclientconfig xafrestore
RESTRSVRPROGS	=	afmserver afserver label_tape cartready changerready \
			cartis
SERVERPROGRAMS	=	$(RESTRSVRPROGS) afserverconfig cartagehandler \
			xafserverconfig xafserverstatus __inc_link __mt __numset

X_LIBRARY	=	lib$(UTILSLIB).a
BACKUPLIB	=	lib$(BULIB).a

BASELIBS	=	intllibs

TESTMAINSRCS	=	testmain.c
TESTMAINOBJS	=	$(TESTMAINSRCS:.c=.o)

SERVERSRCS	=	server.c
SERVEROBJS	=	$(SERVERSRCS:.c=.o)

MSERVERSRCS	=	mserver.c
MSERVEROBJS	=	$(MSERVERSRCS:.c=.o)

CARTRDYSRCS	=	cartready.c
CARTRDYOBJS	=	$(CARTRDYSRCS:.c=.o)

LABELTAPESRCS	=	label_tape.c
LABELTAPEOBJS	=	$(LABELTAPESRCS:.c=.o)

CLIENTSRCS	=	client.c
CLIENTOBJS	=	$(CLIENTSRCS:.c=.o)

FULLBUSRCS	=	full_backup.c
FULLBUOBJS	=	$(FULLBUSRCS:.c=.o)

TESTCLIENTSRCS	=	testclient.c
TESTCLIENTOBJS	=	$(TESTCLIENTSRCS:.c=.o)

SERVERCONFFILE	=	server.conf
CLIENTCONFFILE	=	client.conf

CHANGERCONFFILE	=	changer.conf

prefix		=	@prefix@
exec_prefix	=	@exec_prefix@

CLIENTLIBDIR	=	@clientlibdir@
CLIENTBINDIR	=	@clientbindir@
CLIENTVARDIR	=	@clientvardir@
CLIENTMANDIR	=	@clientmandir@
SERVERLIBDIR	=	@serverlibdir@
SERVERBINDIR	=	@serverbindir@
SERVERVARDIR	=	@servervardir@
SERVERMANDIR	=	@servermandir@
COMMONDIR	=	@commondir@
COMMONDATADIR	=	@commondatadir@
COMMONSHLIBDIR	=	@commonshlibdir@

BINDIR		=	@bindir@
SBINDIR		=	@sbindir@
LIBEXECDIR	=	@libexecdir@
DATADIR		=	@datadir@
SYSCONFDIR	=	@sysconfdir@
MANDIR		=	@mandir@
VARDIR		=	@localstatedir@
REXECDIR	=	@REXECDIR@

# Where to install locale stuff
LOCALEDIR	=	$(DATADIR)/locale

CLIENTMANFILES	=	afclient.X	\
			afrestore.X	\
			afverify.X	\
			full_backup.X	\
			incr_backup.X	\
			copy_tape.X	\
			update_indexes.X	\
			xafrestore.X	\
			afclient.conf.X
SERVERMANFILES	=	afserver.X	\
			afmserver.X	\
			cartis.X	\
			cartready.X	\
			label_tape.X	\
			cart_ctl.X	\
			afserver.conf.X

SRCMANSUFFIX	=	8
DESTMANSUFFIX	=	8
CLIENTMANSRCS	=	$(CLIENTMANFILES:.X=.8)
SERVERMANSRCS	=	$(SERVERMANFILES:.X=.8)
#					     ^ this must be $(SRCMANSUFFIX)

INSTALL		=	install -C

.c.o:	config.h
	$(CC) -c $(CFLAGS) $<

all::	$(PROGRAMS) potfiles

server:	afserver potfiles
	@:

afserver:	$(CRYPTKEY) $(BACKUPLIB) $(X_LIBRARY) $(BASELIBS) $(SERVEROBJS) $(MSERVEROBJS) $(CARTRDYOBJS) $(LABELTAPEOBJS) xserverconfig xserverstatus $(SV_HELPERS)
	$(CC) -o afserver $(SERVEROBJS) $(LDFLAGS)
	$(CC) -o afmserver $(MSERVEROBJS) $(LDFLAGS)
	$(CC) -o cartready $(CARTRDYOBJS) $(LDFLAGS)
	$(CC) -o label_tape $(LABELTAPEOBJS) $(LDFLAGS)

$(SERVEROBJS):	$(CRYPTKEY)

cartready:	$(BACKUPLIB) $(X_LIBRARY) $(BASELIBS) $(CARTRDYOBJS)
	$(CC) -o cartready $(CARTRDYOBJS) $(LDFLAGS)

label_tape:	$(BACKUPLIB) $(X_LIBRARY) $(BASELIBS) $(LABELTAPEOBJS)
	$(CC) -o label_tape $(LABELTAPEOBJS) $(LDFLAGS)

client:	afclient potfiles
	@:

afclient:	$(CRYPTKEY) $(BACKUPLIB) $(X_LIBRARY) $(BASELIBS) $(CLIENTOBJS) $(FULLBUOBJS) xclientconfig xrestore $(CL_HELPERS)
	$(CC) -o afclient $(CLIENTOBJS) $(LDFLAGS)
	$(CC) -o full_backup $(FULLBUOBJS) $(LDFLAGS)

$(CLIENTOBJS):	$(CRYPTKEY)

$(CRYPTKEY):	ask_for_key
	@if [ -f cryptkey ]; then sh ./ask_for_key <cryptkey; else sh ./ask_for_key; fi

potfiles: intllibs
	(cd po; $(MAKE) DATADIR=\"$(DATADIR)\" all)

intllibs:
	(cd intl; $(MAKE) all)

__piper:	__piper.o $(BACKUPLIB) $(X_LIBRARY)
	$(CC) -o __piper __piper.o $(LDFLAGS)

__packpats:	__packpats.o $(BACKUPLIB) $(X_LIBRARY)
	$(CC) -o __packpats __packpats.o $(LDFLAGS)

__numset:	__numset.o $(BACKUPLIB) $(X_LIBRARY)
	$(CC) -o __numset __numset.o $(LDFLAGS)

__descrpt:	$(CRYPTKEY) __descrpt.o $(BACKUPLIB) $(X_LIBRARY)
	$(CC) -o __descrpt __descrpt.o $(LDFLAGS)

__z:	__z.o $(BACKUPLIB) $(X_LIBRARY)
	$(CC) -o __z __z.o $(LDFLAGS)

$(BACKUPLIB):	$(BULIBOBJS)
	ar rcv $(BACKUPLIB) $(BULIBOBJS)
	if [ _@ranlib@ != _ ] ; then @ranlib@ $(BACKUPLIB) ; fi

$(X_LIBRARY):	$(X_LIBOBJS)
	ar rcv $(X_LIBRARY) $(X_LIBOBJS)
	if [ _@ranlib@ != _ ] ; then @ranlib@ $(X_LIBRARY) ; fi

$(UTILSLIB)::	$(X_LIBRARY)

install.$(UTILSLIB): $(UTILSLIB)
	install -d @utilsincdir@ @utilsincdir@/$(OSNAME) @utilslibdir@ \
		@utilslibdir@/$(OSNAME) @utilsbindir@
	for i in $(X_HEADERS) ; do /bin/rm -f @utilsincdir@/$$i ; \
		$(INSTALL) $$i @utilsincdir@/$$i ; done
	for i in $(X_LIBRARY) ; do /bin/rm -f @utilslibdir@/$(OSNAME)/$$i ; \
		$(INSTALL) $$i @utilslibdir@/$(OSNAME)/$$i ; done
	$(INSTALL) -m 0644 lconf.h @utilsincdir@/$(OSNAME)/lconf.h
	$(INSTALL) -m 0644 lconf.gen.h @utilsincdir@/lconf.h
	for i in $(X_LIBTOOLS) ; do \
		$(INSTALL) -m 0644 $$i @utilsbindir@/$$i ; done

install:: install.client install.server install.client.man install.server.man

install.client: client full_backup install.client.man install.l10n
	install -d $(CLIENTBINDIR) $(CLIENTLIBDIR) $(COMMONSHLIBDIR) $(LIBEXECDIR)
	install -d -o afbackup -g operator $(CLIENTVARDIR)
	$(INSTALL) -g operator -m 0750 afclient $(SBINDIR)
	ln -sf $(SBINDIR)/afclient $(SBINDIR)/afbackup
	$(INSTALL) full_backup $(SBINDIR)/full_backup
	ln -sf $(SBINDIR)/full_backup $(SBINDIR)/incr_backup
	ln -sf $(SBINDIR)/full_backup $(SBINDIR)/afverify
	ln -sf $(SBINDIR)/full_backup $(SBINDIR)/copy_tape
	ln -sf $(SBINDIR)/full_backup $(SBINDIR)/afbackout
	ln -sf $(SBINDIR)/full_backup $(SBINDIR)/update_indexes
	ln -sf $(SBINDIR)/full_backup $(SBINDIR)/afrestore
	$(INSTALL) -m 0755 clientconfig $(SBINDIR)/afclientconfig
	ln -sf $(SBINDIR)/afclientconfig $(SBINDIR)/clientconfig
	if [ -z "$(NO_GUI)" ]; then \
	    $(INSTALL) -m 0755 xclientconfig $(SBINDIR)/xafclientconfig; \
	    ln -sf $(SBINDIR)/xafclientconfig $(SBINDIR)/xclientconfig; \
	    $(INSTALL) -m 0755 xrestore $(SBINDIR)/xafrestore; \
	    ln -sf $(SBINDIR)/xafrestore $(SBINDIR)/xrestore; \
	fi
	$(INSTALL) -m 0755 autocptapes $(SBINDIR)/autocptapes
	$(INSTALL) -m 0755 __packpats $(LIBEXECDIR)/__packpats
	$(INSTALL) -m 0755 __piper $(LIBEXECDIR)/__piper
	if [ ! -z "@DESCRPT@" ] ; then \
		$(INSTALL) -m 0755 "@DESCRPT@" $(LIBEXECDIR)/@DESCRPT@ ; \
	fi
	if [ ! -z "@ZIP@" ] ; then \
		$(INSTALL) -m 0755 "@ZIP@" $(LIBEXECDIR)/@ZIP@ ; \
	fi
	$(INSTALL) -m 0644 aftcllib.tcl $(COMMONSHLIBDIR)/aftcllib.tcl
	if [ ! -f $(SYSCONFDIR)/@clientconf@.sample ] ; then $(INSTALL) -m 0644 $(CLIENTCONFFILE) $(CLIENTLIBDIR)/@clientconf@.sample ; fi

install.server: server cartready label_tape install.server.man install.l10n
	install -d $(SERVERBINDIR) $(SERVERLIBDIR) $(COMMONSHLIBDIR) $(REXECDIR) $(LIBEXECDIR)
	install -d -o afbackup -g operator $(SERVERVARDIR)
	$(INSTALL) -o afbackup -g operator -m 0700 afserver afmserver $(LIBEXECDIR)
	$(INSTALL) -m 04755 -o afbackup cartready $(SBINDIR) 
	$(INSTALL) -g operator -m 0750 label_tape $(SBINDIR) 
	$(INSTALL) -m 0755 __mt __inc_link $(LIBEXECDIR)
	ln -sf $(SBINDIR)/label_tape $(SBINDIR)/cart_ctl
	ln -sf $(SBINDIR)/label_tape $(SBINDIR)/cartis
	ln -sf $(SBINDIR)/cartready $(SBINDIR)/changerready
	$(INSTALL) -m 0755 serverconfig $(SBINDIR)/afserverconfig
	ln -sf afserverconfig $(SBINDIR)/serverconfig
	if [ -z "$(NO_GUI)" ]; then \
	    $(INSTALL) -m 0755 xserverconfig $(SBINDIR)/xafserverconfig; \
	    ln -sf xafserverconfig $(SBINDIR)/xserverconfig; \
	    $(INSTALL) -m 0755 xserverstatus $(SBINDIR)/xafserverstatus; \
	    ln -sf xafserverstatus $(SBINDIR)/xserverstatus; \
	fi
	$(INSTALL) -m 0644 aftcllib.tcl $(COMMONSHLIBDIR)/aftcllib.tcl
	$(INSTALL) -m 0755 __numset $(LIBEXECDIR)/__numset
	if [ ! -f $(LIBEXECDIR)/cartagehandler ] ; then $(INSTALL) cartagehandler $(LIBEXECDIR)/cartagehandler ; fi
	if [ ! -f $(SERVERLIBDIR)/@serverconf@.sample ] ; then $(INSTALL) -m 0644 $(SERVERCONFFILE) $(SERVERLIBDIR)/@serverconf@.sample ; fi
	if [ ! -f $(SERVERLIBDIR)/$(CHANGERCONFFILE).sample ] ; then $(INSTALL) -m 0644 $(CHANGERCONFFILE) $(SERVERLIBDIR)/$(CHANGERCONFFILE).sample ; fi
	touch $(SERVERVARDIR)/readonly_tapes

install.rclient: install.server install.client install.rexeclinks

install.userrestore:
	$(INSTALL) -m 04755 -o root:wheel $(LIBEXECDIR)/full_backup $(SBINDIR)/afrestore
	ln -sf $(SBINDIR)/afrestore $(SBINDIR)/afbackout
	ln -sf $(SBINDIR)/afrestore $(SBINDIR)/update_indexes

install.rexeclinks:
	( for i in full_backup incr_backup afverify afrestore copy_tape update_indexes ; do ln -sf $(CLIENTBINDIR)/"$$i" $(REXECDIR)/"$$i" ; done )

install.client.man: $(CLIENTMANSRCS)
	install -d $(MANDIR)/man$(DESTMANSUFFIX)
	( for mansrc in $(CLIENTMANSRCS) ; do destfile=`echo $$mansrc|sed 's/[.]'$(SRCMANSUFFIX)'$$/.'$(DESTMANSUFFIX)/g` ; $(INSTALL) -m 0644 $$mansrc $(MANDIR)/man$(DESTMANSUFFIX)/$$destfile ; done )

install.server.man: $(SERVERMANSRCS)
	install -d $(MANDIR)/man$(DESTMANSUFFIX)
	( for mansrc in $(SERVERMANSRCS) ; do destfile=`echo $$mansrc|sed 's/[.]'$(SRCMANSUFFIX)'$$/.'$(DESTMANSUFFIX)/g` ; $(INSTALL) -m 0644 $$mansrc $(MANDIR)/man$(DESTMANSUFFIX)/$$destfile ; done )

install.l10n: potfiles
	(cd po; $(MAKE) datadir=\"$(DATADIR)\" install)

xclientconfig: xcc
	if [ -z "${NO_GUI}" ]; then ( ./build_shwish $? > $@; chmod +x $@) fi

xserverconfig: xsc
	if [ -z "${NO_GUI}" ]; then ( ./build_shwish $? > $@; chmod +x $@) fi

xserverstatus: xss
	if [ -z "${NO_GUI}" ]; then ( ./build_shwish $? > $@; chmod +x $@) fi

xrestore: xrs
	if [ -z "${NO_GUI}" ]; then ( ./build_shwish $? > $@; chmod +x $@) fi

clean::
	- for subdir in $(SUBDIRS) ; do (cd $$subdir && $(MAKE) clean ) ; done
	- rm -f *% *.o *.a *~ core* *_

veryclean: clean
	- rm -f $(PROGRAMS)

distclean: clean
	- for subdir in $(SUBDIRS) ; do (cd $$subdir && $(MAKE) distclean ) ; done
	- rm -f $(PROGRAMS) $(CRYPTKEY) xclientconfig xserverconfig xrestore xserverstatus
	- rm -f config.cache config.log config.status config.setup Install.cache
	- rm -f `/bin/ls *.in|sed 's/[.]in$$//g'|grep -v configure` confdefs.h

OpenPOWER on IntegriCloud