| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
req_ver=3.81 |
| 13 |
|
| 14 |
|
| 15 |
ifeq (,$(filter $(req_ver),$(firstword $(sort $(MAKE_VERSION) $(req_ver))))) |
| 16 |
$(error make version $(MAKE_VERSION) not supported, use at least $(req_ver)) |
| 17 |
endif |
| 18 |
|
| 19 |
|
| 20 |
auto_gen=core/lex.yy.c core/cfg.tab.c #lexx, yacc etc |
| 21 |
auto_gen_others=core/cfg.tab.h # auto generated, non-c |
| 22 |
auto_gen_keep=core/autover.h # auto generated, should be included in archives |
| 23 |
|
| 24 |
COREPATH=. |
| 25 |
|
| 26 |
include Makefile.sources |
| 27 |
|
| 28 |
include Makefile.targets |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
err_fail?=1 |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
skip_cfg_install?= |
| 38 |
|
| 39 |
|
| 40 |
skip_modules?= |
| 41 |
|
| 42 |
|
| 43 |
include Makefile.dirs |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
doc_format?=html |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
ifeq (,$(strip $(filter-out $(clean_targets) $(aux_targets),$(MAKECMDGOALS)))) |
| 52 |
ifneq (,$(strip $(wildcard modules.lst))) |
| 53 |
-include modules.lst |
| 54 |
endif |
| 55 |
else |
| 56 |
include modules.lst |
| 57 |
endif |
| 58 |
|
| 59 |
|
| 60 |
ifneq ($(group_include),) |
| 61 |
include_modules= |
| 62 |
exclude_modules= |
| 63 |
modules_configured:=0 |
| 64 |
endif |
| 65 |
|
| 66 |
|
| 67 |
include Makefile.groups |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
ifneq ($(group_include)$(cfg_group_include),) |
| 73 |
# For group_include, default all modules are excluded except those in |
| 74 |
# include_modules |
| 75 |
exclude_modules?= |
| 76 |
else |
| 77 |
# Old defaults for backwards compatibility |
| 78 |
# excluded because they depend on external libraries |
| 79 |
ifeq ($(origin exclude_modules), undefined) |
| 80 |
exclude_modules:= $(sort \ |
| 81 |
$(filter-out $(module_group_default), $(mod_list_all))) |
| 82 |
endif |
| 83 |
endif |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
ifneq (,$(group_include)) |
| 90 |
$(eval override include_modules+= $(foreach grp, $(group_include), \ |
| 91 |
$(module_group_$(grp)) )) |
| 92 |
endif |
| 93 |
|
| 94 |
ALLDEP=config.mak Makefile Makefile.dirs Makefile.sources Makefile.rules |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
ifeq (,$(strip \ |
| 106 |
$(filter config.mak config cfg cfg-defs $(clean_targets),$(MAKECMDGOALS)))) |
| 107 |
include config.mak |
| 108 |
ifeq ($(makefile_defs),1) |
| 109 |
ifeq ($(quiet),verbose) |
| 110 |
$(info config.mak loaded) |
| 111 |
endif |
| 112 |
export makefile_defs |
| 113 |
|
| 114 |
config_mak=1 |
| 115 |
ifeq ($(MAIN_NAME),) |
| 116 |
$(error "bad config.mak, try re-running make cfg") |
| 117 |
endif |
| 118 |
endif |
| 119 |
else |
| 120 |
ifneq (,$(filter cfg config cfg-defs,$(word 1,$(MAKECMDGOALS)))) |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
$(shell rm -rf config.mak) |
| 127 |
config_mak=0 |
| 128 |
makefile_defs=0 |
| 129 |
exported_vars=0 |
| 130 |
else |
| 131 |
|
| 132 |
config_mak=skip |
| 133 |
-include config.mak |
| 134 |
export makefile_defs |
| 135 |
endif |
| 136 |
endif |
| 137 |
|
| 138 |
|
| 139 |
main_makefile=1 |
| 140 |
include Makefile.defs |
| 141 |
|
| 142 |
static_modules_path=$(addprefix modules/, $(static_modules)) |
| 143 |
extra_sources=$(wildcard $(addsuffix /*.c, $(static_modules_path))) |
| 144 |
extra_objs=$(extra_sources:.c=.o) |
| 145 |
|
| 146 |
static_defs:= $(foreach mod, $(static_modules), \ |
| 147 |
-DSTATIC_$(shell echo $(mod) | tr [:lower:] [:upper:]) ) |
| 148 |
|
| 149 |
override extra_defs+=$(static_defs) $(EXTRA_DEFS) |
| 150 |
export extra_defs |
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
ifneq ($(modules_configured),1) |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
$(foreach mods,$(modules_dirs),$(eval \ |
| 162 |
$(mods)_all=$$(filter-out $(mods)/CMakeLists.txt, \ |
| 163 |
$$(wildcard $(mods)/*)))) |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
ifneq ($(group_include),) |
| 168 |
$(foreach mods,$(modules_dirs),$(eval \ |
| 169 |
$(mods)=$$(filter-out $$(addprefix $(mods)/, \ |
| 170 |
$$(exclude_modules) $$(static_modules)), \ |
| 171 |
$$(addprefix $(mods)/, $$(include_modules) )) )) |
| 172 |
else |
| 173 |
# Standard, old resultant set |
| 174 |
$(foreach mods,$(modules_dirs),$(eval \ |
| 175 |
$(mods)_noinc=$$(filter-out $$(addprefix $(mods)/, \ |
| 176 |
$$(exclude_modules) $$(static_modules)), $$($(mods)_all)) \ |
| 177 |
)) |
| 178 |
$(foreach mods,$(modules_dirs),$(eval \ |
| 179 |
$(mods)=$$(filter-out $$(modules_noinc), \ |
| 180 |
$$(addprefix $(mods)/, $$(include_modules) )) $$($(mods)_noinc) \ |
| 181 |
)) |
| 182 |
endif |
| 183 |
endif |
| 184 |
|
| 185 |
$(foreach mods,$(modules_dirs),$(eval \ |
| 186 |
$(mods)_names=$$(shell echo $$($(mods))| \ |
| 187 |
sed -e "s/$(mods)"'\/\([^/ ]*\)\/*/\1.so/g' ) \ |
| 188 |
)) |
| 189 |
$(foreach mods,$(modules_dirs),$(eval \ |
| 190 |
$(mods)_basenames:=$$(shell echo $$($(mods))| \ |
| 191 |
sed -e "s/$(mods)"'\/\([^/ ]*\)\/*/\1/g' ) \ |
| 192 |
)) |
| 193 |
|
| 194 |
|
| 195 |
all_modules_lst=$(foreach mods,$(modules_dirs), $($(mods)_all)) |
| 196 |
|
| 197 |
|
| 198 |
cmodules=$(foreach mods,$(modules_dirs), $($(mods))) |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
C_COMPILE_UTILS= # kamcmd is now installed by ctl |
| 207 |
|
| 208 |
|
| 209 |
C_INSTALL_BIN= # kamcmd is now installed by ctl |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
ifeq ($(FLAVOUR),kamailio) |
| 214 |
C_INSTALL_UTILS= ../utils/kamctl |
| 215 |
else |
| 216 |
C_INSTALL_UTILS= |
| 217 |
endif |
| 218 |
|
| 219 |
|
| 220 |
C_INSTALL_SCRIPTS= |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
C_INSTALL_CFGS= |
| 225 |
|
| 226 |
|
| 227 |
C_INSTALL_SHARE= |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
NAME=$(MAIN_NAME) |
| 233 |
|
| 234 |
tar_name=$(NAME)-$(RELEASE)_src |
| 235 |
|
| 236 |
tar_extra_args+=$(addprefix --exclude=$(notdir $(CURDIR))/, \ |
| 237 |
$(auto_gen) $(auto_gen_others)) |
| 238 |
ifeq ($(CORE_TLS), 1) |
| 239 |
tar_extra_args+= |
| 240 |
else |
| 241 |
tar_extra_args+=--exclude=$(notdir $(CURDIR))/tls/* |
| 242 |
endif |
| 243 |
|
| 244 |
ifneq ($(nodeb),) |
| 245 |
tar_extra_args+=--exclude=$(notdir $(CURDIR))/debian |
| 246 |
tar_name:=$(tar_name)_nodeb |
| 247 |
endif |
| 248 |
|
| 249 |
|
| 250 |
ifneq ($(TLS),) |
| 251 |
$(warning "make TLS option is obsoleted, try TLS_HOOKS or CORE_TLS") |
| 252 |
endif |
| 253 |
|
| 254 |
|
| 255 |
include Makefile.rules |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
$(NAME): $(extra_objs) |
| 260 |
|
| 261 |
core/lex.yy.c: core/cfg.lex core/cfg.tab.h $(ALLDEP) |
| 262 |
$(LEX) -o core/lex.yy.c $< |
| 263 |
|
| 264 |
core/cfg.tab.c: core/cfg.tab.h |
| 265 |
core/cfg.tab.h: core/cfg.y $(ALLDEP) |
| 266 |
$(YACC) $(YACC_FLAGS) $< |
| 267 |
|
| 268 |
nullstring= |
| 269 |
space=$(nullstring) $(nullstring) |
| 270 |
|
| 271 |
modules_search_path=$(subst $(space),:,$(strip\ |
| 272 |
$(foreach m,$(modules_dirs),$($(m)_target)))) |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
main.o: DEFS+=-DMODS_DIR='"$(modules_search_path)"' |
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
core/ver.d core/ver.o: core/autover.h |
| 281 |
|
| 282 |
include Makefile.shared |
| 283 |
|
| 284 |
ifeq ($(config_mak),1) |
| 285 |
|
| 286 |
include Makefile.cfg |
| 287 |
|
| 288 |
|
| 289 |
ifneq (,$(basedir)) |
| 290 |
ifeq (,$(filter /%, $(basedir))) |
| 291 |
override basedir:=$(CURDIR)/$(basedir) |
| 292 |
|
| 293 |
MAKEOVERRIDES:=$(filter-out basedir=%,$ $(MAKEOVERRIDES)) |
| 294 |
endif |
| 295 |
endif |
| 296 |
|
| 297 |
else ifneq ($(config_mak),skip) |
| 298 |
|
| 299 |
config.mak: Makefile.defs Makefile.groups |
| 300 |
@echo making config... |
| 301 |
@echo "# this file is autogenerated by make cfg" >$@ |
| 302 |
@$(call mapf2,cfg_save_var,saved_fixed_vars,$(@)) |
| 303 |
@$(call mapf2,cfg_save_var2,saved_chg_vars,$(@)) |
| 304 |
@echo "override makefile_defs:=1" >>$@ |
| 305 |
@echo "C_DEFS:=\$$(filter-out \$$(DEFS_RM) \$$(extra_defs),\$$(C_DEFS))" \ |
| 306 |
"\$$(extra_defs)" >>$@ |
| 307 |
@echo "CFLAGS:=\$$(filter-out \$$(CFLAGS_RM) \$$(CC_EXTRA_OPTS)," \ |
| 308 |
"\$$(CFLAGS)) \$$(CC_EXTRA_OPTS)" >>$@ |
| 309 |
|
| 310 |
endif |
| 311 |
|
| 312 |
modules.lst: Makefile.groups |
| 313 |
@echo saving modules list... |
| 314 |
@echo "# this file is autogenerated by make modules-cfg" >$@ |
| 315 |
@echo >>$@ |
| 316 |
@echo "# the list of sub-directories with modules" >>$@ |
| 317 |
@echo "modules_dirs:=$(modules_dirs)" >>$@ |
| 318 |
@echo >>$@ |
| 319 |
@echo "# the list of module groups to compile" >>$@ |
| 320 |
@echo "cfg_group_include=$(group_include)" >>$@ |
| 321 |
@echo >>$@ |
| 322 |
@echo "# the list of extra modules to compile" >>$@ |
| 323 |
@$(call cfg_save_var2,include_modules,$@) |
| 324 |
@echo >>$@ |
| 325 |
@echo "# the list of static modules" >>$@ |
| 326 |
@$(call cfg_save_var2,static_modules,$@) |
| 327 |
@echo >>$@ |
| 328 |
@echo "# the list of modules to skip from compile list" >>$@ |
| 329 |
@$(call cfg_save_var2,skip_modules,$@) |
| 330 |
@echo >>$@ |
| 331 |
@echo "# the list of modules to exclude from compile list" >>$@ |
| 332 |
@$(call cfg_save_var3,exclude_modules,skip_modules,$@) |
| 333 |
@echo >>$@ |
| 334 |
@$(foreach mods,$(modules_dirs), \ |
| 335 |
$(call cfg_save_var2,$(mods)_all,$@)) |
| 336 |
@$(foreach mods,$(modules_dirs), \ |
| 337 |
$(call cfg_save_var2,$(mods)_noinc,$@)) |
| 338 |
@$(foreach mods,$(modules_dirs), \ |
| 339 |
$(call cfg_save_var2,$(mods),$@)) |
| 340 |
@echo "modules_configured:=1" >>$@ |
| 341 |
|
| 342 |
|
| 343 |
.PHONY: cfg config cfg-defs |
| 344 |
cfg-defs: config.mak |
| 345 |
|
| 346 |
cfg config: cfg-defs modules-cfg |
| 347 |
|
| 348 |
.PHONY: modules-cfg modules-list modules-lst |
| 349 |
modules-cfg modules-list modules-lst: |
| 350 |
rm -f modules.lst |
| 351 |
$(MAKE) modules.lst |
| 352 |
|
| 353 |
ifneq ($(wildcard ../.git),) |
| 354 |
|
| 355 |
repo_ver=$(shell RV=`git rev-parse --verify --short=6 HEAD 2>/dev/null`;\ |
| 356 |
[ -n "$$RV" ] && \ |
| 357 |
test -n "`git update-index --refresh --unmerged >/dev/null\ |
| 358 |
; git diff-index --name-only HEAD 2>/dev/null | \ |
| 359 |
grep -v Makefile`" &&\ |
| 360 |
RV="$$RV"-dirty; echo "$$RV") |
| 361 |
repo_hash=$(subst -dirty,,$(repo_ver)) |
| 362 |
repo_state=$(subst %-dirty,dirty,$(findstring -dirty,$(repo_ver))) |
| 363 |
autover_h_dep=../.git $(filter-out $(auto_gen), $(sources)) core/cfg.y core/cfg.lex Makefile |
| 364 |
else |
| 365 |
|
| 366 |
repo_ver= |
| 367 |
repo_hash="unknown" |
| 368 |
repo_state= |
| 369 |
autover_h_dep= |
| 370 |
endif |
| 371 |
|
| 372 |
|
| 373 |
core/autover.h: $(autover_h_dep) |
| 374 |
@echo "generating core/autover.h ..." |
| 375 |
@echo "/* this file is autogenerated by make core/autover.h" >$@ |
| 376 |
@echo " * DO NOT EDIT IT" >>$@ |
| 377 |
@echo " */" >>$@ |
| 378 |
@echo "" >>$@ |
| 379 |
@echo "#define REPO_VER \"$(repo_ver)\"" >>$@ |
| 380 |
@echo "#define REPO_HASH \"$(repo_hash)\"" >>$@ |
| 381 |
@echo "#define REPO_STATE \"$(repo_state)\"" >>$@ |
| 382 |
|
| 383 |
.PHONY: all |
| 384 |
all: $(NAME) every-module |
| 385 |
|
| 386 |
.PHONY: print-modules |
| 387 |
print-modules: |
| 388 |
@echo The following modules were chosen to be included: \ |
| 389 |
$(include_modules) ; \ |
| 390 |
echo ---------------------------------------------------------- ; \ |
| 391 |
echo The following modules will be excluded: $(exclude_modules) ; \ |
| 392 |
echo ---------------------------------------------------------- ; \ |
| 393 |
echo The following modules will be made; \ |
| 394 |
$(foreach mods,$(modules_dirs), \ |
| 395 |
echo $(mods)/: $($(mods)_basenames) ; ) \ |
| 396 |
#echo DBG: The following modules will be made: $(modules_basenames) ; \ |
| 397 |
|
| 398 |
|
| 399 |
# modules templates (instantiated based on modules_dirs contents) |
| 400 |
define MODULES_RULES_template |
| 401 |
|
| 402 |
$(1)_dst=$(modules_prefix)/$(modules_dir)$(1) |
| 403 |
$(1)_target=$(prefix)/$(modules_dir)$(1) |
| 404 |
|
| 405 |
.PHONY: $(1) |
| 406 |
$(1): modules.lst |
| 407 |
@$(foreach r,$($(1)),$(call module_make,$(r),$(mk_params))) |
| 408 |
|
| 409 |
.PHONY: $(1)-doc |
| 410 |
$(1)-doc: modules.lst |
| 411 |
+@for r in $($(1)) "" ; do \ |
| 412 |
if [ -n "$$$$r" -a -r "$$$$r/Makefile" ]; then \ |
| 413 |
$(call oecho, "" ;) \ |
| 414 |
$(call oecho, "" ;) \ |
| 415 |
$(MAKE) -C $$$$r/doc $(doc_format) $$(mk_params); \ |
| 416 |
fi ; \ |
| 417 |
done |
| 418 |
|
| 419 |
.PHONY: $(1)-readme |
| 420 |
|
| 421 |
$(1)-readme: modules.lst |
| 422 |
-+@for r in $($(1)) "" ; do \ |
| 423 |
if [ -n "$$$$r" -a -r "$$$$r/Makefile" ]; then \ |
| 424 |
$(call oecho, "" ;) \ |
| 425 |
$(call oecho, "" ;) \ |
| 426 |
if $(MAKE) -C $$$$r $$(mk_params) README || [ ${err_fail} != 1 ];\ |
| 427 |
then \ |
| 428 |
:; \ |
| 429 |
else \ |
| 430 |
exit 1; \ |
| 431 |
fi ; \ |
| 432 |
fi ; \ |
| 433 |
done; true |
| 434 |
|
| 435 |
.PHONY: $(1)-man |
| 436 |
$(1)-man: modules.lst |
| 437 |
-+@for r in $($(1)_basenames) "" ; do \ |
| 438 |
if [ -n "$$$$r" -a -r $(1)/"$$$$r/Makefile" -a \ |
| 439 |
-r $(1)/"$$$$r/$$$$r.xml" ]; then \ |
| 440 |
$(call oecho, "" ;) \ |
| 441 |
$(call oecho, "" ;) \ |
| 442 |
if $(MAKE) -C $(1)/"$$$$r" $$(mk_params) man || \ |
| 443 |
[ ${err_fail} != 1 ] ;\ |
| 444 |
then \ |
| 445 |
:; \ |
| 446 |
else \ |
| 447 |
exit 1; \ |
| 448 |
fi ; \ |
| 449 |
fi ; \ |
| 450 |
done; true |
| 451 |
|
| 452 |
.PHONY: install-$(1) |
| 453 |
|
| 454 |
install-$(1): modules.lst $$($(1)_dst) |
| 455 |
+@for r in $($(1)) "" ; do \ |
| 456 |
if [ -n "$$$$r" -a -r "$$$$r/Makefile" ]; then \ |
| 457 |
$(call oecho, "" ;) \ |
| 458 |
$(call oecho, "" ;) \ |
| 459 |
if $(MAKE) -C $$$$r install mods_dst=$$($(1)_dst) $$(mk_params) \ |
| 460 |
|| [ ${err_fail} != 1 ] ; then \ |
| 461 |
:; \ |
| 462 |
else \ |
| 463 |
exit 1; \ |
| 464 |
fi ; \ |
| 465 |
fi ; \ |
| 466 |
done; true |
| 467 |
|
| 468 |
|
| 469 |
.PHONY: install-$(1)-doc |
| 470 |
|
| 471 |
install-$(1)-doc: modules.lst $(doc_prefix)/$(doc_dir)$(1) |
| 472 |
@for r in $($(1)_basenames) "" ; do \ |
| 473 |
if [ -n "$$$$r" -a -r $(1)/"$$$$r/Makefile" ]; then \ |
| 474 |
if [ -f $(1)/"$$$$r"/README ]; then \ |
| 475 |
$$(call try_err,\ |
| 476 |
$(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)$(1)/README."$$$$r" ); \ |
| 477 |
$$(call try_err,\ |
| 478 |
$(INSTALL_DOC) $(1)/"$$$$r"/README \ |
| 479 |
$(doc_prefix)/$(doc_dir)$(1)/README."$$$$r" ); \ |
| 480 |
fi ; \ |
| 481 |
fi ; \ |
| 482 |
done; true |
| 483 |
|
| 484 |
.PHONY: install-$(1)-man |
| 485 |
|
| 486 |
install-$(1)-man: $(1)-man $(man_prefix)/$(man_dir)/man7 |
| 487 |
@for r in $($(1)_basenames) "" ; do \ |
| 488 |
if [ -n "$$$$r" -a -r $(1)/"$$$$r/Makefile" ]; then \ |
| 489 |
if [ -f $(1)/"$$$$r"/"$$$$r".7 ]; then \ |
| 490 |
$$(call try_err,\ |
| 491 |
$(INSTALL_TOUCH) $(man_prefix)/$(man_dir)/man7/"$$$$r".7 );\ |
| 492 |
$$(call try_err,\ |
| 493 |
$(INSTALL_MAN) $(1)/"$$$$r"/"$$$$r".7 \ |
| 494 |
$(man_prefix)/$(man_dir)/man7 ); \ |
| 495 |
fi ; \ |
| 496 |
fi ; \ |
| 497 |
done; true |
| 498 |
|
| 499 |
|
| 500 |
$(modules_prefix)/$(modules_dir)$(1): |
| 501 |
mkdir -p $$(@) |
| 502 |
|
| 503 |
$(doc_prefix)/$(doc_dir)$(1): |
| 504 |
mkdir -p $$(@) |
| 505 |
|
| 506 |
|
| 507 |
endef |
| 508 |
|
| 509 |
|
| 510 |
$(foreach mods,$(modules_dirs),$(eval $(call MODULES_RULES_template,$(mods)))) |
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
modules-all every-module: $(modules_dirs) |
| 516 |
|
| 517 |
$(extra_objs): |
| 518 |
@echo "Extra objs: $(extra_objs)" |
| 519 |
@for r in $(static_modules_path) "" ; do \ |
| 520 |
if [ -n "$$r" -a -r "$$r/Makefile" ]; then \ |
| 521 |
$(call oecho, "" ;) \ |
| 522 |
$(call oecho, "Making static module $r" ;) \ |
| 523 |
if $(MAKE) -C $$r static $(mk_params) ; then \ |
| 524 |
:; \ |
| 525 |
else \ |
| 526 |
exit 1; \ |
| 527 |
fi ; \ |
| 528 |
fi ; \ |
| 529 |
done |
| 530 |
|
| 531 |
.PHONY: utils |
| 532 |
utils: |
| 533 |
@for r in $(C_COMPILE_UTILS) "" ; do \ |
| 534 |
if [ -n "$$r" ]; then \ |
| 535 |
$(call oecho, "" ;) \ |
| 536 |
$(call oecho, "" ;) \ |
| 537 |
if $(MAKE) -C $$r $(mk_params) || [ ${err_fail} != 1 ] ; \ |
| 538 |
then \ |
| 539 |
:; \ |
| 540 |
else \ |
| 541 |
exit 1; \ |
| 542 |
fi ; \ |
| 543 |
fi ; \ |
| 544 |
done; true |
| 545 |
|
| 546 |
|
| 547 |
dbg: sip-router |
| 548 |
gdb -command debug.gdb |
| 549 |
|
| 550 |
.PHONY: makefile_vars makefile-vars |
| 551 |
makefile_vars makefile-vars: |
| 552 |
echo "FLAVOUR?=$(FLAVOUR)" > Makefile.vars |
| 553 |
|
| 554 |
.PHONY: tar |
| 555 |
.PHONY: dist |
| 556 |
|
| 557 |
dist: tar |
| 558 |
|
| 559 |
tar: makefile_vars $(auto_gen_keep) |
| 560 |
$(TAR) -C ../.. \ |
| 561 |
--exclude=$(notdir $(realpath $(shell pwd)/..))/test* \ |
| 562 |
--exclude=$(notdir $(realpath $(shell pwd)/..))/tmp* \ |
| 563 |
--exclude=$(notdir $(realpath $(shell pwd)/..))/debian \ |
| 564 |
--exclude=$(notdir $(realpath $(shell pwd)/..))/debian/$(MAIN_NAME) \ |
| 565 |
--exclude=$(notdir $(realpath $(shell pwd)/..))/debian/$(MAIN_NAME)-* \ |
| 566 |
--exclude=$(notdir $(realpath $(shell pwd)/..))/$(MAIN_NAME)_tls* \ |
| 567 |
--exclude=$(notdir $(realpath $(shell pwd)/..))/misc/obsolete \ |
| 568 |
--exclude=.git* \ |
| 569 |
--exclude=tags \ |
| 570 |
--exclude=librpath.lst \ |
| 571 |
--exclude=libiname.lst \ |
| 572 |
--exclude=makecfg.lst \ |
| 573 |
--exclude=config.mak \ |
| 574 |
--exclude=modules.lst \ |
| 575 |
--exclude=*.[do] \ |
| 576 |
--exclude=*.so \ |
| 577 |
--exclude=*.il \ |
| 578 |
--exclude=$(notdir $(realpath $(shell pwd)/..))/$(MAIN_NAME) \ |
| 579 |
--exclude=$(notdir $(realpath $(shell pwd)/..))/src/$(MAIN_NAME) \ |
| 580 |
--exclude=*.gz \ |
| 581 |
--exclude=*.bz2 \ |
| 582 |
--exclude=*.tar \ |
| 583 |
--exclude=*.patch \ |
| 584 |
--exclude=.\#* \ |
| 585 |
--exclude=*.swp \ |
| 586 |
--exclude=*.swo \ |
| 587 |
${tar_extra_args} \ |
| 588 |
-cf - $(notdir $(realpath $(shell pwd)/..)) | \ |
| 589 |
(mkdir -p ../tmp/_tar1; mkdir -p ../tmp/_tar2 ; \ |
| 590 |
cd ../tmp/_tar1; $(TAR) -xf - ) && \ |
| 591 |
mv ../tmp/_tar1/$(notdir $(realpath $(shell pwd)/..)) \ |
| 592 |
../tmp/_tar2/"$(NAME)-$(RELEASE)" && \ |
| 593 |
(cd ../tmp/_tar2 && $(TAR) \ |
| 594 |
-zcf ../../"$(tar_name)".tar.gz \ |
| 595 |
"$(NAME)-$(RELEASE)" ) ; \ |
| 596 |
rm -rf ../tmp/_tar1; rm -rf ../tmp/_tar2; rm -rf ../tmp |
| 597 |
|
| 598 |
|
| 599 |
.PHONY: bin |
| 600 |
bin: |
| 601 |
mkdir -p tmp/$(MAIN_NAME)/usr/local |
| 602 |
$(MAKE) install basedir=$(CURDIR)/tmp/$(MAIN_NAME) $(mk_params) |
| 603 |
$(TAR) -C tmp/$(MAIN_NAME)/ -zcf ../$(NAME)-$(RELEASE)_$(OS)_$(ARCH).tar.gz . |
| 604 |
rm -rf tmp/$(MAIN_NAME) |
| 605 |
|
| 606 |
.PHONY: deb |
| 607 |
deb: |
| 608 |
(cd ..; \ |
| 609 |
if [ -d debian ]; then \ |
| 610 |
dpkg-buildpackage -rfakeroot -tc -uc -us; \ |
| 611 |
rm debian; \ |
| 612 |
else \ |
| 613 |
ln -s pkg/$(MAIN_NAME)/deb/sid debian; \ |
| 614 |
dpkg-buildpackage -rfakeroot -tc -uc -us; \ |
| 615 |
rm debian; \ |
| 616 |
fi) |
| 617 |
|
| 618 |
.PHONY: deb-stable |
| 619 |
deb-stable: |
| 620 |
(cd ..; \ |
| 621 |
if [ -d debian ]; then \ |
| 622 |
dpkg-buildpackage -rfakeroot -tc -uc -us; \ |
| 623 |
rm debian; \ |
| 624 |
else \ |
| 625 |
ln -s pkg/$(MAIN_NAME)/deb/bullseye debian; \ |
| 626 |
dpkg-buildpackage -rfakeroot -tc -uc -us; \ |
| 627 |
rm debian; \ |
| 628 |
fi) |
| 629 |
|
| 630 |
.PHONY: sunpkg |
| 631 |
sunpkg: |
| 632 |
mkdir -p tmp/$(MAIN_NAME) |
| 633 |
mkdir -p tmp/$(MAIN_NAME)_sun_pkg |
| 634 |
$(MAKE) install basedir=$(CURDIR)/tmp/$(MAIN_NAME) \ |
| 635 |
prefix=/usr/local $(mk_params) |
| 636 |
(cd pkg/$(MAIN_NAME)/solaris; \ |
| 637 |
pkgmk -r ../../tmp/$(MAIN_NAME)/usr/local -o -d ../../tmp/$(MAIN_NAME)_sun_pkg/ -v "$(RELEASE)" ;\ |
| 638 |
cd ../..) |
| 639 |
cat /dev/null > ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local |
| 640 |
pkgtrans -s tmp/$(MAIN_NAME)_sun_pkg/ ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local \ |
| 641 |
IPTEL$(MAIN_NAME) |
| 642 |
gzip -9 ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local |
| 643 |
rm -rf tmp/$(MAIN_NAME) |
| 644 |
rm -rf tmp/$(MAIN_NAME)_sun_pkg |
| 645 |
|
| 646 |
|
| 647 |
.PHONY: install |
| 648 |
install: mk_params="compile_for_install=yes" |
| 649 |
install: install-bin install-every-module install-cfg \ |
| 650 |
install-doc install-man install-utils install-share |
| 651 |
|
| 652 |
.PHONY: dbinstall |
| 653 |
dbinstall: |
| 654 |
-@echo "Initializing $(MAIN_NAME) database" |
| 655 |
scripts/mysql/$(SCR_NAME)_mysql.sh create |
| 656 |
-@echo "Done" |
| 657 |
|
| 658 |
.PHONY: README |
| 659 |
README: $(foreach mods,$(modules_dirs),$(mods)-readme) |
| 660 |
|
| 661 |
.PHONY: man |
| 662 |
man: $(foreach mods,$(modules_dirs),$(mods)-man) |
| 663 |
|
| 664 |
mk-install_dirs: $(cfg_prefix)/$(cfg_dir) $(bin_prefix)/$(bin_dir) \ |
| 665 |
$(modules_prefix)/$(modules_dir) $(doc_prefix)/$(doc_dir) \ |
| 666 |
$(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5 \ |
| 667 |
$(share_prefix)/$(share_dir) \ |
| 668 |
$(foreach mods,$(modules_dirs),\ |
| 669 |
$(modules_prefix)/$(modules_dir)$(mods) \ |
| 670 |
$(doc_prefix)/$(doc_dir)$(mods) ) |
| 671 |
|
| 672 |
$(cfg_prefix)/$(cfg_dir): |
| 673 |
mkdir -p $(cfg_prefix)/$(cfg_dir) |
| 674 |
|
| 675 |
$(run_prefix)/$(run_dir): |
| 676 |
mkdir -p $(run_prefix)/$(run_dir) |
| 677 |
|
| 678 |
$(bin_prefix)/$(bin_dir): |
| 679 |
mkdir -p $(bin_prefix)/$(bin_dir) |
| 680 |
|
| 681 |
$(share_prefix)/$(share_dir): |
| 682 |
mkdir -p $(share_prefix)/$(share_dir) |
| 683 |
|
| 684 |
$(modules_prefix)/$(modules_dir): |
| 685 |
mkdir -p $(modules_prefix)/$(modules_dir) |
| 686 |
|
| 687 |
$(doc_prefix)/$(doc_dir): |
| 688 |
mkdir -p $(doc_prefix)/$(doc_dir) |
| 689 |
|
| 690 |
$(man_prefix)/$(man_dir)/man8: |
| 691 |
mkdir -p $(man_prefix)/$(man_dir)/man8 |
| 692 |
|
| 693 |
$(man_prefix)/$(man_dir)/man7: |
| 694 |
mkdir -p $(man_prefix)/$(man_dir)/man7 |
| 695 |
|
| 696 |
$(man_prefix)/$(man_dir)/man5: |
| 697 |
mkdir -p $(man_prefix)/$(man_dir)/man5 |
| 698 |
|
| 699 |
|
| 700 |
install-cfg: $(cfg_prefix)/$(cfg_dir) |
| 701 |
@# main configuration file |
| 702 |
@if [ -f ../etc/$(CFG_NAME).cfg ]; then \ |
| 703 |
sed $(foreach m,$(modules_dirs),\ |
| 704 |
-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \ |
| 705 |
-e "s#/usr/local/etc/$(CFG_NAME)/#$(cfg_target) |
| 706 |
< ../etc/$(CFG_NAME).cfg \ |
| 707 |
> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample; \ |
| 708 |
chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample; \ |
| 709 |
if [ -z "${skip_cfg_install}" -a \ |
| 710 |
! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg ]; then \ |
| 711 |
mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample \ |
| 712 |
$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg; \ |
| 713 |
fi; \ |
| 714 |
fi |
| 715 |
@# other configuration files |
| 716 |
@for r in $(C_INSTALL_CFGS) ""; do \ |
| 717 |
if [ -n "$$r" ]; then \ |
| 718 |
if [ -f "$$r" ]; then \ |
| 719 |
n=`basename "$$r"` ; \ |
| 720 |
sed $(foreach m,$(modules_dirs),\ |
| 721 |
-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \ |
| 722 |
< "$$r" \ |
| 723 |
> "$(cfg_prefix)/$(cfg_dir)$$n.sample" ; \ |
| 724 |
chmod 644 "$(cfg_prefix)/$(cfg_dir)$$n.sample" ; \ |
| 725 |
if [ -z "${skip_cfg_install}" -a \ |
| 726 |
! -f "$(cfg_prefix)/$(cfg_dir)$$n" ]; \ |
| 727 |
then \ |
| 728 |
mv -f "$(cfg_prefix)/$(cfg_dir)$$n.sample" \ |
| 729 |
"$(cfg_prefix)/$(cfg_dir)$$n"; \ |
| 730 |
fi ; \ |
| 731 |
else \ |
| 732 |
echo "ERROR: $$r not found" ; \ |
| 733 |
if [ ${err_fail} = 1 ] ; then \ |
| 734 |
exit 1; \ |
| 735 |
fi ; \ |
| 736 |
fi ; \ |
| 737 |
fi ; \ |
| 738 |
: ; done; true |
| 739 |
@echo "config files installed" |
| 740 |
|
| 741 |
|
| 742 |
install-cfg-extras: $(cfg_prefix)/$(cfg_dir) |
| 743 |
@if [ -f ../misc/examples/pkg/$(CFG_NAME)-basic.cfg ]; then \ |
| 744 |
sed $(foreach m,$(modules_dirs),\ |
| 745 |
-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \ |
| 746 |
-e "s#/usr/local/etc/$(CFG_NAME)/#$(cfg_target) |
| 747 |
< ../misc/examples/pkg/$(CFG_NAME)-basic.cfg \ |
| 748 |
> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample; \ |
| 749 |
chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample; \ |
| 750 |
if [ -z "${skip_cfg_install}" -a \ |
| 751 |
! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg ]; then \ |
| 752 |
mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample \ |
| 753 |
$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg; \ |
| 754 |
fi; \ |
| 755 |
fi |
| 756 |
@if [ -f ../misc/examples/pkg/$(CFG_NAME)-oob.cfg ]; then \ |
| 757 |
sed $(foreach m,$(modules_dirs),\ |
| 758 |
-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \ |
| 759 |
-e "s#/usr/local/etc/$(CFG_NAME)/#$(cfg_target) |
| 760 |
< ../misc/examples/pkg/$(CFG_NAME)-oob.cfg \ |
| 761 |
> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample; \ |
| 762 |
chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample; \ |
| 763 |
if [ -z "${skip_cfg_install}" -a \ |
| 764 |
! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg ]; \ |
| 765 |
then \ |
| 766 |
mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample \ |
| 767 |
$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg; \ |
| 768 |
fi; \ |
| 769 |
fi |
| 770 |
|
| 771 |
install-cfg-pkg: $(cfg_prefix)/$(cfg_dir) |
| 772 |
@if [ -f ../misc/examples/pkg/sipcapture.cfg ]; then \ |
| 773 |
sed $(foreach m,$(modules_dirs),\ |
| 774 |
-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \ |
| 775 |
-e "s#/usr/local/etc/$(CFG_NAME)/#$(cfg_target) |
| 776 |
< ../misc/examples/pkg/sipcapture.cfg \ |
| 777 |
> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-sipcapture.cfg.sample; \ |
| 778 |
chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-sipcapture.cfg.sample; \ |
| 779 |
if [ -z "${skip_cfg_install}" -a \ |
| 780 |
! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-sipcapture.cfg ]; \ |
| 781 |
then \ |
| 782 |
mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-sipcapture.cfg.sample \ |
| 783 |
$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-sipcapture.cfg; \ |
| 784 |
fi; \ |
| 785 |
fi |
| 786 |
|
| 787 |
install-bin: $(bin_prefix)/$(bin_dir) $(NAME) |
| 788 |
$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/$(NAME) |
| 789 |
$(INSTALL_BIN) $(NAME) $(bin_prefix)/$(bin_dir) |
| 790 |
|
| 791 |
|
| 792 |
install-share: $(share_prefix)/$(share_dir) |
| 793 |
@for r in $(C_INSTALL_SHARE) "" ; do \ |
| 794 |
if [ -n "$$r" ]; then \ |
| 795 |
if [ -f "$$r" ]; then \ |
| 796 |
$(call try_err, $(INSTALL_TOUCH) \ |
| 797 |
$(share_prefix)/$(share_dir)/`basename "$$r"` ); \ |
| 798 |
$(call try_err, \ |
| 799 |
$(INSTALL_SHARE) "$$r" $(share_prefix)/$(share_dir) );\ |
| 800 |
else \ |
| 801 |
echo "ERROR: $$r not found" ; \ |
| 802 |
if [ ${err_fail} = 1 ] ; then \ |
| 803 |
exit 1; \ |
| 804 |
fi ; \ |
| 805 |
fi ;\ |
| 806 |
fi ; \ |
| 807 |
done; true |
| 808 |
|
| 809 |
|
| 810 |
install-every-module: $(foreach mods,$(modules_dirs),install-$(mods)) |
| 811 |
|
| 812 |
install-every-module-doc: $(foreach mods,$(modules_dirs),install-$(mods)-doc) |
| 813 |
|
| 814 |
install-every-module-man: $(foreach mods,$(modules_dirs),install-$(mods)-man) |
| 815 |
|
| 816 |
install-utils: utils $(bin_prefix)/$(bin_dir) |
| 817 |
@for r in $(C_INSTALL_BIN) "" ; do \ |
| 818 |
if [ -n "$$r" ]; then \ |
| 819 |
if [ -f "$$r" ]; then \ |
| 820 |
$(call try_err, $(INSTALL_TOUCH) \ |
| 821 |
$(bin_prefix)/$(bin_dir)/`basename "$$r"` ); \ |
| 822 |
$(call try_err,\ |
| 823 |
$(INSTALL_BIN) "$$r" $(bin_prefix)/$(bin_dir) ); \ |
| 824 |
else \ |
| 825 |
echo "ERROR: $$r not compiled" ; \ |
| 826 |
if [ ${err_fail} = 1 ] ; then \ |
| 827 |
exit 1; \ |
| 828 |
fi ; \ |
| 829 |
fi ;\ |
| 830 |
fi ; \ |
| 831 |
done; true |
| 832 |
@for r in $(C_INSTALL_SCRIPTS) "" ; do \ |
| 833 |
if [ -n "$$r" ]; then \ |
| 834 |
if [ -f "$$r" ]; then \ |
| 835 |
$(call try_err, $(INSTALL_TOUCH) \ |
| 836 |
$(bin_prefix)/$(bin_dir)/`basename "$$r"` ); \ |
| 837 |
$(call try_err,\ |
| 838 |
$(INSTALL_SCRIPT) "$$r" $(bin_prefix)/$(bin_dir) ); \ |
| 839 |
else \ |
| 840 |
echo "ERROR: $$r not compiled" ; \ |
| 841 |
if [ ${err_fail} = 1 ] ; then \ |
| 842 |
exit 1; \ |
| 843 |
fi ; \ |
| 844 |
fi ;\ |
| 845 |
fi ; \ |
| 846 |
done; true |
| 847 |
@for ut in $(C_INSTALL_UTILS) "" ; do \ |
| 848 |
if [ -n "$$ut" ]; then \ |
| 849 |
if [ -d "$$ut" ]; then \ |
| 850 |
$(call try_err, $(MAKE) -C "$${ut}" install-if-newer ) ;\ |
| 851 |
fi ;\ |
| 852 |
fi ; \ |
| 853 |
done; true |
| 854 |
|
| 855 |
|
| 856 |
install-modules-all: install-every-module install-every-module-doc |
| 857 |
|
| 858 |
|
| 859 |
install-doc: $(doc_prefix)/$(doc_dir) install-every-module-doc |
| 860 |
$(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)/INSTALL |
| 861 |
$(INSTALL_DOC) ../INSTALL $(doc_prefix)/$(doc_dir) |
| 862 |
$(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)/README |
| 863 |
$(INSTALL_DOC) ../README $(doc_prefix)/$(doc_dir) |
| 864 |
|
| 865 |
|
| 866 |
install-sr-man: $(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5 |
| 867 |
@sed -e "s#/etc/$(CFG_NAME)/$(CFG_NAME)\.cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \ |
| 868 |
-e "s#/usr/sbin/#$(bin_target) |
| 869 |
$(foreach m,$(modules_dirs),\ |
| 870 |
-e "s#/usr/lib/$(CFG_NAME)/$(m)\([^_]\)#$($(m)_target)\1#g") \ |
| 871 |
-e "s#/usr/share/doc/$(CFG_NAME)/#$(doc_target) |
| 872 |
-e "s#$(SRC_NAME)#$(MAIN_NAME) |
| 873 |
< ../doc/man/$(MAIN_NAME).8 > \ |
| 874 |
$(man_prefix)/$(man_dir)/man8/$(MAIN_NAME).8 |
| 875 |
@chmod 644 $(man_prefix)/$(man_dir)/man8/$(MAIN_NAME).8 |
| 876 |
@sed -e "s#/etc/$(CFG_NAME)/$(CFG_NAME)\.cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \ |
| 877 |
-e "s#/usr/sbin/#$(bin_target) |
| 878 |
$(foreach m,$(modules_dirs),\ |
| 879 |
-e "s#/usr/lib/$(CFG_NAME)/$(m)\([^_]\)#$($(m)_target)\1#g") \ |
| 880 |
-e "s#/usr/share/doc/$(CFG_NAME)/#$(doc_target) |
| 881 |
-e "s#$(SRC_NAME)#$(MAIN_NAME) |
| 882 |
< ../doc/man/$(MAIN_NAME).cfg.5 > \ |
| 883 |
$(man_prefix)/$(man_dir)/man5/$(MAIN_NAME).cfg.5 |
| 884 |
@chmod 644 $(man_prefix)/$(man_dir)/man5/$(MAIN_NAME).cfg.5 |
| 885 |
|
| 886 |
install-man: install-sr-man install-every-module-man |
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
.PHONY: clean-libs |
| 892 |
clean-libs: |
| 893 |
$(MAKE) -C lib clean |
| 894 |
|
| 895 |
.PHONY: proper-libs realclean-libs distclean-libs maintainer-clean-libs |
| 896 |
proper-libs realclean-libs distclean-libs maintainer-clean-libs: |
| 897 |
$(MAKE) -C lib $(patsubst %-libs,%,$@) |
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
.PHONY: clean-utils |
| 902 |
clean-utils: |
| 903 |
@for r in $(C_COMPILE_UTILS) $(C_INSTALL_UTILS) "" ; do \ |
| 904 |
if [ -d "$$r" ]; then \ |
| 905 |
$(MAKE) -C "$$r" clean ; \ |
| 906 |
fi ; \ |
| 907 |
done |
| 908 |
|
| 909 |
.PHONY: proper-utils |
| 910 |
.PHONY: distclean-utils |
| 911 |
.PHONY: realclean-utils |
| 912 |
.PHONY: maintainer-clean-utils |
| 913 |
proper-utils realclean-utils distclean-utils maintainer-clean-utils: \ |
| 914 |
clean_target=$(patsubst %-utils,%,$@) |
| 915 |
proper-utils realclean-utils distclean-utils maintainer-clean-utils: |
| 916 |
@for r in $(C_COMPILE_UTILS) $(C_INSTALL_UTILS) "" ; do \ |
| 917 |
if [ -d "$$r" ]; then \ |
| 918 |
$(MAKE) -C "$$r" $(clean_target); \ |
| 919 |
fi ; \ |
| 920 |
done |
| 921 |
|
| 922 |
|
| 923 |
clean: clean-extra-names |
| 924 |
|
| 925 |
clean: clean-modules |
| 926 |
|
| 927 |
clean: clean-utils |
| 928 |
|
| 929 |
clean: clean-libs |
| 930 |
|
| 931 |
.PHONY: clean-extra-names |
| 932 |
clean-extra-names: |
| 933 |
@rm -f $(filter-out $(MAIN_NAME), sip-router ser kamailio) |
| 934 |
|
| 935 |
|
| 936 |
|
| 937 |
proper: clean-extra-names proper-modules proper-utils proper-libs |
| 938 |
distclean-old: distclean-modules distclean-utils distclean-libs |
| 939 |
realclean: realclean-modules realclean-utils realclean-libs |
| 940 |
maintainer-clean: maintainer-clean-modules maintainer-clean-utils \ |
| 941 |
maintainer-clean-libs |
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
.PHONY: clean-all |
| 946 |
clean-all: cmodules=$(all_modules_lst) |
| 947 |
clean-all: clean |
| 948 |
maintainer-clean: modules=$(modules_all) |
| 949 |
|
| 950 |
|
| 951 |
proper realclean distclean-old maintainer-clean: clean_cfg |
| 952 |
|
| 953 |
|
| 954 |
maintainer-clean: clean_modules_cfg clean_makefile_vars |
| 955 |
|
| 956 |
.PHONY: proper-all realclean-all distclean-all |
| 957 |
proper-all realclean-all distclean-all: cmodules=$(all_modules_lst) |
| 958 |
proper-all realclean-all distclean-all: proper |
| 959 |
|
| 960 |
|
| 961 |
.PHONY: clean_cfg clean-cfg |
| 962 |
clean_cfg clean-cfg: |
| 963 |
rm -f config.mak |
| 964 |
|
| 965 |
.PHONY: clean_modules_cfg clean-modules-cfg |
| 966 |
clean_modules_cfg clean-modules-cfg: |
| 967 |
rm -f modules.lst |
| 968 |
|
| 969 |
.PHONY: clean_makefile_vars clean-makefile-vars |
| 970 |
rm -f Makefile.vars |
| 971 |
|
| 972 |
|
| 973 |
.PHONY: pure |
| 974 |
pure distclean: maintainer-clean |
| 975 |
|
| 976 |
.PHONY: install_initd_debian install-initd-debian |
| 977 |
install_initd_debian install-initd-debian: |
| 978 |
sed -e "s#DAEMON=/usr/sbin/kamailio#DAEMON=$(bin_prefix)/$(bin_dir)$(NAME) |
| 979 |
-e "s#NAME=kamailio#NAME=$(NAME) |
| 980 |
-e "s#DESC=Kamailio#DESC=$(NAME) |
| 981 |
-e "s#HOMEDIR=/run/kamailio#HOMEDIR=/run/$(NAME) |
| 982 |
-e "s#DEFAULTS=/etc/default/kamailio#DEFAULTS=/etc/default/$(NAME) |
| 983 |
-e "s#CFGFILE=/etc/kamailio/kamailio.cfg#CFGFILE=$(cfg_prefix)/$(cfg_dir)$(NAME).cfg#g" \ |
| 984 |
< ../pkg/kamailio/deb/debian/kamailio.init \ |
| 985 |
> /etc/init.d/$(NAME) |
| 986 |
chmod +x /etc/init.d/$(NAME) |
| 987 |
sed -e "s#RUN_KAMAILIO=no#RUN_KAMAILIO=yes#g" \ |
| 988 |
< ../pkg/kamailio/deb/debian/kamailio.default \ |
| 989 |
> /etc/default/$(NAME) |
| 990 |
mkdir -p /run/$(NAME) |
| 991 |
adduser --quiet --system --group --disabled-password \ |
| 992 |
--shell /bin/false --gecos "$(NAME)" \ |
| 993 |
--home /run/$(NAME) $(NAME) |
| 994 |
chown $(NAME):$(NAME) /run/$(NAME) |
| 995 |
|
| 996 |
.PHONY: install_initd_centos install-initd-centos |
| 997 |
install_initd_centos install-initd-centos: |
| 998 |
sed -e "s#KAM=/usr/sbin/kamailio#KAM=$(bin_prefix)/$(bin_dir)$(NAME) |
| 999 |
-e "s#PROG=kamailio#PROG=$(NAME) |
| 1000 |
-e "s#DEFAULTS=/etc/default/kamailio#DEFAULTS=/etc/default/$(NAME) |
| 1001 |
-e "s#PID_FILE=/run/kamailio.pid#PID_FILE=/run/$(NAME).pid#g" \ |
| 1002 |
-e "s#LOCK_FILE=/var/lock/subsys/kamailio#LOCK_FILE=/var/lock/subsys/$(NAME) |
| 1003 |
-e "s#KAMCFG=/etc/kamailio/kamailio.cfg#KAMCFG=$(cfg_prefix)/$(cfg_dir)$(NAME).cfg#g" \ |
| 1004 |
< ../pkg/kamailio/rpm/kamailio.init \ |
| 1005 |
> /etc/init.d/$(NAME) |
| 1006 |
chmod +x /etc/init.d/$(NAME) |
| 1007 |
sed -e "s#RUN_KAMAILIO=no#RUN_KAMAILIO=yes#g" \ |
| 1008 |
-e "s#USER=kamailio#USER=$(NAME) |
| 1009 |
-e "s#GROUP=kamailio#GROUP=$(NAME) |
| 1010 |
< ../pkg/kamailio/rpm/kamailio.default \ |
| 1011 |
> /etc/default/$(NAME) |
| 1012 |
mkdir -p /run/$(NAME) |
| 1013 |
/usr/sbin/groupadd -r $(NAME) |
| 1014 |
/usr/sbin/useradd -r -g $(NAME) -s /bin/false -c "Kamailio Daemon" \ |
| 1015 |
-d /run/$(NAME) $(NAME) |
| 1016 |
chown $(NAME):$(NAME) /run/$(NAME) |
| 1017 |
|
| 1018 |
.PHONY: install_systemd_debian install-systemd-debian |
| 1019 |
install_systemd_debian install-systemd-debian: |
| 1020 |
sed -e "s#ExecStart=/usr/sbin/kamailio#ExecStart=$(bin_prefix)/$(bin_dir)$(NAME) |
| 1021 |
-e "s#Description=Kamailio#Description=$(NAME) |
| 1022 |
-e "s#/run/kamailio/kamailio.pid#/run/$(NAME)/$(NAME).pid#g" \ |
| 1023 |
-e "s#EnvironmentFile=-/etc/default/kamailio#EnvironmentFile=-/etc/default/$(NAME) |
| 1024 |
-e "s#CFGFILE=/etc/kamailio/kamailio.cfg#CFGFILE=$(cfg_prefix)/$(cfg_dir)$(NAME).cfg#g" \ |
| 1025 |
< ../pkg/kamailio/deb/debian/kamailio.service \ |
| 1026 |
> /etc/systemd/system/$(NAME).service |
| 1027 |
sed -e "s#RUN_KAMAILIO=no#RUN_KAMAILIO=yes#g" \ |
| 1028 |
< ../pkg/kamailio/deb/debian/kamailio.default \ |
| 1029 |
> /etc/default/$(NAME) |
| 1030 |
mkdir -p /run/$(NAME) |
| 1031 |
adduser --quiet --system --group --disabled-password \ |
| 1032 |
--shell /bin/false --gecos "$(NAME)" \ |
| 1033 |
--home /run/$(NAME) $(NAME) |
| 1034 |
chown $(NAME):$(NAME) /run/$(NAME) |
| 1035 |
echo "D /run/$(NAME) 0700 $(NAME) $(NAME) -" > /etc/tmpfiles.d/$(NAME).conf |
| 1036 |
@echo |
| 1037 |
@echo "* to enable kamailio service run:" |
| 1038 |
@echo " systemctl enable kamailio" |
| 1039 |
@echo " systemctl daemon-reload" |
| 1040 |
.PHONY: install_systemd_centos install-systemd-centos |
| 1041 |
install_systemd_centos install-systemd-centos: |
| 1042 |
sed -e "s#ExecStart=/usr/sbin/kamailio#ExecStart=$(bin_prefix)/$(bin_dir)$(NAME) |
| 1043 |
-e "s#Description=Kamailio#Description=$(NAME) |
| 1044 |
-e "s#/run/kamailio/kamailio.pid#/run/$(NAME)/$(NAME).pid#g" \ |
| 1045 |
-e "s#EnvironmentFile=-/etc/sysconfig/kamailio#EnvironmentFile=-/etc/sysconfig/$(NAME) |
| 1046 |
-e "s#CFGFILE=/etc/kamailio/kamailio.cfg#CFGFILE=$(cfg_prefix)/$(cfg_dir)$(NAME).cfg#g" \ |
| 1047 |
< ../pkg/kamailio/obs/kamailio.service \ |
| 1048 |
> /etc/systemd/system/$(NAME).service |
| 1049 |
cp ../pkg/kamailio/obs/kamailio.sysconfig \ |
| 1050 |
/etc/sysconfig/$(NAME) |
| 1051 |
mkdir -p /run/$(NAME) |
| 1052 |
chmod 0700 /run/$(NAME) |
| 1053 |
groupadd --system $(NAME) |
| 1054 |
useradd $(NAME) --system --shell /sbin/nologin -g $(NAME) --home /run/$(NAME) |
| 1055 |
chown $(NAME):$(NAME) /run/$(NAME) |
| 1056 |
echo "D /run/$(NAME) 0700 $(NAME) $(NAME) -" > /etc/tmpfiles.d/$(NAME).conf |
| 1057 |
@echo |
| 1058 |
@echo "* to enable kamailio service run:" |
| 1059 |
@echo " systemctl daemon-reload" |
| 1060 |
@echo " systemctl enable kamailio" |
| 1061 |
@echo " systemctl start kamailio" |
| 1062 |
|
| 1063 |
.PHONY: dbschema |
| 1064 |
dbschema: |
| 1065 |
-@echo "Build database schemas" |
| 1066 |
$(MAKE) -C lib/srdb1/schema |
| 1067 |
-@echo "Done" |
| 1068 |
|
| 1069 |
.PHONY: printcdefs |
| 1070 |
printcdefs: |
| 1071 |
@echo -n $(C_DEFS) |
| 1072 |
|
| 1073 |
.PHONY: printvar |
| 1074 |
printvar: |
| 1075 |
@echo "Content of <$(v)> is:" |
| 1076 |
@echo -n $($(v)) |
| 1077 |
@echo |
| 1078 |
|
| 1079 |
.PHONY: uninstall |
| 1080 |
uninstall: |
| 1081 |
@echo "-Installation details:" |
| 1082 |
@echo " *PREFIX Path is: ${PREFIX}" |
| 1083 |
@echo " *BINDIR Path is: ${bin_prefix}/${bin_dir}" |
| 1084 |
@echo " *CFGDIR Path is: ${cfg_prefix}/${cfg_dir}" |
| 1085 |
@echo " *DOCDIR Path is: ${doc_prefix}/${doc_dir}" |
| 1086 |
@echo " *LIBDIR Path is: ${lib_prefix}/${lib_dir}" |
| 1087 |
@echo " *MANDIR Path is: ${man_prefix}/${man_dir}" |
| 1088 |
@echo " *SHRDIR Path is: ${share_prefix}/${share_dir}" |
| 1089 |
@echo " *RUNDIR Path is: $(run_prefix)/$(run_dir)" |
| 1090 |
@if [ "${PREFIX}" != "/usr/local" ] ; then \ |
| 1091 |
echo "-Custom PREFIX Path" ; \ |
| 1092 |
if [ "${PREFIX}" = "/" -o "${PREFIX}" = "/usr" ] ; then \ |
| 1093 |
echo "-Custom installation in a system folder" ; \ |
| 1094 |
echo "-This is advanced installation" ; \ |
| 1095 |
echo "-You seem to be in control of what files were deployed" ; \ |
| 1096 |
echo "-Folders listed above should give hints about what to delete" ; \ |
| 1097 |
else \ |
| 1098 |
echo "-Uninstall should be just removal of the folder: ${PREFIX}" ; \ |
| 1099 |
echo "-WARNING: before deleting, be sure ${PREFIX} is not a system directory" ; \ |
| 1100 |
fi ; \ |
| 1101 |
else \ |
| 1102 |
echo "-Run following commands to uninstall:" ; \ |
| 1103 |
echo ; \ |
| 1104 |
echo "rm ${bin_prefix}/${bin_dir}${MAIN_NAME}" ; \ |
| 1105 |
if [ "${FLAVOUR}" = "kamailio" ] ; then \ |
| 1106 |
echo "rm ${bin_prefix}/${bin_dir}kamctl" ; \ |
| 1107 |
echo "rm ${bin_prefix}/${bin_dir}kamdbctl" ; \ |
| 1108 |
fi ; \ |
| 1109 |
echo "rm ${bin_prefix}/${bin_dir}kamcmd" ; \ |
| 1110 |
echo "rm ${man_prefix}/${man_dir}man5/$(MAIN_NAME).cfg.5" ; \ |
| 1111 |
echo "rm ${man_prefix}/${man_dir}man8/$(MAIN_NAME).8" ; \ |
| 1112 |
if [ "${FLAVOUR}" = "kamailio" ] ; then \ |
| 1113 |
echo "rm ${man_prefix}/${man_dir}kamctl.8" ; \ |
| 1114 |
echo "rm ${man_prefix}/${man_dir}kamdbctl.8" ; \ |
| 1115 |
fi ; \ |
| 1116 |
echo "rm -rf ${cfg_prefix}/${cfg_dir}" ; \ |
| 1117 |
echo "rm -rf ${doc_prefix}/${doc_dir}" ; \ |
| 1118 |
echo "rm -rf ${lib_prefix}/${lib_dir}" ; \ |
| 1119 |
echo "rm -rf ${share_prefix}/${share_dir}" ; \ |
| 1120 |
echo "rm -rf $(run_prefix)/$(run_dir)" ; \ |
| 1121 |
echo ; \ |
| 1122 |
echo "-WARNING: before running the commands, be sure they don't delete any system directory or file" ; \ |
| 1123 |
fi ; |
| 1124 |
@echo |