File: Makefile

package info (click to toggle)
openser 1.1.0-9etch1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,828 kB
  • ctags: 11,809
  • sloc: ansic: 120,528; sh: 5,249; yacc: 1,716; makefile: 1,261; php: 656; perl: 205; sql: 190
file content (558 lines) | stat: -rw-r--r-- 19,747 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
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# $Id: Makefile,v 1.30 2006/07/10 17:57:20 miconda Exp $
#
# sip_router makefile
#
# WARNING: requires gmake (GNU Make)
#  Arch supported: Linux, FreeBSD, SunOS (tested on Solaris 8), OpenBSD (3.2),
#  NetBSD (1.6).
#
#  History:
#  --------
#              created by andrei
#  2003-02-24  make install no longer overwrites openser.cfg  - patch provided
#               by Maxim Sobolev   <sobomax@FreeBSD.org> and 
#                  Tomas Bjrklund <tomas@webservices.se>
#  2003-03-11  PREFIX & LOCALBASE must also be exported (andrei)
#  2003-04-07  hacked to work with solaris install (andrei)
#  2003-04-17  exclude modules overwritable from env. or cmd. line,
#               added include_modules and skip_modules (andrei)
#  2003-05-30  added extra_defs & EXTRA_DEFS
#               Makefile.defs force-included to allow recursive make
#               calls -- see comment (andrei)
#  2003-06-02  make tar changes -- unpacks in $NAME-$RELEASE  (andrei)
#  2003-06-03  make install-cfg will properly replace the module path
#               in the cfg (re: /usr/.*lib/openser/modules)
#              openser.cfg.default is installed only if there is a previous
#               cfg. -- fixes packages containing openser.cfg.default (andrei)
#  2003-08-29  install-modules-doc split from install-doc, added 
#               install-modules-all, removed README.cfg (andrei)
#              added skip_cfg_install (andrei)
#  2004-09-02  install-man will automatically "fix" the path of the files
#               referred in the man pages
#

#TLS=1
auto_gen=lex.yy.c cfg.tab.c   #lexx, yacc etc

#include  source related defs
include Makefile.sources

# whether or not to install openser.cfg or just openser.cfg.default
# (openser.cfg will never be overwritten by make install, this is usefull
#  when creating packages)
skip_cfg_install?=

#extra modules to exclude
skip_modules?=

# if not set on the cmd. line or the env, exclude this modules:
exclude_modules?= 		jabber cpl-c mysql pa postgres osp unixodbc \
						avp_radius auth_radius group_radius uri_radius
ifeq ($(TLS),)
	exclude_modules+= tlsops
endif
# always exclude the CVS dir
override exclude_modules+= CVS $(skip_modules)

#always include this modules
include_modules?=

# first 2 lines are excluded because of the experimental or incomplete
# status of the modules
# the rest is excluded because it depends on external libraries
#
static_modules=
static_modules_path=$(addprefix modules/, $(static_modules))
extra_sources=$(wildcard $(addsuffix /*.c, $(static_modules_path)))
extra_objs=$(extra_sources:.c=.o)

static_defs= $(foreach  mod, $(static_modules), \
		-DSTATIC_$(shell echo $(mod) | tr [:lower:] [:upper:]) )

override extra_defs+=$(static_defs) $(EXTRA_DEFS)
export extra_defs

modules=$(filter-out $(addprefix modules/, \
			$(exclude_modules) $(static_modules)), \
			$(wildcard modules/*))
modules:=$(filter-out $(modules), $(addprefix modules/, $(include_modules) )) \
			$(modules)
modules_names=$(shell echo $(modules)| \
				sed -e 's/modules\/\([^/ ]*\)\/*/\1.so/g' )
modules_basenames=$(shell echo $(modules)| \
				sed -e 's/modules\/\([^/ ]*\)\/*/\1/g' )
#modules_names=$(patsubst modules/%, %.so, $(modules))
modules_full_path=$(join  $(modules), $(addprefix /, $(modules_names)))

MODULE_MYSQL_INCLUDED=$(shell echo $(modules)| grep mysql )
ifeq (,$(MODULE_MYSQL_INCLUDED))
	MYSQLON=no
else
	MYSQLON=yes
endif
MODULE_PGSQL_INCLUDED=$(shell echo $(modules)| grep postgres )
ifeq (,$(MODULE_PGSQL_INCLUDED))
	PGSQLON=no
else
	PGSQLON=yes
endif

ALLDEP=Makefile Makefile.sources Makefile.defs Makefile.rules

#include general defs (like CC, CFLAGS  a.s.o)
# hack to force makefile.defs re-inclusion (needed when make calls itself with
# other options -- e.g. make bin)
makefile_defs=0
DEFS:=
include Makefile.defs

NAME=$(MAIN_NAME)

#export relevant variables to the sub-makes
export DEFS PROFILE CC LD MKDEP MKTAGS CFLAGS LDFLAGS MOD_CFLAGS MOD_LDFLAGS 
export LIBS
export LEX YACC YACC_FLAGS
export PREFIX LOCALBASE
# export relevant variables for recursive calls of this makefile 
# (e.g. make deb)
#export LIBS
#export TAR 
#export NAME RELEASE OS ARCH 
#export cfg-prefix cfg-dir bin-prefix bin-dir modules-prefix modules-dir
#export doc-prefix doc-dir man-prefix man-dir ut-prefix ut-dir
#export cfg-target modules-target
#export INSTALL INSTALL-CFG INSTALL-BIN INSTALL-MODULES INSTALL-DOC INSTALL-MAN 
#export INSTALL-TOUCH

ifneq ($(TLS),)
	tar_extra_args+=
else
	tar_extra_args+=--exclude=$(notdir $(CURDIR))/tls* 
endif
# include the common rules
include Makefile.rules

#extra targets 

$(NAME): $(extra_objs) # static_modules

lex.yy.c: cfg.lex cfg.tab.h $(ALLDEP)
	$(LEX) $<

cfg.tab.c cfg.tab.h: cfg.y  $(ALLDEP)
	$(YACC) $(YACC_FLAGS) $<

.PHONY: all
all: $(NAME) modules utils



.PHONY: modules
modules:
	-@for r in $(modules) "" ; do \
		if [ -n "$$r" ]; then \
			echo  "" ; \
			echo  "" ; \
			$(MAKE) -C $$r ; \
		fi ; \
	done 

.PHONY: modules-readme
modules-readme:
	-@for r in  $(modules_basenames) "" ; do \
		if [ -d "modules/$$r/doc" ]; then \
			cd "modules/$$r/doc" ; \
			if [ -f "$$r".sgml ]; then \
				echo  "" ; \
				echo  "docbook2txt $$r.sgml" ; \
				docbook2txt "$$r".sgml ; \
				mv "$$r".txt ../README ; \
			fi ; \
			cd ../../.. ; \
		fi ; \
	done 

.PHONY: modules-docbook-txt
modules-docbook-txt:
	-@for r in  $(modules_basenames) "" ; do \
		if [ -d "modules/$$r/doc" ]; then \
			cd "modules/$$r/doc" ; \
			if [ -f "$$r".sgml ]; then \
				echo  "" ; \
				echo  "docbook2txt $$r.sgml" ; \
				docbook2txt "$$r".sgml ; \
			fi ; \
			cd ../../.. ; \
		fi ; \
	done 

.PHONY: modules-docbook-html
modules-docbook-html:
	-@for r in  $(modules_basenames) "" ; do \
		if [ -d "modules/$$r/doc" ]; then \
			cd "modules/$$r/doc" ; \
			if [ -f "$$r".sgml ]; then \
				echo  "" ; \
				echo  "docbook2html -u $$r.sgml" ; \
				docbook2html -u "$$r".sgml ; \
			fi ; \
			cd ../../.. ; \
		fi ; \
	done 

.PHONY: modules-docbook-pdf
modules-docbook-pdf:
	-@for r in  $(modules_basenames) "" ; do \
		if [ -d "modules/$$r/doc" ]; then \
			cd "modules/$$r/doc" ; \
			if [ -f "$$r".sgml ]; then \
				echo  "" ; \
				echo  "docbook2pdf $$r.sgml" ; \
				docbook2pdf "$$r".sgml ; \
			fi ; \
			cd ../../.. ; \
		fi ; \
	done 

.PHONY: modules-docbook
modules-docbook: modules-docbook-txt modules-docbook-html modules-docbook-pdf


$(extra_objs):
	-@echo "Extra objs: $(extra_objs)" 
	-@for r in $(static_modules_path) "" ; do \
		if [ -n "$$r" ]; then \
			echo  "" ; \
			echo  "Making static module $r" ; \
			$(MAKE) -C $$r static ; \
		fi ; \
	done 


	
dbg: $(NAME)
	gdb -command debug.gdb

.PHONY: tar
.PHONY: dist

dist: tar

tar: 
	$(TAR) -C .. \
		--exclude=$(notdir $(CURDIR))/test* \
		--exclude=$(notdir $(CURDIR))/tmp* \
		--exclude=$(notdir $(CURDIR))/debian* \
		--exclude=$(notdir $(CURDIR))/packaging/debian/ser* \
		--exclude=$(notdir $(CURDIR))/ser_tls* \
		--exclude=CVS* \
		--exclude=.cvsignore \
		--exclude=.svn* \
		--exclude=*.[do] \
		--exclude=*.so \
		--exclude=*.il \
		--exclude=$(notdir $(CURDIR))/ser \
		--exclude=$(notdir $(CURDIR))/$(NAME) \
		--exclude=*.gz \
		--exclude=*.bz2 \
		--exclude=*.tar \
		--exclude=*.patch \
		--exclude=.\#* \
		--exclude=*.swp \
		${tar_extra_args} \
		-cf - $(notdir $(CURDIR)) | \
			(mkdir -p tmp/_tar1; mkdir -p tmp/_tar2 ; \
			    cd tmp/_tar1; $(TAR) -xf - ) && \
			    mv tmp/_tar1/$(notdir $(CURDIR)) \
			       tmp/_tar2/"$(NAME)-$(RELEASE)" && \
			    (cd tmp/_tar2 && $(TAR) \
			                    -zcf ../../"$(NAME)-$(RELEASE)_src".tar.gz \
			                               "$(NAME)-$(RELEASE)" ) ; \
			    rm -rf tmp/_tar1; rm -rf tmp/_tar2

# binary dist. tar.gz
.PHONY: bin
bin:
	mkdir -p tmp/$(NAME)/usr/local
	$(MAKE) install basedir=tmp/$(NAME) prefix=/usr/local 
	$(TAR) -C tmp/$(NAME)/ -zcf ../$(NAME)-$(RELEASE)_$(OS)_$(ARCH).tar.gz .
	rm -rf tmp/$(NAME)

.PHONY: deb
deb:
	ln -sf packaging/debian
	dpkg-buildpackage -rfakeroot -tc $(DEBBUILD_EXTRA_OPTIONS)
	rm -f debian

.PHONY: sunpkg
sunpkg:
	mkdir -p tmp/$(NAME)
	mkdir -p tmp/$(NAME)_sun_pkg
	$(MAKE) install basedir=tmp/$(NAME) prefix=/usr/local
	(cd packaging/solaris; \
	pkgmk -r ../../tmp/$(NAME)/usr/local -o -d ../../tmp/$(NAME)_sun_pkg/ -v "$(RELEASE)" ;\
	cd ../..)
	cat /dev/null > ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local
	pkgtrans -s tmp/$(NAME)_sun_pkg/ ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local \
		OpenSER
	gzip -9 ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local
	rm -rf tmp/$(NAME)
	rm -rf tmp/$(NAME)_sun_pkg


.PHONY: install
install: all mk-install-dirs install-cfg install-bin install-modules \
	install-doc install-man

.PHONY: dbinstall
dbinstall:
	-@echo "Initializing $(NAME) database"
	scripts/mysqldb.sh create
	-@echo "Done"

mk-install-dirs: $(cfg-prefix)/$(cfg-dir) $(bin-prefix)/$(bin-dir) \
			$(modules-prefix)/$(modules-dir) $(doc-prefix)/$(doc-dir) \
			$(man-prefix)/$(man-dir)/man8 $(man-prefix)/$(man-dir)/man5

$(cfg-prefix)/$(cfg-dir): 
		mkdir -p $(cfg-prefix)/$(cfg-dir)

$(bin-prefix)/$(bin-dir):
		mkdir -p $(bin-prefix)/$(bin-dir)

$(modules-prefix)/$(modules-dir):
		mkdir -p $(modules-prefix)/$(modules-dir)


$(doc-prefix)/$(doc-dir):
		mkdir -p $(doc-prefix)/$(doc-dir)

$(man-prefix)/$(man-dir)/man8:
		mkdir -p $(man-prefix)/$(man-dir)/man8

$(man-prefix)/$(man-dir)/man5:
		mkdir -p $(man-prefix)/$(man-dir)/man5
		
# note: on solaris 8 sed: ? or \(...\)* (a.s.o) do not work
install-cfg: $(cfg-prefix)/$(cfg-dir)
		sed -e "s#/usr/.*lib/$(NAME)/modules/#$(modules-target)#g" \
			< etc/$(NAME).cfg > $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample0
		sed -e "s#/usr/.*etc/$(NAME)/tls/#$(cfg-prefix)/$(cfg-dir)tls/#g" \
			< $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample0 \
			> $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample
		rm -fr $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample0
		chmod 644 $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample
		if [ -z "${skip_cfg_install}" -a \
				! -f $(cfg-prefix)/$(cfg-dir)$(NAME).cfg ]; then \
			mv -f $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample \
				$(cfg-prefix)/$(cfg-dir)$(NAME).cfg; \
		fi
		# radius dictionary
		$(INSTALL-TOUCH) $(cfg-prefix)/$(cfg-dir)/dictionary.radius
		$(INSTALL-CFG) etc/dictionary.radius $(cfg-prefix)/$(cfg-dir)
		# openserctl config
		$(INSTALL-TOUCH)   $(cfg-prefix)/$(cfg-dir)/openserctlrc.sample
		$(INSTALL-CFG) scripts/openserctlrc \
			$(cfg-prefix)/$(cfg-dir)/openserctlrc.sample
		if [ ! -f $(cfg-prefix)/$(cfg-dir)/openserctlrc ]; then \
			mv -f $(cfg-prefix)/$(cfg-dir)/openserctlrc.sample \
				$(cfg-prefix)/$(cfg-dir)/openserctlrc; \
		fi
		#$(INSTALL-CFG) etc/$(NAME).cfg $(cfg-prefix)/$(cfg-dir)
		if [ -z "$(TLS)" ]; then \
			echo  "No TLS scripts installed" ; \
		else \
			mkdir -p $(cfg-prefix)/$(cfg-dir)/tls ; \
			mkdir -p $(cfg-prefix)/$(cfg-dir)/tls/rootCA ; \
			mkdir -p $(cfg-prefix)/$(cfg-dir)/tls/rootCA/certs ; \
			mkdir -p $(cfg-prefix)/$(cfg-dir)/tls/rootCA/private ; \
			mkdir -p $(cfg-prefix)/$(cfg-dir)/tls/user ; \
			$(INSTALL-TOUCH) etc/tls/README $(cfg-prefix)/$(cfg-dir)/tls/; \
			$(INSTALL-CFG) etc/tls/README $(cfg-prefix)/$(cfg-dir)/tls/; \
			$(INSTALL-TOUCH) etc/tls/rootCA/index.txt $(cfg-prefix)/$(cfg-dir)/tls/rootCA/; \
			$(INSTALL-CFG) etc/tls/rootCA/index.txt $(cfg-prefix)/$(cfg-dir)/tls/rootCA/; \
			$(INSTALL-TOUCH) etc/tls/rootCA/serial $(cfg-prefix)/$(cfg-dir)/tls/rootCA/; \
			$(INSTALL-CFG) etc/tls/rootCA/serial $(cfg-prefix)/$(cfg-dir)/tls/rootCA/; \
			$(INSTALL-TOUCH) etc/tls/rootCA/cacert.pem $(cfg-prefix)/$(cfg-dir)/tls/rootCA/; \
			$(INSTALL-CFG) etc/tls/rootCA/cacert.pem $(cfg-prefix)/$(cfg-dir)/tls/rootCA/; \
			$(INSTALL-TOUCH) etc/tls/rootCA/certs/01.pem $(cfg-prefix)/$(cfg-dir)/tls/rootCA/certs/; \
			$(INSTALL-CFG) etc/tls/rootCA/certs/01.pem $(cfg-prefix)/$(cfg-dir)/tls/rootCA/certs/; \
			$(INSTALL-TOUCH) etc/tls/rootCA/private/cakey.pem $(cfg-prefix)/$(cfg-dir)/tls/rootCA/private/; \
			$(INSTALL-CFG) etc/tls/rootCA/private/cakey.pem $(cfg-prefix)/$(cfg-dir)/tls/rootCA/private/; \
			$(INSTALL-TOUCH) etc/tls/user/user-calist.pem $(cfg-prefix)/$(cfg-dir)/tls/user/; \
			$(INSTALL-CFG) etc/tls/user/user-calist.pem $(cfg-prefix)/$(cfg-dir)/tls/user/; \
			$(INSTALL-TOUCH) etc/tls/user/user-cert.pem $(cfg-prefix)/$(cfg-dir)/tls/user/; \
			$(INSTALL) etc/tls/user/user-cert.pem $(cfg-prefix)/$(cfg-dir)/tls/user/; \
			$(INSTALL-TOUCH) etc/tls/user/user-privkey.pem $(cfg-prefix)/$(cfg-dir)/tls/user/; \
			$(INSTALL-CFG) etc/tls/user/user-privkey.pem $(cfg-prefix)/$(cfg-dir)/tls/user/; \
			$(INSTALL-TOUCH) etc/tls/user/user-cert_req.pem $(cfg-prefix)/$(cfg-dir)/tls/user/; \
			$(INSTALL-CFG) etc/tls/user/user-cert_req.pem $(cfg-prefix)/$(cfg-dir)/tls/user/; \
		fi

install-bin: $(bin-prefix)/$(bin-dir) utils
		$(INSTALL-TOUCH) $(bin-prefix)/$(bin-dir)/$(NAME) 
		$(INSTALL-BIN) $(NAME) $(bin-prefix)/$(bin-dir)
		sed -e "s#/usr/local/sbin#$(bin-target)#g" \
			< scripts/openserctl > /tmp/openserctl
		sed -i -e "s#/usr/local/lib/openser#$(lib-target)#g" /tmp/openserctl
		sed -i -e "s#/usr/local/etc/openser#$(cfg-target)#g" /tmp/openserctl
		$(INSTALL-TOUCH) $(bin-prefix)/$(bin-dir)/openserctl
		$(INSTALL-BIN) /tmp/openserctl $(bin-prefix)/$(bin-dir)
		rm -fr /tmp/openserctl
		sed -e "s#/usr/local/sbin#$(bin-target)#g" \
			< scripts/openserctl.base > /tmp/openserctl.base
		mkdir -p $(modules-prefix)/$(lib-dir)/openserctl 
		$(INSTALL-TOUCH) \
			$(modules-prefix)/$(lib-dir)/openserctl
		$(INSTALL-CFG) /tmp/openserctl.base \
			$(modules-prefix)/$(lib-dir)/openserctl/openserctl.base
		rm -fr /tmp/openserctl.base
		sed -e "s#/usr/local#$(bin-target)#g" \
			< scripts/openserctl.ctlbase > /tmp/openserctl.ctlbase
		$(INSTALL-CFG) /tmp/openserctl.ctlbase \
			$(modules-prefix)/$(lib-dir)/openserctl/openserctl.ctlbase
		rm -fr /tmp/openserctl.ctlbase
		sed -e "s#/usr/local#$(bin-target)#g" \
			< scripts/openserctl.fifo > /tmp/openserctl.fifo
		$(INSTALL-CFG) /tmp/openserctl.fifo \
			$(modules-prefix)/$(lib-dir)/openserctl/openserctl.fifo
		rm -fr /tmp/openserctl.fifo
		sed -e "s#/usr/local#$(bin-target)#g" \
			< scripts/openserctl.unixsock > /tmp/openserctl.unixsock
		$(INSTALL-CFG) /tmp/openserctl.unixsock \
			$(modules-prefix)/$(lib-dir)/openserctl/openserctl.unixsock
		rm -fr /tmp/openserctl.unixsock
		sed -e "s#/usr/local#$(bin-target)#g" \
			< scripts/openserctl.sqlbase > /tmp/openserctl.sqlbase
		$(INSTALL-CFG) /tmp/openserctl.sqlbase \
			$(modules-prefix)/$(lib-dir)/openserctl/openserctl.sqlbase
		rm -fr /tmp/openserctl.sqlbase
		$(INSTALL-TOUCH)   $(bin-prefix)/$(bin-dir)/$(NAME)unix
		$(INSTALL-BIN) utils/$(NAME)unix/$(NAME)unix $(bin-prefix)/$(bin-dir)

.PHONY: utils
utils:
		cd utils/$(NAME)unix; $(MAKE) all

install-modules: modules install-modules-tools $(modules-prefix)/$(modules-dir)
	-@for r in $(modules_full_path) "" ; do \
		if [ -n "$$r" ]; then \
			if [ -f "$$r" ]; then \
				$(INSTALL-TOUCH) \
					$(modules-prefix)/$(modules-dir)/`basename "$$r"` ; \
				$(INSTALL-MODULES)  "$$r"  $(modules-prefix)/$(modules-dir) ; \
			else \
				echo "ERROR: module $$r not compiled" ; \
			fi ;\
		fi ; \
	done 


install-modules-all: install-modules install-modules-doc

install-modules-tools: $(bin-prefix)/$(bin-dir)
		if [ "$(MYSQLON)" = "yes" ]; then \
			mkdir -p $(modules-prefix)/$(lib-dir)/openserctl ; \
			sed -e "s#/usr/local#$(bin-target)#g" \
				< scripts/openserctl.mysql > /tmp/openserctl.mysql ; \
			$(INSTALL-CFG) /tmp/openserctl.mysql \
				$(modules-prefix)/$(lib-dir)/openserctl/openserctl.mysql ; \
			rm -fr /tmp/openserctl.mysql ; \
			sed -e "s#PATH:/usr/local/sbin#PATH:$(bin-target)#g" \
				< scripts/mysqldb.sh > /tmp/$(NAME)_mysql.sh ; \
			$(INSTALL-TOUCH)   $(bin-prefix)/$(bin-dir)/$(NAME)_mysql.sh ; \
			$(INSTALL-BIN) /tmp/$(NAME)_mysql.sh  $(bin-prefix)/$(bin-dir) ; \
			rm -fr /tmp/$(NAME)_mysql.sh ; \
		fi
		if [ "$(PGSQLON)" = "yes" ]; then \
			mkdir -p $(modules-prefix)/$(lib-dir)/openserctl ; \
			sed -e "s#/usr/local#$(bin-target)#g" \
				< scripts/openserctl.pgsql > /tmp/openserctl.pgsql ; \
			$(INSTALL-CFG) /tmp/openserctl.pgsql \
				$(modules-prefix)/$(lib-dir)/openserctl/openserctl.pgsql ; \
			rm -fr /tmp/openserctl.pgsql ; \
			sed -e "s#PATH:/usr/local/sbin#PATH:$(bin-target)#g" \
				< scripts/postgresqldb.sh > /tmp/$(NAME)_postgresql.sh ; \
			$(INSTALL-TOUCH) $(bin-prefix)/$(bin-dir)/$(NAME)_postgresql.sh ; \
			$(INSTALL-BIN) /tmp/$(NAME)_postgresql.sh \
				$(bin-prefix)/$(bin-dir) ; \
			rm -fr /tmp/$(NAME)_postgresql.sh ; \
		fi


install-doc: $(doc-prefix)/$(doc-dir) install-modules-doc
	$(INSTALL-TOUCH) $(doc-prefix)/$(doc-dir)/INSTALL 
	$(INSTALL-DOC) INSTALL $(doc-prefix)/$(doc-dir)
	$(INSTALL-TOUCH) $(doc-prefix)/$(doc-dir)/README-MODULES 
	$(INSTALL-DOC) README-MODULES $(doc-prefix)/$(doc-dir)
	$(INSTALL-TOUCH) $(doc-prefix)/$(doc-dir)/AUTHORS 
	$(INSTALL-DOC) AUTHORS $(doc-prefix)/$(doc-dir)
	$(INSTALL-TOUCH) $(doc-prefix)/$(doc-dir)/NEWS
	$(INSTALL-DOC) NEWS $(doc-prefix)/$(doc-dir)
	$(INSTALL-TOUCH) $(doc-prefix)/$(doc-dir)/README 
	$(INSTALL-DOC) README $(doc-prefix)/$(doc-dir)


install-modules-doc: $(doc-prefix)/$(doc-dir)
	-@for r in $(modules_basenames) "" ; do \
		if [ -n "$$r" ]; then \
			if [ -f modules/"$$r"/README ]; then \
				$(INSTALL-TOUCH)  $(doc-prefix)/$(doc-dir)/README ; \
				$(INSTALL-DOC)  modules/"$$r"/README  \
									$(doc-prefix)/$(doc-dir)/README ; \
				mv -f $(doc-prefix)/$(doc-dir)/README \
						$(doc-prefix)/$(doc-dir)/README."$$r" ; \
			fi ; \
		fi ; \
	done 


install-man: $(man-prefix)/$(man-dir)/man8 $(man-prefix)/$(man-dir)/man5
		sed -e "s#/etc/$(NAME)/$(NAME)\.cfg#$(cfg-target)$(NAME).cfg#g" \
			-e "s#/usr/sbin/#$(bin-target)#g" \
			-e "s#/usr/lib/$(NAME)/modules/#$(modules-target)#g" \
			-e "s#/usr/share/doc/$(NAME)/#$(doc-target)#g" \
			< $(NAME).8 >  $(man-prefix)/$(man-dir)/man8/$(NAME).8
		chmod 644  $(man-prefix)/$(man-dir)/man8/$(NAME).8
		sed -e "s#/etc/$(NAME)/$(NAME)\.cfg#$(cfg-target)$(NAME).cfg#g" \
			-e "s#/usr/sbin/#$(bin-target)#g" \
			-e "s#/usr/lib/$(NAME)/modules/#$(modules-target)#g" \
			-e "s#/usr/share/doc/$(NAME)/#$(doc-target)#g" \
			< $(NAME).cfg.5 >  $(man-prefix)/$(man-dir)/man5/$(NAME).cfg.5
		chmod 644  $(man-prefix)/$(man-dir)/man5/$(NAME).cfg.5
		sed -e "s#/etc/$(NAME)/$(NAME)\.cfg#$(cfg-target)$(NAME).cfg#g" \
			-e "s#/usr/sbin/#$(bin-target)#g" \
			-e "s#/usr/lib/$(NAME)/modules/#$(modules-target)#g" \
			-e "s#/usr/share/doc/$(NAME)/#$(doc-target)#g" \
			< scripts/openserctl.8 > $(man-prefix)/$(man-dir)/man8/openserctl.8
		chmod 644  $(man-prefix)/$(man-dir)/man8/openserctl.8
		sed -e "s#/etc/$(NAME)/$(NAME)\.cfg#$(cfg-target)$(NAME).cfg#g" \
			-e "s#/usr/sbin/#$(bin-target)#g" \
			-e "s#/usr/lib/$(NAME)/modules/#$(modules-target)#g" \
			-e "s#/usr/share/doc/$(NAME)/#$(doc-target)#g" \
			< utils/openserunix/openserunix.8 > \
			$(man-prefix)/$(man-dir)/man8/openserunix.8
		chmod 644  $(man-prefix)/$(man-dir)/man8/openserunix.8

install-modules-docbook: $(doc-prefix)/$(doc-dir)
	-@for r in $(modules_basenames) "" ; do \
		if [ -n "$$r" ]; then \
			if [ -d modules/"$$r"/doc ]; then \
				if [ -f modules/"$$r"/doc/"$$r".txt ]; then \
					$(INSTALL-TOUCH)  $(doc-prefix)/$(doc-dir)/"$$r".txt ; \
					$(INSTALL-DOC)  modules/"$$r"/doc/"$$r".txt  \
									$(doc-prefix)/$(doc-dir)/"$$r".txt ; \
				fi ; \
				if [ -f modules/"$$r"/doc/"$$r".html ]; then \
					$(INSTALL-TOUCH)  $(doc-prefix)/$(doc-dir)/"$$r".html ; \
					$(INSTALL-DOC)  modules/"$$r"/doc/"$$r".html  \
									$(doc-prefix)/$(doc-dir)/"$$r".html ; \
				fi ; \
				if [ -f modules/"$$r"/doc/"$$r".pdf ]; then \
					$(INSTALL-TOUCH)  $(doc-prefix)/$(doc-dir)/"$$r".pdf ; \
					$(INSTALL-DOC)  modules/"$$r"/doc/"$$r".pdf  \
									$(doc-prefix)/$(doc-dir)/"$$r".pdf ; \
				fi ; \
			fi ; \
		fi ; \
	done