-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile.static
301 lines (265 loc) · 6.17 KB
/
Makefile.static
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
TARGET=libgcrypt.a
ifdef LIBGPGERR_DIR
LIBGPGERRDIR=$(LIBGPGERR_DIR)
else
LIBGPGERRDIR=../libgpg-error
endif
ifdef AWK_PATH
AWK := $(AWK_PATH)
else
AWK := $(shell which awk)
endif
UNAME := $(shell uname)
HOST := $(shell . ./config.guess)
HOST := $(subst x86_64,i386,$(HOST))
HOST := $(subst ppc64,ppc,$(HOST))
CFLAGS=-m32 -I. -Isrc -Icipher -Irandom -Impi -Impi/generic -I$(LIBGPGERRDIR)/src -Wall -O2 -DHAVE_CONFIG_H -D_GCRYPT_IN_LIBGCRYPT
ASMFLAGS=-m32 -O2
SYMBOL_UNDERSCORE=no
ifeq ($(UNAME), Darwin)
ifeq ($(AWK),)
AWK := ../tools/osx/awk
endif
LN_S=ln -f -s
check_arch = $(shell if as -arch $(1) -o /dev/null < /dev/null > /dev/null; then echo yes; else echo no; fi)
ifeq ($(call check_arch,i386), yes)
CFLAGS+=-arch i386
endif
ifeq ($(call check_arch,ppc), yes)
CFLAGS+=-arch ppc
endif
CFLAGS+=-fPIC -DPIC -fvisibility=hidden \
-DHAVE_USHORT_TYPEDEF=1 \
-DHAVE_DECL_SYS_SIGLIST=1 \
-DHAVE_DEV_RANDOM=1 \
-DHAVE_DLFCN_H=1 \
-DHAVE_FCNTL_H=1 \
-DHAVE_MMAP=1 \
-DHAVE_MLOCK=1 \
-DHAVE_GETPAGESIZE=1 \
-DUSE_RNDLINUX=1 \
-DHAVE_STPCPY=1 \
-DHAVE_SYSCONF=1 \
-DHAVE_SYS_SELECT_H=1 \
-DHAVE_SYS_SOCKET_H=1 \
-DHAVE_WAIT4=1 \
-DHAVE_WAITPID=1 \
-DHAVE_GETRUSAGE=1
ASMFLAGS+=-fPIC -DPIC
OS_RANDOM=random/rndlinux.o
SYMBOL_UNDERSCORE=yes
endif
ifeq ($(UNAME), Linux)
ifeq ($(AWK),)
$(error Please install awk for your distribution)
endif
LN_S=ln -f -s
CFLAGS+=-fPIC -DPIC -fvisibility=hidden \
-DHAVE_ULONG_TYPEDEF=1 \
-DHAVE_USHORT_TYPEDEF=1 \
-DGCRY_USE_VISIBILITY=1 \
-DHAVE_DECL_SYS_SIGLIST=1 \
-DHAVE_DEV_RANDOM=1 \
-DHAVE_DLFCN_H=1 \
-DHAVE_FCNTL_H=1 \
-DHAVE_MMAP=1 \
-DHAVE_MLOCK=1 \
-DHAVE_GETPAGESIZE=1 \
-DUSE_RNDLINUX=1 \
-DHAVE_STPCPY=1 \
-DHAVE_SYSCONF=1 \
-DHAVE_SYS_SELECT_H=1 \
-DHAVE_SYS_SOCKET_H=1 \
-DHAVE_WAIT4=1 \
-DHAVE_WAITPID=1 \
-DHAVE_GETRUSAGE=1
ASMFLAGS+=-fPIC -DPIC
OS_RANDOM=random/rndlinux.o
endif
WIN32=
ifeq ($(findstring CYG,$(UNAME)), CYG)
WIN32=1
CC=gcc-3
endif
ifeq ($(findstring MINGW,$(UNAME)), MINGW)
WIN32=1
CC=gcc
endif
ifdef WIN32
ifeq ($(AWK),)
AWK := ../tools/win32/gawk.exe
endif
LN_S=ln -s -f
CFLAGS+=-DWIN32 \
-DHAVE_W32_SYSTEM=1 \
-DHAVE_WINSOCK2_H=1 \
-DHAVE_WS2TCPIP_H=1 \
-DHAVE_DECL_SYS_SIGLIST=0 \
-DHAVE_DOSISH_SYSTEM=1 \
-DHAVE_DRIVE_LETTERS=1 \
-DHAVE_GETPAGESIZE=1 \
-DUSE_RNDW32=1
OS_RANDOM=random/rndw32.o
SYMBOL_UNDERSCORE=yes
endif
MPIH_SRC=$(shell AWK=${AWK} srcdir=`pwd` host=${HOST} ac_cv_sys_symbol_underscore=${SYMBOL_UNDERSCORE} try_asm_modules=yes . ./call_config.links)
$(shell for lnk in $(MPIH_SRC); do \
$(LN_S) `echo $$lnk |${AWK} '{ split($$0, a, ":"); print substr(a[2], 5); print a[1] }'`; \
done)
ifneq ($(wildcard mpi/mpih-add1-asm.S),)
OBJ_ADD1=mpi/mpih-add1-asm.o
else
ifneq ($(wildcard mpi/mpih-add1.c),)
OBJ_ADD1=mpi/mpih-add1.o
endif
endif
ifneq ($(wildcard mpi/mpih-lshift-asm.S),)
OBJ_LSHIFT=mpi/mpih-lshift-asm.o
else
ifneq ($(wildcard mpi/mpih-lshift.c),)
OBJ_LSHIFT=mpi/mpih-lshift.o
endif
endif
ifneq ($(wildcard mpi/mpih-sub1-asm.S),)
OBJ_SUB1=mpi/mpih-sub1-asm.o
else
ifneq ($(wildcard mpi/mpih-sub1.c),)
OBJ_SUB1=mpi/mpih-sub1.o
endif
endif
ifneq ($(wildcard mpi/mpih-mul3-asm.S),)
OBJ_MUL3=mpi/mpih-mul3-asm.o
else
ifneq ($(wildcard mpi/mpih-mul3.c),)
OBJ_MUL3=mpi/mpih-mul3.o
endif
endif
ifneq ($(wildcard mpi/mpih-rshift-asm.S),)
OBJ_RSHIFT=mpi/mpih-rshift-asm.o
else
ifneq ($(wildcard mpi/mpih-rshift.c),)
OBJ_RSHIFT=mpi/mpih-rshift.o
endif
endif
ifneq ($(wildcard mpi/mpih-mul2-asm.S),)
OBJ_MUL2=mpi/mpih-mul2-asm.o
else
ifneq ($(wildcard mpi/mpih-mul2.c),)
OBJ_MUL2=mpi/mpih-mul2.o
endif
endif
ifneq ($(wildcard mpi/mpih-mul1-asm.S),)
OBJ_MUL1=mpi/mpih-mul1-asm.o
else
ifneq ($(wildcard mpi/mpih-mul1.c),)
OBJ_MUL1=mpi/mpih-mul1.o
endif
endif
objects= \
src/visibility.o \
src/misc.o \
src/global.o \
src/sexp.o \
src/hwfeatures.o \
src/stdmem.o \
src/secmem.o \
src/missing-string.o \
src/module.o \
src/fips.o \
src/hmac256.o \
src/ath.o \
cipher/camellia.o \
cipher/pubkey.o \
cipher/sha256.o \
cipher/md5.o \
cipher/des.o \
cipher/primegen.o \
cipher/rsa.o \
cipher/rfc2268.o \
cipher/cast5.o \
cipher/cipher.o \
cipher/md4.o \
cipher/hash-common.o \
cipher/whirlpool.o \
cipher/ecc.o \
cipher/twofish.o \
cipher/rijndael.o \
cipher/dsa.o \
cipher/seed.o \
cipher/sha512.o \
cipher/tiger.o \
cipher/arcfour.o \
cipher/sha1.o \
cipher/ac.o \
cipher/crc.o \
cipher/elgamal.o \
cipher/rmd160.o \
cipher/hmac-tests.o \
cipher/blowfish.o \
cipher/serpent.o \
cipher/md.o \
cipher/camellia-glue.o \
random/random-csprng.o \
random/random.o \
random/random-fips.o \
$(OS_RANDOM) \
random/rndhw.o \
$(OBJ_ADD1) \
mpi/mpi-inv.o \
mpi/mpi-mod.o \
mpi/mpi-bit.o \
mpi/mpi-pow.o \
mpi/mpi-div.o \
$(OBJ_LSHIFT) \
mpi/mpi-mpow.o \
$(OBJ_SUB1) \
mpi/mpi-cmp.o \
$(OBJ_MUL3) \
mpi/mpi-scan.o \
mpi/mpiutil.o \
mpi/mpi-add.o \
mpi/mpicoder.o \
$(OBJ_RSHIFT) \
mpi/mpi-gcd.o \
$(OBJ_MUL2) \
mpi/ec.o \
mpi/mpih-mul.o \
mpi/mpi-mul.o \
mpi/mpih-div.o \
mpi/mpi-inline.o \
$(OBJ_MUL1) \
all: $(TARGET)
%.o: %.c
$(CC) -o $@ $(CFLAGS) -c $<
mpi/mpih-add1-asm.o: mpi/mpih-add1-asm.S
$(CC) -o $@ $(ASMFLAGS) -c $<
mpi/mpih-lshift-asm.o: mpi/mpih-lshift-asm.S
$(CC) -o $@ $(ASMFLAGS) -c $<
mpi/mpih-sub1-asm.o: mpi/mpih-sub1-asm.S
$(CC) -o $@ $(ASMFLAGS) -c $<
mpi/mpih-mul3-asm.o: mpi/mpih-mul3-asm.S
$(CC) -o $@ $(ASMFLAGS) -c $<
mpi/mpih-rshift-asm.o: mpi/mpih-rshift-asm.S
$(CC) -o $@ $(ASMFLAGS) -c $<
mpi/mpih-mul2-asm.o: mpi/mpih-mul2-asm.S
$(CC) -o $@ $(ASMFLAGS) -c $<
mpi/mpih-mul1-asm.o: mpi/mpih-mul1-asm.S
$(CC) -o $@ $(ASMFLAGS) -c $<
mpi/mpih-add1.o: mpi/mpih-add1.c
$(CC) -o $@ $(CFLAGS) -c $<
mpi/mpih-lshift.o: mpi/mpih-lshift.c
$(CC) -o $@ $(CFLAGS) -c $<
mpi/mpih-sub1.o: mpi/mpih-sub1.c
$(CC) -o $@ $(CFLAGS) -c $<
mpi/mpih-mul3.o: mpi/mpih-mul3.c
$(CC) -o $@ $(CFLAGS) -c $<
mpi/mpih-rshift.o: mpi/mpih-rshift.c
$(CC) -o $@ $(CFLAGS) -c $<
mpi/mpih-mul2.o: mpi/mpih-mul2.c
$(CC) -o $@ $(CFLAGS) -c $<
mpi/mpih-mul1.o: mpi/mpih-mul1.c
$(CC) -o $@ $(CFLAGS) -c $<
$(TARGET): $(objects)
$(AR) rcs $@ $(objects)
clean:
rm -f src/*.o cipher/*.o random/*.o mpi/*.o mpi/*.S mpi/mpi-asm-defs.h $(TARGET)