-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
200 lines (184 loc) · 4.42 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# remove -g when done debuging
CC=cc
PREFIX=/usr/local/bin
LDFLAGS=\
-L/usr/local/lib\
-L/usr/lib32\
-L/usr/lib64\
-L/usr/lib
# Some good defaults for library paths on unix OS's
# /usr/local/lib is openbse, while the others are linux
CFLAGS=\
-Wall\
--std=c99 \
-O3
CPPFLAGS=\
-I/usr/local/include\
-I/usr/include
# These are just some good basic defaults
# This is here so the user can easily change this
# without changin the other flags
# (/usr/local/include is openbsd, other is linux)
# libraries used (as flags)
LDLIBS=#-liconv
#-lcurl
#-luac
# NCBI detects and refuses conections for curl
# My gcc command (except for libraries)
gccArgs=\
cStrFun.c\
cnvtNbibToBib.c\
nbibToBib.c\
-o nbibToBib
all: getLibiconvStatic getUnac
# the first install works for debain, while the
# second works for openbsd
$(CC)\
-static\
-I.\
-L.\
$(CFLAGS)\
unac.c\
$(gccArgs) ||\
$(CC)\
-static\
-Iinclude\
-Llib\
-liconv\
$(CFLAGS)\
unac.c\
$(gccArgs)
make normaccent:
$(CC)\
--std=c99\
-static\
-DNORMACCENT\
$(CFLAGS)\
$(gccArgs)
# this is here for debuging
make openbsd:
egcc \
--std=c99\
-static\
-DNORMACCENT\
$(CFLAGS)\
$(gccArgs)
install:
cp nbibToBib $(PREFIX)/nbibToBib;
chmod a+x $(PREFIX)/nbibToBib;
cleanall: clean cleandepend
clean:
printf "Removing complied files from static libiconv\n"
rm -r lib include share bin
cleandepend:
rm libiconv-1.9.1.tar.gz;
rm unac.h unac.c;
# Get a static build of libiconv
getLibiconvStatic:
# Check if libiconv already exits, if not download
ls libiconv-1.9.1.tar.gz ||\
curl\
--output libiconv-1.9.1.tar.gz\
ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.1.tar.gz
tar -xzf libiconv-1.9.1.tar.gz
ls lib || (cd libiconv-1.9.1 &&\
./configure\
CC=$(CC)\
--with-iconv=yes\
--enable-static\
--disable-rpath\
--prefix=$$(printf "%s/.." $$(pwd))\
--exec-prefix=$$(printf "%s/.." $$(pwd)))
ls lib || make -C libiconv-1.9.1 ||\
rm -r -f libiconv-1.9.1
ls lib || make -C libiconv-1.9.1 install &&\
rm -r -f libiconv-1.9.1
#rm libiconv-1.9.1.tar.gz
# no longer need
getUnac:
ls unac.c ||\
ls unac ||\
git clone https://github.com/QuickDict/unac
ls unac.c || cp unac/unac.c ./
ls unac.h || cp unac/unac.h ./
rm -r -f unac
# remove problematic lines
sed '/unac_version/,/}/d;' unac.c > tmp.c
sed '/unac_version(void)/d;' unac.h > tmp.h
mv tmp.c unac.c
mv tmp.h unac.h
# This is here if hte user has installed unac
linkunac:
$(CC)\
-DLINKUNAC\
-lunac\
$(LDFLAGS)\
$(CFLAGS)\
$(CPPFLAGS)\
$(LDLIBS)\
$(gccArgs)
# These were past install variations
## if the user had unac installed
#
## In this version the user provided the unac.c/h files
#linkincov:
# $(CC)\
# $(LDFLAGS)\
# -liconv\
# $(CFLAGS)\
# $(CPPFLAGS)\
# $(LDLIBS)\
# unac.c\
# $(gccArgs)
#
#pdf:
# $(CC)\
# -DPDF\
# -lcurl\
# -liconv\
# $(LDFLAGS)\
# $(CFLAGS)\
# $(CPPFLAGS)\
# $(LDLIBS)\
# unac.c\
# getPMCPdf.c\
# $(gccArgs)
#
## This was my static biuld using curl. It needed https
## support, which means tracking additional dependencies
##staticPdf: getLibiconv getUnac getCurl
# #$(CC) -static -Iinclude -Llib $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) $(LDLIBS) $(gccArgs)
#
## This is to get arounc unac issues for openbsd
#sourceUNAC: getLibiconv getUnac
# printf "Building pubmedToBib\n"
#
#getCurl:
# env AUTOMAKE_VERSION=1.16 AUTOCONV_VERSION=2.71 autoreconf-2.71 -f -i
# # Need to figure out library for https: suspect nghttp2
# # --enable-ares was suggested for static build
# #--disable-pthreads
# ./configure\
# CC=$(CC)\
# --without-brotli\
# --without-hyper\
# --without-libgsasl\
# --without-libidn2\
# --without-libpsl\
# --without-libssh\
# --without-libssh2\
# --without-zstd\
# --prefix=$$(printf "%s/.." $$(pwd))\
# --enable-http\
# --enable-ftp\
# --disable-ldap\
# --without-nghttp2\
# --enable-static\
# --disable-shared\
# --without-ssl\
# --disable-imap\
# --disable-smtp\
# --without-zlib\
# --enable-file\
# --exec-prefix=$$(printf "%s/.." $$(pwd))
#