forked from OpenSIPS/opensips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
724 lines (637 loc) · 22.3 KB
/
Makefile
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
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
#
# OpenSIPS 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 opensips.cfg - patch provided
# by Maxim Sobolev <sobomax@FreeBSD.org> and
# Tomas Bjoerklund <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/opensips/modules)
# opensips.cfg.default is installed only if there is a previous
# cfg. -- fixes packages containing opensips.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
# 2007-09-28 added db_berkeley (wiquan)
#
#SQLITE_BIND=1
NICER?=1
auto_gen=lex.yy.c cfg.tab.c #lexx, yacc etc
# whether or not to install opensips.cfg or just opensips.cfg.default
# (opensips.cfg will never be overwritten by make install, this is useful
# when creating packages)
skip_cfg_install?=
#extra modules to exclude
skip_modules?=
# whether or not to overwrite TLS certificates
tls_overwrite_certs?=
# default debian version when running 'make deb'
DEBIAN_VERSION ?= jessie #TODO: can we determine this?
makefile_defs=0
DEFS:= $(DEFS_EXTRA_OPTS)
DEBUG_PARSER?=
# json libs check
ifeq ($(JSONPATH),)
ifneq ("$(wildcard /usr/include/json-c/json.h)","")
DEFS += -I/usr/include/json-c
else
DEFS += -I/usr/include/json
endif
else
DEFS += -I$(JSONPATH)
endif
# create the template only if the file is not yet created
ifeq (,$(wildcard Makefile.conf))
$(shell cp Makefile.conf.template Makefile.conf)
endif
include Makefile.conf
ifneq (,$(findstring SHM_EXTRA_STATS, $(DEFS)))
MEM_STATS_HDR = mem/mem_stats.h
deps_gen += $(MEM_STATS_HDR)
auto_gen += mem/mem_stats.c
endif
ifneq (,$(findstring DBG_STRUCT_HIST,$(DEFS)))
dbg_objs=lib/dbg/struct_hist.c
else
dbg_objs=
endif
include Makefile.sources
include Makefile.defs
# always exclude the SVN dir
override exclude_modules+= .svn $(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
# If modules is supplied, only do those. If not, use all modules when
# building documentation.
ifeq ($(modules),)
doc_modules=$(all_modules)
else
doc_modules=$(modules)
endif
# Take subset of all modules, excluding the exclude_modules and the
# static_modules.
modules=$(filter-out $(addprefix modules/, \
$(exclude_modules) $(static_modules)), \
$(wildcard modules/*))
# Let modules consist of modules and include_modules (but remove
# duplicates).
modules:=$(filter-out $(modules), $(addprefix modules/, $(include_modules) )) \
$(modules)
ifneq ($(module),)
modules:=$(addprefix modules/, $(module))
endif
modules_names=$(patsubst modules/%, %.so, $(modules))
modules_basenames=$(patsubst modules/%, %, $(modules))
modules_full_path=$(join $(modules), $(addprefix /, $(modules_names)))
ALLDEP=Makefile Makefile.sources Makefile.defs Makefile.rules Makefile.conf $(deps_gen)
install_docs := README-MODULES AUTHORS NEWS README
ifneq ($(skip-install-doc),yes)
install_docs += INSTALL
endif
#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)
#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 RADIUS_LIB
export LEX LEX_FLAGS YACC YACC_FLAGS
export PREFIX LOCALBASE SYSBASE
# 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 lib_dir
export cfg_target modules_target data_dir data_prefix data_target
export INSTALL INSTALL_CFG INSTALL_BIN INSTALL_MODULES INSTALL_DOC INSTALL_MAN
export INSTALL_TOUCH
# extra excludes for tar
tar_extra_args+=
# include the common rules
include Makefile.rules
#extra targets
$(NAME): $(extra_objs) # static_modules
lex.yy.c: cfg.lex cfg.tab.h $(ALLDEP)
ifeq (,$(FASTER))
@echo "Generating lexer"
endif
$(Q)$(LEX) $(LEX_FLAGS) $<
cfg.tab.c cfg.tab.h: cfg.y $(ALLDEP)
ifeq (,$(FASTER))
@echo "Generating parser"
endif
$(Q)$(YACC) $(YACC_FLAGS) $<
.PHONY: all
all: $(NAME) modules utils
.PHONY: app
app: $(NAME)
.PHONY: _modules
_modules: $(modules)
.PHONY: $(modules)
$(modules):
@$(MAKE) --no-print-directory -C $@ && \
echo "Building $(notdir $@) module succeeded" || (\
status=$$?; \
echo "ERROR: Building $(notdir $@) module failed!"; \
exit $$status; \
)
.PHONY: modules
modules: $(deps_gen)
ifeq (,$(FASTER))
@set -e; \
for r in $(modules) "" ; do \
if [ -n "$$r" ]; then \
if [ -d "$$r" ]; then \
echo "" ; \
echo "" ; \
$(MAKE) -j -C $$r ; \
fi ; \
fi ; \
done
else
@$(MAKE) _modules || ( \
status=$$?; \
if echo $(MAKEFLAGS) | grep -q -- --jobserver; then \
printf '\nBuilding one or more modules failed!\n'; \
printf 'Please re-run make without -j / --jobs to find out which.\n\n'; \
fi; \
exit $$status \
)
endif
.PHONY: tool-docbook2pdf
tool-docbook2pdf:
@if [ -z "$(DBXML2PDF)" ]; then \
echo "error: docbook2pdf not found"; exit 1; \
fi
.PHONY: tool-lynx
tool-lynx:
@if [ -z "$(DBHTML2TXT)" ]; then \
echo "error: lynx not found"; exit 1; \
fi
.PHONY: tool-xsltproc
tool-xsltproc:
@if [ -z "$(DBXML2HTML)" ]; then \
echo "error: xsltproc not found"; exit 1; \
fi
@if [ -z "$(DBHTMLXSL)" ]; then \
echo "error: docbook.xsl not found (docbook-xsl)"; exit 1; \
fi
.PHONY: modules-readme
modules-readme: tool-lynx tool-xsltproc
@set -e; \
for mod in $(doc_modules); do \
r=`basename $$mod`;\
echo "Reading directory $$mod for module $$r";\
if [ ! -d "$$mod/doc" ]; then \
continue; \
fi; \
cd "$$mod/doc"; \
if [ -f "$$r".xml ]; then \
echo "docbook xml to html: $$r.xml"; \
$(DBXML2HTML) -o $$r.html $(DBXML2HTMLPARAMS) $(DBHTMLXSL) \
$$r.xml; \
echo "docbook html to txt: $$r.html"; \
$(DBHTML2TXT) $(DBHTML2TXTPARAMS) $$r.html >$$r.txt; \
echo "docbook txt to readme: $$r.txt"; \
rm $$r.html; \
mv $$r.txt ../README; \
echo ""; \
fi; \
cd ../../..; \
done
.PHONY: modules-docbook-txt
modules-docbook-txt: tool-lynx tool-xsltproc
@set -e; \
for mod in $(doc_modules); do \
r=`basename $$mod`;\
echo "Reading directory $$mod for module $$r";\
if [ ! -d "$$mod/doc" ]; then \
continue; \
fi; \
cd "$$mod/doc"; \
if [ -f "$$r".xml ]; then \
echo ""; \
echo "docbook xml to html: $$r.xml"; \
$(DBXML2HTML) -o $$r.html $(DBXML2HTMLPARAMS) $(DBHTMLXSL) \
$$r.xml; \
echo "docbook html to txt: $$r.html"; \
$(DBHTML2TXT) $(DBHTML2TXTPARAMS) $$r.html >$$r.txt; \
rm $$r.html; \
echo ""; \
fi; \
cd ../../..; \
done
.PHONY: modules-docbook-html
modules-docbook-html: tool-xsltproc
@set -e; \
for mod in $(doc_modules); do \
r=`basename $$mod`;\
echo "Reading directory $$mod for module $$r";\
if [ ! -d "$$mod/doc" ]; then \
continue; \
fi; \
cd "$$mod/doc"; \
if [ -f "$$r".xml ]; then \
echo ""; \
echo "docbook xml to html: $$r.xml"; \
$(DBXML2HTML) -o $$r.html $(DBXML2HTMLPARAMS) $(DBHTMLXSL) \
$$r.xml; \
echo ""; \
fi; \
cd ../../..; \
done
.PHONY: modules-docbook-pdf
modules-docbook-pdf: tool-docbook2pdf
@set -e; \
for mod in $(doc_modules); do \
r=`basename $$mod`;\
echo "Reading directory $$mod for module $$r";\
if [ ! -d "$$mod/doc" ]; then \
continue; \
fi; \
cd "$$mod/doc"; \
if [ -f "$$r".xml ]; then \
echo ""; \
echo "docbook xml to pdf: $$r.xml"; \
$(DBXML2PDF) "$$r".xml; \
fi; \
cd ../../..; \
done
.PHONY: modules-docbook
modules-docbook: modules-docbook-txt modules-docbook-html modules-docbook-pdf
.PHONY: dbschema-docbook-txt
dbschema-docbook-txt: dbschema
@set -e; \
for r in $(wildcard doc/database/*.sgml) "" ; do \
if [ -f "$$r" ]; then \
echo "" ; \
echo "docbook2txt $$r" ; \
docbook2txt -o "doc/database/" "$$r" ; \
fi ; \
done
.PHONY: dbschema-docbook-html
dbschema-docbook-html: dbschema
@set -e; \
for r in $(wildcard doc/database/*.sgml) "" ; do \
if [ -f "$$r" ]; then \
echo "" ; \
echo "docbook2html $$r" ; \
docbook2html --nochunks -o "doc/database/" "$$r" ; \
fi ; \
done
.PHONY: dbschema-docbook-pdf
dbschema-docbook-pdf: dbschema
@set -e; \
for r in $(wildcard doc/database/*.sgml) "" ; do \
if [ -f "$$r" ]; then \
echo "" ; \
echo "docbook2pdf $$r" ; \
docbook2pdf -o "doc/database/" "$$r" ; \
fi ; \
done
.PHONY: dbschema-docbook
dbschema-docbook: dbschema-docbook-txt dbschema-docbook-html dbschema-docbook-pdf
$(extra_objs):
-@echo "Extra objs: $(extra_objs)"
@set -e; \
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: $(NEWREVISION)
$(TAR) -C .. \
--exclude=$(notdir $(CURDIR))/tmp* \
--exclude=$(notdir $(CURDIR))/debian* \
--exclude=.svn* \
--exclude=.git \
--exclude=.gitignore \
--exclude=Makefile.conf \
--exclude=*.[do] \
--exclude=*.so \
--exclude=*.il \
--exclude=$(notdir $(CURDIR))/$(NAME) \
--exclude=*.gz \
--exclude=*.bz2 \
--exclude=*.tar \
--exclude=*.patch \
--exclude=.\#* \
--exclude=*.swp \
--exclude=*~ \
${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-orig-tar
deb-orig-tar: tar
mv "$(NAME)-$(RELEASE)_src".tar.gz ../$(NAME)_$(RELEASE:-dev=).orig.tar.gz
.PHONY: deb
deb:
rm -rf debian
# dpkg-source cannot use links for debian source
cp -r packaging/debian debian
dpkg-buildpackage \
-I.git -I.gitignore \
-I*.swp -I*~ \
-i\\.git\|debian\|^\\.\\w+\\.swp\|lex\\.yy\\.c\|cfg\\.tab\\.\(c\|h\)\|\\w+\\.patch \
-rfakeroot -tc $(DEBBUILD_EXTRA_OPTIONS)
rm -rf 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 \
OpenSIPS
gzip -9 ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local
rm -rf tmp/$(NAME)
rm -rf tmp/$(NAME)_sun_pkg
.PHONY: install-app install-modules-all install
# Install app only, excluding console, modules and module docs
install-app: app mk-install-dirs install-cfg install-bin \
install-app-doc install-man
# Install all module stuff (except modules-docbook?)
install-modules-all: install-modules install-modules-doc
# Install everything (except modules-docbook?)
install: install-app install-console install-modules-all
opensipsmc: $(cfg_prefix)/$(cfg_dir) $(data_prefix)/$(data_dir)
$(MAKE) -C menuconfig proper
$(MAKE) -C menuconfig \
MENUCONFIG_CFG_PATH=$(data_target)/menuconfig_templates/ \
MENUCONFIG_GEN_PATH=$(cfg_target) MENUCONFIG_HAVE_SOURCES=0
mkdir -p $(data_prefix)/$(data_dir)/menuconfig_templates/
$(INSTALL_TOUCH) menuconfig/configs/* $(data_prefix)/$(data_dir)/menuconfig_templates/
$(INSTALL_CFG) menuconfig/configs/* $(data_prefix)/$(data_dir)/menuconfig_templates/
sed -i -e "s#/usr/.*lib/$(NAME)/modules/#$(modules_target)#" \
$(data_prefix)/$(data_dir)/menuconfig_templates/*
.PHONY: dbschema
dbschema:
-@echo "Build database schemas"
$(MAKE) -C db/schema
-@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 \
$(data_prefix)/$(data_dir)
# 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
umask 0077; sed -e "s#/usr/.*etc/$(NAME)/tls/#$(cfg_target)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
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
# opensipsctl config
$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/opensipsctlrc.sample
$(INSTALL_CFG) scripts/opensipsctlrc \
$(cfg_prefix)/$(cfg_dir)/opensipsctlrc.sample
if [ ! -f $(cfg_prefix)/$(cfg_dir)/opensipsctlrc ]; then \
mv -f $(cfg_prefix)/$(cfg_dir)/opensipsctlrc.sample \
$(cfg_prefix)/$(cfg_dir)/opensipsctlrc; \
fi
# osipsconsole config
$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/osipsconsolerc.sample
$(INSTALL_CFG) scripts/osipsconsolerc \
$(cfg_prefix)/$(cfg_dir)/osipsconsolerc.sample
if [ ! -f $(cfg_prefix)/$(cfg_dir)/osipsconsolerc ]; then \
mv -f $(cfg_prefix)/$(cfg_dir)/osipsconsolerc.sample \
$(cfg_prefix)/$(cfg_dir)/osipsconsolerc; \
fi
install-console: $(bin_prefix)/$(bin_dir)
# install osipsconsole
cat scripts/osipsconsole | \
sed -e "s#PATH_BIN[ \t]*=[ \t]*\"\./\"#PATH_BIN = \"$(bin-target)\"#g" | \
sed -e "s#PATH_CTLRC[ \t]*=[ \t]*\"\./scripts/\"#PATH_CTLRC = \"$(cfg_target)\"#g" | \
sed -e "s#PATH_LIBS[ \t]*=[ \t]*\"\./scripts/\"#PATH_LIBS = \"$(lib-target)/opensipsctl/\"#g" | \
sed -e "s#PATH_SHARE[ \t]*=[ \t]*\"\./scripts/\"#PATH_SHARE = \"$(data_target)\"#g" | \
sed -e "s#PATH_ETC[ \t]*=[ \t]*\"\./etc/\"#PATH_ETC = \"$(cfg_target)\"#g" \
> /tmp/osipsconsole
$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/osipsconsole
$(INSTALL_BIN) /tmp/osipsconsole $(bin_prefix)/$(bin_dir)
rm -fr /tmp/osipsconsole
install-bin: $(bin_prefix)/$(bin_dir) opensipsmc utils
# install opensips binary
$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/$(NAME)
$(INSTALL_BIN) $(NAME) $(bin_prefix)/$(bin_dir)
# install opensips menuconfig
$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/osipsconfig
$(INSTALL_BIN) menuconfig/configure $(bin_prefix)/$(bin_dir)/osipsconfig
# install opensipsctl (and family) tool
cat scripts/opensipsctl | \
sed -e "s#/usr/local/sbin#$(bin-target)#g" | \
sed -e "s#/usr/local/lib/opensips#$(lib-target)#g" | \
sed -e "s#/usr/local/etc/opensips#$(cfg_target)#g" >/tmp/opensipsctl
$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/opensipsctl
$(INSTALL_BIN) /tmp/opensipsctl $(bin_prefix)/$(bin_dir)
rm -fr /tmp/opensipsctl
sed -e "s#/usr/local/sbin#$(bin-target)#g" \
< scripts/opensipsctl.base > /tmp/opensipsctl.base
mkdir -p $(modules_prefix)/$(lib_dir)/opensipsctl
$(INSTALL_TOUCH) \
$(modules_prefix)/$(lib_dir)/opensipsctl
$(INSTALL_CFG) /tmp/opensipsctl.base \
$(modules_prefix)/$(lib_dir)/opensipsctl/opensipsctl.base
rm -fr /tmp/opensipsctl.base
sed -e "s#/usr/local#$(bin-target)#g" \
< scripts/opensipsctl.ctlbase > /tmp/opensipsctl.ctlbase
$(INSTALL_CFG) /tmp/opensipsctl.ctlbase \
$(modules_prefix)/$(lib_dir)/opensipsctl/opensipsctl.ctlbase
rm -fr /tmp/opensipsctl.ctlbase
sed -e "s#/usr/local#$(bin-target)#g" \
< scripts/opensipsctl.fifo > /tmp/opensipsctl.fifo
$(INSTALL_CFG) /tmp/opensipsctl.fifo \
$(modules_prefix)/$(lib_dir)/opensipsctl/opensipsctl.fifo
rm -fr /tmp/opensipsctl.fifo
sed -e "s#/usr/local#$(bin-target)#g" \
< scripts/opensipsctl.unixsock > /tmp/opensipsctl.unixsock
$(INSTALL_CFG) /tmp/opensipsctl.unixsock \
$(modules_prefix)/$(lib_dir)/opensipsctl/opensipsctl.unixsock
rm -fr /tmp/opensipsctl.unixsock
sed -e "s#/usr/local#$(bin-target)#g" \
< scripts/opensipsctl.sqlbase > /tmp/opensipsctl.sqlbase
$(INSTALL_CFG) /tmp/opensipsctl.sqlbase \
$(modules_prefix)/$(lib_dir)/opensipsctl/opensipsctl.sqlbase
rm -fr /tmp/opensipsctl.sqlbase
# install db setup base script
sed -e "s#/usr/local/sbin#$(bin-target)#g" \
-e "s#/usr/local/etc/opensips#$(cfg_target)#g" \
-e "s#/usr/local/share/opensips#$(data_target)#g" \
< scripts/opensipsdbctl.base > /tmp/opensipsdbctl.base
$(INSTALL_CFG) /tmp/opensipsdbctl.base \
$(modules_prefix)/$(lib_dir)/opensipsctl/opensipsdbctl.base
rm -fr /tmp/opensipsdbctl.base
cat scripts/opensipsdbctl | \
sed -e "s#/usr/local/sbin#$(bin-target)#g" | \
sed -e "s#/usr/local/lib/opensips#$(lib-target)#g" | \
sed -e "s#/usr/local/etc/opensips#$(cfg_target)#g" >/tmp/opensipsdbctl
$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/opensipsdbctl
$(INSTALL_BIN) /tmp/opensipsdbctl $(bin_prefix)/$(bin_dir)
rm -fr /tmp/opensipsdbctl
$(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
if [ "$(BERKELEYDBON)" = "yes" ]; then \
cd utils/db_berkeley; $(MAKE) all ; \
fi ;
if [ "$(ORACLEON)" = "yes" ]; then \
cd utils/db_oracle; $(MAKE) all ; \
fi ;
install-modules: modules $(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) ; \
$(MAKE) -C `dirname "$$r"` install_module_custom ; \
else \
echo "ERROR: module $$r not compiled" ; \
fi ;\
fi ; \
done
.PHONY: install-doc install-app-doc install-modules-doc
install-doc: install-app-doc install-modules-doc
install-app-doc: $(doc_prefix)/$(doc_dir)
-@for d in $(install_docs) ""; do \
if [ -n "$$d" ]; then \
$(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)/"$$d" ; \
$(INSTALL_DOC) "$$d" $(doc_prefix)/$(doc_dir) ; \
fi ; \
done
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."$$r" ; \
$(INSTALL_DOC) modules/"$$r"/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/opensipsctl.8 > $(man_prefix)/$(man_dir)/man8/opensipsctl.8
chmod 644 $(man_prefix)/$(man_dir)/man8/opensipsctl.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/opensipsunix/opensipsunix.8 > \
$(man_prefix)/$(man_dir)/man8/opensipsunix.8
chmod 644 $(man_prefix)/$(man_dir)/man8/opensipsunix.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
.PHONY: test
test:
-@echo "Start tests"
$(MAKE) -C test/
-@echo "Tests finished"
doxygen:
-@echo "Create Doxygen documentation"
# disable call graphes, because of the DOT dependencies
(cat doc/doxygen/opensips-doxygen; \
echo "HAVE_DOT=no" ;\
echo "PROJECT_NUMBER=$(NAME)-$(RELEASE)" )| doxygen -
-@echo "Doxygen documentation created"
comp_menuconfig:
$(MAKE) -C menuconfig
menuconfig: comp_menuconfig
./menuconfig/configure --local