forked from OpenSIPS/opensips
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.modules
66 lines (51 loc) · 1.64 KB
/
Makefile.modules
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
#
# module Makefile
#(to be included from each module)
#
MOD_NAME=$(NAME:.so=)
ALLDEP=Makefile ../../Makefile.sources ../../Makefile.rules \
../../Makefile.modules ../../Makefile.conf
#override modules value, a module cannot have submodules
override modules=
override static_modules=
override static_modules_path=
ifeq ($(MAKELEVEL), 0)
# make called directly in the module dir!
$(warning "you should run make from the main opensips directory")
ifneq ($(makefile_defs), 1)
$(error "the local makefile does not include Makefile.defs!")
endif
ifeq (,$(wildcard ../../Makefile.conf))
$(shell cp ../../Makefile.conf.template ../../Makefile.conf)
endif
include ../../Makefile.conf
else
# called by the main Makefile
ALLDEP+=../../Makefile ../../Makefile.defs
endif
ifneq (,$(findstring SHM_EXTRA_STATS, $(DEFS)))
MEM_STATS_HDR = ../../mem/mem_stats.h
ALLDEP += $(MEM_STATS_HDR)
ifeq ($(OS), freebsd)
md5sum_cmd = md5
else
md5sum_cmd = md5sum
endif
EXPECTED_MD5=$(shell [ -f $(MEM_STATS_HDR) ] && tail -n 1 $(MEM_STATS_HDR) | awk '{print $$4}')
MODULES_MD5=$(shell find $(dir $(MEM_STATS_HDR))/../modules -maxdepth 2 -name "[Mm]akefile" | \
awk -F/ '{print $$(NF - 1)}' | sort -u | $(md5sum_cmd) | awk '{print $$1}')
ifneq ($(EXPECTED_MD5),$(MODULES_MD5))
REGENERATE_MEM_STATS=remove-mem-stats
endif
endif
# if unit tests are enabled, build any module test code into the module .so
ifneq (,$(findstring UNIT_TESTS,$(DEFS)))
extra_sources+=$(wildcard test/*.c)
endif
include ../../Makefile.sources
ifeq (,$(filter $(MOD_NAME), $(static_modules)))
CFLAGS:=$(MOD_CFLAGS)
LDFLAGS:=$(MOD_LDFLAGS)
endif
CFLAGS+=-DMOD_NAME='$(MOD_NAME)'
include ../../Makefile.rules