Debian Codegraph @

third-party/libjwt/Makefile

raw symbols SCIP
1 .PHONY: all install clean distclean configure
2
3 .NOTPARALLEL:
4
5 include ../versions.mak
6 export LIBJWT_DIR := $(shell pwd -P)
7 JANSSON_DIR := $(shell realpath $(LIBJWT_DIR)/../jansson)
8
9 SPECIAL_TARGETS :=
10
11 ifneq ($(findstring configure,$(MAKECMDGOALS)),)
12 # Run from $(ASTTOPDIR)/configure
13 SPECIAL_TARGETS += configure
14 endif
15
16 ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)
17 # clean or distclean
18 SPECIAL_TARGETS += clean
19 endif
20
21 ifeq ($(findstring uninstall,$(MAKECMDGOALS)),uninstall)
22 SPECIAL_TARGETS += uninstall
23 endif
24
25
26 ifneq ($(wildcard ../../makeopts),)
27 include ../../makeopts
28 endif
29
30 ifeq ($(SPECIAL_TARGETS),)
31 # Run locally or from $(ASTTOPDIR)/Makefile. All include files should be present
32 ifeq ($(wildcard ../../makeopts),)
33 $(error ASTTOPDIR/configure hasn't been run)
34 endif
35
36 ifeq ($(LIBJWT_BUNDLED),yes)
37 ifneq ($(wildcard ../../menuselect.makeopts),)
38 include ../../menuselect.makeopts
39 else
40 $(warning ASTTOPDIR/menuselect hasn't been run yet. Can't find debug options.)
41 endif
42
43 all: dist/usr/lib/libjwt.a
44 else
45 all:
46 endif
47 endif
48
49 include ../../Makefile.rules
50 include ../Makefile.rules
51 include Makefile.rules
52
53 OPTIMIZE_CFLAGS = -g3
54 ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)),)
55 OPTIMIZE_CFLAGS += $(OPTIMIZE)
56 endif
57
58 ECHO_PREFIX := $(ECHO_PREFIX) echo '[libjwt] '
59 SHELL_ECHO_PREFIX := echo '[libjwt] '
60
61 dist/usr/lib/libjwt.a: source/config.status
62 $(ECHO_PREFIX) Building bundled libjwt.
63 $(CMD_PREFIX) (cd source; make $(REALLY_QUIET))
64 $(CMD_PREFIX) (cd source; make install DESTDIR=$(LIBJWT_DIR)/dist $(REALLY_QUIET))
65 ifeq ($(JANSSON_BUNDLED),yes)
66 # Modules that need to use json manipulation functions will do
67 # so through the ast_json wrappers which cause the main asterisk
68 # executable to link to either the system implementation of jansson
69 # or the bundled jansson. libjwt also needs to call jansson functions
70 # directly and if we're not using the bundled version of jansson,
71 # this works fine bcause the dynamic linker can get the symbols
72 # directly from the system-installed version of jansson when the
73 # module using libjwt loads. If we're using bundled jansson however,
74 # those symbols exist only in the main asterisk executable and a
75 # library can't resolve against them. The result is that a module
76 # making jwt_ calls will fail to load at runtime with unresolved
77 # json_ symbols. To address this, we create a combined library
78 # containing both bundled libjwt and bundled jansson so a module
79 # will have all symbols resolved correctly.
80 $(CMD_PREFIX) mv dist/usr/lib/libjwt.a dist/usr/lib/libjwt_orig.a
81 $(CMD_PREFIX) cd dist/usr/lib ; $(AR) -rcsT libjwt.a libjwt_orig.a \
82 $(JANSSON_DIR)/dist/usr/lib/libjansson.a
83 endif
84
85 .DELETE_ON_ERROR:
86
87 $(DOWNLOAD_DIR)/$(TARBALL_FILE): ../versions.mak
88 $(CMD_PREFIX) ($(TARBALL_EXISTS) && $(TARBALL_VERIFY) && touch $@) || (rm -rf $@ ;\
89 $(TARBALL_DOWNLOAD)) || (rm -rf $@ ;\
90 $(SHELL_ECHO_PREFIX) Retrying download ; $(TARBALL_DOWNLOAD))
91
92 source/.unpacked: $(DOWNLOAD_DIR)/$(TARBALL_FILE)
93 $(CMD_PREFIX) $(TARBALL_VERIFY) || (rm -rf $@ ;\
94 $(SHELL_ECHO_PREFIX) Retrying download ; $(TARBALL_DOWNLOAD))
95 $(ECHO_PREFIX) Unpacking $<
96 -@rm -rf source libjwt-*/ >/dev/null 2>&1
97 $(CMD_PREFIX) $(TAR) -xf $<
98 @mv libjwt-$(LIBJWT_VERSION) source
99 $(ECHO_PREFIX) Applying patches "$(realpath patches)" "$(realpath .)/source"
100 $(CMD_PREFIX) ../apply_patches $(QUIET_CONFIGURE) "$(realpath patches)" "$(realpath .)/source"
101 -@touch source/.unpacked
102
103 .rebuild_needed: $(wildcard ../../.lastclean)
104 $(ECHO_PREFIX) Rebuilding
105 $(CMD_PREFIX) $(MAKE) clean $(REALLY_QUIET)
106
107 source/config.status: source/.unpacked Makefile.rules .rebuild_needed
108 $(ECHO_PREFIX) Configuring
109 $(CMD_PREFIX) (cd source ; ./configure $(QUIET_CONFIGURE) $(LIBJWT_CONFIG_OPTS) --disable-shared \
110 --enable-static --prefix=/usr --libdir=/usr/lib CFLAGS="$(OPTIMIZE_CFLAGS) -fPIC")
111
112 configure: source/config.status
113
114 install:
115 uninstall:
116
117 clean:
118 $(ECHO_PREFIX) Cleaning
119 +-$(CMD_PREFIX) rm -rf dist
120 +-$(CMD_PREFIX) test -d source && $(SUBMAKE) -C source clean $(REALLY_QUIET) || :
121
122 distclean:
123 $(ECHO_PREFIX) Distcleaning
124 -$(CMD_PREFIX) rm -rf dist source libjwt-*.tar.gz .rebuild_needed