forked from OpenSIPS/opensips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.modules
61 lines (47 loc) · 1.46 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
#
# 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 -name "[Mm]akefile" | \
awk -F/ '{print $$(NF - 1)}' | sort | $(md5sum_cmd) | awk '{print $$1}')
ifneq ($(EXPECTED_MD5),$(MODULES_MD5))
REGENERATE_MEM_STATS=remove-mem-stats
endif
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