forked from lithiumFlower/doctotext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
158 lines (145 loc) · 3.99 KB
/
Makefile
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
ifneq (,$(filter $(ARCH),win32 win64))
ifeq ($(ARCH),win32)
STRIP = i686-w64-mingw32-strip
else
STRIP = strip
endif
EXEEXT=.exe
SOPRE =
SOEXT = .dll
WIN = 1
else
ifeq ($(ARCH),x86-linux)
STRIP = strip
EXEEXT =
SOEXT = .so
SOPRE = lib
WIN = 0
else
UNAME = $(shell uname)
ifeq ($(UNAME),Darwin)
STRIP = strip -x
ARCH = i386-x86_64-macosx
SOEXT = .dylib
else
STRIP = strip
UNAME_M = $(shell uname -m)
ifeq ($(UNAME_M),x86_64)
ARCH = x86_64-linux
else
ARCH = x86-linux
endif
SOEXT = .so
endif
EXEEXT=
SOPRE = lib
WIN = 0
endif
endif
ifeq ($(DEBUG),1)
override ARCH := $(ARCH)-debug
STRIP = touch
endif
build: version.h src doc/html
$(MAKE) -C 3rdparty htmlcxx
$(MAKE) -C 3rdparty wv2
$(MAKE) -C 3rdparty unzip
#$(MAKE) -C 3rdparty aj16
#$(MAKE) -C 3rdparty ak12
#$(MAKE) -C 3rdparty ag15
#$(MAKE) -C 3rdparty ac16
#$(MAKE) -C 3rdparty ToUnicode
$(MAKE) -C 3rdparty libcharsetdetect
$(MAKE) -C 3rdparty mimetic
ifeq ($(WIN),1)
$(MAKE) -C 3rdparty pthreads
$(MAKE) -C 3rdparty libxml2
endif
$(MAKE) -C src
rm -rf build
mkdir build
cp src/doctotext$(EXEEXT) build
cp src/$(SOPRE)doctotext$(SOEXT) build/
ifeq ($(WIN),1)
cp 3rdparty/libiconv/bin/libiconv-2.dll build
cp 3rdparty/pthreads/bin/pthreadGC2.dll build
cp 3rdparty/libxml2/bin/libxml2-2.dll build
cp 3rdparty/zlib/bin/zlib1.dll build
cp 3rdparty/wv2/bin/libwv2-1.dll build
IFS=: && for f in $$PATH; do \
if test -f "$$f/libgcc_s_sjlj-1.dll"; then \
cp "$$f/libgcc_s_sjlj-1.dll" build/; \
break; \
fi \
done
IFS=: && for f in $$PATH; do \
if test -f "$$f/libstdc++-6.dll"; then \
cp "$$f/libstdc++-6.dll" build/; \
break; \
fi \
done
cp src/libdoctotext.a build
$(STRIP) build/*.dll
else
ifeq ($(UNAME),Darwin)
$(STRIP) build/*.dylib
chmod +xwr build/*.dylib
install_name_tool -id @rpath/libdoctotext.dylib build/libdoctotext.dylib
echo './doctotext "$$@"' > build/doctotext.sh
else
cp 3rdparty/libcharsetdetect/lib/libcharsetdetect.so build
cp 3rdparty/wv2/lib/libwv2.so.1 build
cp 3rdparty/mimetic/lib/libmimetic.so.0 build
$(STRIP) build/*.so*
echo 'LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH ./doctotext "$$@"' > build/doctotext.sh
endif
chmod u+x build/doctotext.sh
endif
cp $(foreach f,plain_text_extractor formatting_style metadata doctotext_c_api link exception attachment variant,src/${f}.h) build/
mkdir build/doc
mkdir build/resources
# cp ./3rdparty/ac16/CMap/* build/resources
# cp ./3rdparty/ag15/CMap/* build/resources
# cp ./3rdparty/aj16/CMap/* build/resources
# cp ./3rdparty/ak12/CMap/* build/resources
# cp ./3rdparty/ToUnicode/* build/resources
cp ./3rdparty/pdf_font_metrics.txt build/resources
cp -r doc/html doc/index.html build/doc
cp ChangeLog VERSION build
$(MAKE) -C tests
version.h: VERSION
echo "#define VERSION \"`cat VERSION`\"" > version.h
.PHONY:
doc/html: doc/Doxyfile src
cd doc && \
rm -rf html && \
cat Doxyfile | sed s/VERSION/`cat ../VERSION`/ | doxygen -
clean:
rm -rf build
rm -f version.h
rm -rf doc/html
$(MAKE) -C 3rdparty clean
$(MAKE) -C src clean
$(MAKE) -C tests clean
snapshot: clean
snapshot_fn=$$TMPDIR/doctotext-`date +%Y%m%d`.tar.bz2 && \
tar -cjvf $$snapshot_fn ../doctotext --exclude .svn --exclude "*.kdev*" --exclude ".DS_Store" --exclude "*.tar.*" --exclude "*.zip" --exclude "VERSION" && \
mv $$snapshot_fn .
release: clean
release_fn=$$TMPDIR/doctotext-`cat VERSION | cut -f1,2 -d.`-`date +%Y%m%d`.tar.bz2 && \
tar -cjvf $$release_fn ../doctotext --exclude .svn --exclude "*.kdev*" --exclude ".DS_Store" --exclude "*.tar.*" --exclude "*.zip" --exclude "generate*.sh" --exclude "VERSION" && \
mv $$release_fn .
snapshot-bin: build
mv build doctotext
tar -cjvf doctotext-`date +%Y%m%d`-$(ARCH).tar.bz2 doctotext
mv doctotext build
release-bin: build
mv build doctotext
tar -cjvf doctotext-`cat VERSION`-$(ARCH).tar.bz2 doctotext
mv doctotext build
unzip101e/.unpacked: unzip101e.zip
tar -xjvf unzip101e.zip
touch unzip101e.zip/.unpacked
unzip101e.zip:
wget http://www.winimage.com/zLibDll/unzip101e.zip
rm -rf unzip101e