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
| | Adjust the Makefile to build a shared library.
diff --git a/Makefile b/Makefile
index e8933ea..5cf503c 100644
--- a/Makefile
+++ b/Makefile
@@ -130,6 +130,7 @@ endif
$(warning gs=$(gs))
endif
+build: libextract.so $(exe_dep) $(exe_buffer_test_dep) $(exe_misc_test_dep) $(exe_ziptest_dep)
# Default target - run all tests.
#
@@ -294,7 +295,7 @@ test/generated/%.pdf.mutool.text.diff: test/generated/%.pdf.mutool.text test/%.p
# Main executable.
#
exe = src/build/extract-$(build).exe
-exe_src = \
+lib_src = \
src/alloc.c \
src/astring.c \
src/boxer.c \
@@ -302,10 +303,10 @@ exe_src = \
src/document.c \
src/docx.c \
src/docx_template.c \
- src/extract-exe.c \
src/extract.c \
src/html.c \
src/join.c \
+ src/json.c \
src/mem.c \
src/odt.c \
src/odt_template.c \
@@ -318,16 +319,18 @@ exe_src = \
ifeq ($(build),memento)
- exe_src += src/memento.c
+ lib_src += src/memento.c
ifeq ($(uname),Linux)
flags_compile += -D HAVE_LIBDL
flags_link += -L $(libbacktrace) -l backtrace -l dl
endif
endif
-exe_obj := $(exe_src)
-exe_obj := $(patsubst src/%.c, src/build/%.c-$(build).o, $(exe_obj))
-exe_obj := $(patsubst src/%.cpp, src/build/%.cpp-$(build).o, $(exe_obj))
-exe_dep = $(exe_obj:.o=.d)
+lib_obj := $(lib_src)
+lib_obj := $(patsubst src/%.c, src/build/%.c-$(build).o, $(lib_obj))
+lib_obj := $(patsubst src/%.cpp, src/build/%.cpp-$(build).o, $(lib_obj))
+lib_dep = $(lib_obj:.o=.d)
+libextract.so: $(lib_obj)
+ $(CXX) $(flags_link) $^ -lz -lm -shared -o $@
exe: $(exe)
$(exe): $(exe_obj)
$(CXX) $(flags_link) -o $@ $^ -lz -lm
|