30351861 |
# Kamailio build system
|
c6f75a7e |
#
# utils Makefile
#(to be included from each util/ subdirectory)
#
|
6f7433d3 |
#
# Variables that should be defined in the util Makefiles, prior to including
# this makefile:
#
# NAME - util binary name, with no path (MUST).
#
# COREPATH - path to the main/core directory (OPTIONAL, default ../..)
#
# DEFS - local extra defines (OPTIONAL)
#
# LIBS - local extra libs (OPTIONAL)
#
# SER_LIBS - ser/sr libs that should be compiled, linked against and installed
# along the binary. The format is: <path>/<shortname>, e.g.
# SER_LIBS=../../lib/srdb2/srdb2 for libsrdb2 with the sources
# in ../../lib/srdb2. (OPTIONAL)
#
|
911f3742 |
UTIL_NAME=$(NAME)
|
c6f75a7e |
# default path to the core makefiles
|
df6be9e3 |
COREPATH ?=../../src
|
c6f75a7e |
ALLDEP=Makefile $(COREPATH)/Makefile.sources $(COREPATH)/Makefile.rules \
$(COREPATH)/Makefile.utils $(COREPATH)/Makefile.dirs $(COREPATH)/config.mak
#override modules value, an util cannot have submodules
override modules=
override static_modules=
override static_modules_path=
|
911f3742 |
# temporary def (visible only in the util makefile, not exported)
|
89d40068 |
DEFS += -DMOD_NAME="utils/$(UTIL_NAME)"
|
911f3742 |
|
c6f75a7e |
ifneq ($(makefile_defs_included),1)
$(error "the local makefile does not include Makefile.defs!")
endif
ifeq ($(MAKELEVEL), 0)
# make called directly in the module dir!
else
# called by the main Makefile
ALLDEP+=$(COREPATH)/Makefile
endif
include $(COREPATH)/Makefile.sources
# if config was not loaded (makefile_defs!=1) ignore
# the rest of makefile and try only to remake the config
ifeq ($(makefile_defs),1)
|
89d40068 |
# set CFLAGS & LDFLAGS
CFLAGS:=$(UTILS_CFLAGS)
LDFLAGS:=$(UTILS_LDFLAGS)
|
911f3742 |
err_fail?=1
|
c6f75a7e |
include $(COREPATH)/Makefile.dirs
include $(COREPATH)/Makefile.targets
include $(COREPATH)/Makefile.rules
|
911f3742 |
include $(COREPATH)/Makefile.shared
# default: if not overwritten by the main Makefile, install in bin_dir
util_dst=$(bin_prefix)/$(bin_dir)
$(util_dst):
mkdir -p $(util_dst)
|
c6f75a7e |
modules:
|
911f3742 |
.PHONY: install
.PHONY: install-libs
|
e378b3c1 |
install: $(NAME) $(util_dst) install-libs install-util-man
|
911f3742 |
$(INSTALL_TOUCH) $(util_dst)/$(NAME)
$(INSTALL_BIN) $(NAME) $(util_dst)
|
6f7433d3 |
ifneq (,$(SER_LIBS))
|
911f3742 |
install-libs:
@for lib in $(dir $(SER_LIBS)); do \
$(call try_err, $(MAKE) -C "$${lib}" install-if-newer ) ;\
|
6f7433d3 |
done; true
else
install-libs:
endif # $(SER_LIBS)
|
911f3742 |
.PHONY: install-if-newer
install-if-newer: $(util_dst)/$(NAME)
$(util_dst)/$(NAME): $(NAME)
@$(MAKE) install
|
c6f75a7e |
# README build rules
ifneq (,$(wildcard doc/Makefile))
#doc/Makefile present => we can generate README
README: doc/*.xml
|
911f3742 |
$(MAKE) -C doc $(UTIL_NAME).txt
mv doc/$(UTIL_NAME).txt $@
|
c6f75a7e |
else
# do nothing
README:
endif
#man page build rules
|
911f3742 |
ifneq (,$(wildcard $(UTIL_NAME).xml))
|
35aef078 |
ifneq ($(DOCBOOKMAN),)
|
911f3742 |
$(UTIL_NAME).7: $(UTIL_NAME).xml
|
35aef078 |
$(DOCBOOKMAN) -s ../../doc/stylesheets/serdoc2man.xsl $<
|
c6f75a7e |
|
911f3742 |
man: $(UTIL_NAME).7
|
c6f75a7e |
else
man:
|
35aef078 |
@echo "info - no docbook to man tool to convert $(UTIL_NAME).xml"
endif
else
man:
|
c6f75a7e |
endif
|
a0b36a90 |
$(man_prefix)/$(man_dir)/man8:
mkdir -p $(man_prefix)/$(man_dir)/man8
|
e378b3c1 |
.PHONY: install-util-man
#src-name man page install rules
ifneq (,$(wildcard $(UTIL_SRC_NAME).8))
install-util-man: $(man_prefix)/$(man_dir)/man8
|
a0b36a90 |
sed -e "s#$(UTIL_SRC_NAME)#$(UTIL_NAME)#g" \
|
e378b3c1 |
-e "s#$(SRC_NAME)#$(MAIN_NAME)#g" \
< $(UTIL_SRC_NAME).8 > $(man_prefix)/$(man_dir)/man8/$(UTIL_NAME).8
|
a0b36a90 |
chmod 644 $(man_prefix)/$(man_dir)/man8/$(UTIL_NAME).8
|
e378b3c1 |
else
install-util-man:
endif
|
c6f75a7e |
endif # ifeq($(makefile_defs),1)
include $(COREPATH)/Makefile.cfg
|