security/nss/lib/freebl/mpi/Makefile.win

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:1004503d2028
1 #
2 # Makefile.win - gmake Makefile for building MPI with MSVC on NT
3
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8 ## Define CC to be the C compiler you wish to use. The GNU cc
9 ## compiler (gcc) should work, at the very least
10 #CC=cc
11 #CC=gcc
12 CC=cl.exe
13 ifeq ($(CPU_ARCH),x86_64)
14 AS=ml64.exe
15 else
16 AS=ml.exe
17 endif
18
19 ##
20 ## Define PERL to point to your local Perl interpreter. It
21 ## should be Perl 5.x, although it's conceivable that Perl 4
22 ## might work ... I haven't tested it.
23 ##
24 #PERL=/usr/bin/perl
25 #PERL=perl
26
27 ##
28 ## Define CFLAGS to contain any local options your compiler
29 ## setup requires.
30 ##
31 ## Conditional compilation options are no longer here; see
32 ## the file 'mpi-config.h' instead.
33 ##
34 MPICMN = -I. -DMP_API_COMPATIBLE -DMP_IOFUNC
35
36 ifeq ($(CPU_ARCH),x86_64)
37 AS_SRCS = mpi_x86_64.asm
38 CFLAGS = -O2 -Z7 -MD -W3 -nologo -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \
39 -DWIN32 -D_WIN64 -D_AMD64_ -D_M_AMD64 -D_WINDOWS -DWIN95 $(MPICMN)
40 ASFLAGS = -Cp -Sn -Zi -I.
41 else
42 #NT
43 AS_SRCS = mpi_x86.asm
44 MPICMN += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE -DMP_ASSEMBLY_DIV_2DX1D
45 #CFLAGS= -Od -Z7 -MD -W3 -nologo -D_X86_ -DXP_PC \
46 -DDEBUG -D_DEBUG -UNDEBUG -DWIN32 -D_WINDOWS -DWIN95 $(MPICMN)
47 #CFLAGS = -O2 -MD -W3 -nologo -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \
48 -DWIN32 -D_WINDOWS -DWIN95 $(MPICMN)
49 #CFLAGS = -Od -Z7 -MD -W3 -nologo -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \
50 -DWIN32 -D_WINDOWS -DWIN95 $(MPICMN)
51 CFLAGS = -O2 -Z7 -MD -W3 -nologo -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \
52 -DWIN32 -D_WINDOWS -DWIN95 $(MPICMN)
53 ASFLAGS = -Cp -Sn -Zi -coff -I.
54 endif
55
56 ##
57 ## Define LIBS to include any libraries you need to link against.
58 ## If NO_TABLE is define, LIBS should include '-lm' or whatever is
59 ## necessary to bring in the math library. Otherwise, it can be
60 ## left alone, unless your system has other peculiar requirements.
61 ##
62 LIBS=#-lmalloc#-lefence#-lm
63
64 ##
65 ## Define RANLIB to be the library header randomizer; you might not
66 ## need this on some systems (just set it to 'echo' on these systems,
67 ## such as IRIX)
68 ##
69 RANLIB=echo
70
71 ##
72 ## This is the version string used for the documentation and
73 ## building the distribution tarball. Don't mess with it unless
74 ## you are releasing a new version
75 VERS=1.7p6
76
77 ## ----------------------------------------------------------------------
78 ## You probably don't need to change anything below this line...
79 ##
80
81 ##
82 ## This is the list of source files that need to be packed into
83 ## the distribution file
84 SRCS= mpi.c mpprime.c mplogic.c mpmontg.c mpi-test.c primes.c tests/ \
85 utils/gcd.c utils/invmod.c utils/lap.c \
86 utils/ptab.pl utils/sieve.c utils/isprime.c\
87 utils/dec2hex.c utils/hex2dec.c utils/bbs_rand.c \
88 utils/bbsrand.c utils/prng.c utils/primegen.c \
89 utils/basecvt.c utils/makeprime.c\
90 utils/fact.c utils/exptmod.c utils/pi.c utils/metime.c \
91 utils/mpi.h utils/mpprime.h mulsqr.c \
92 make-test-arrays test-arrays.txt all-tests make-logtab \
93 types.pl stats timetest multest
94
95 ## These are the header files that go into the distribution file
96 HDRS=mpi.h mpi-config.h utils/mpi.h utils/mpi-config.h mpprime.h mplogic.h \
97 utils/bbs_rand.h tests/mpi.h tests/mpprime.h
98
99 ## These are the documentation files that go into the distribution file
100 DOCS=README doc utils/README utils/PRIMES
101
102 ## This is the list of tools built by 'make tools'
103 TOOLS=gcd.exe invmod.exe isprime.exe lap.exe dec2hex.exe hex2dec.exe \
104 primegen.exe prng.exe basecvt.exe fact.exe exptmod.exe pi.exe makeprime.exe
105
106 AS_OBJS = $(AS_SRCS:.asm=.obj)
107 LIBOBJS = mpprime.obj mpmontg.obj mplogic.obj mpi.obj $(AS_OBJS)
108 LIBHDRS = mpi-config.h mpi-priv.h mpi.h
109 APPHDRS = mpi-config.h mpi.h mplogic.h mpprime.h
110
111
112 help:
113 @ echo ""
114 @ echo "The following targets can be built with this Makefile:"
115 @ echo ""
116 @ echo "mpi.lib - arithmetic and prime testing library"
117 @ echo "mpi-test - test driver (requires MP_IOFUNC)"
118 @ echo "tools - command line tools"
119 @ echo "doc - manual pages for tools"
120 @ echo "clean - clean up objects and such"
121 @ echo "distclean - get ready for distribution"
122 @ echo "dist - distribution tarball"
123 @ echo ""
124
125 .SUFFIXES: .c .obj .i .lib .exe .asm
126
127 .c.i:
128 $(CC) $(CFLAGS) -E $< > $@
129
130 .c.obj:
131 $(CC) $(CFLAGS) -c $<
132
133 .asm.obj:
134 $(AS) $(ASFLAGS) -c $<
135
136 .obj.exe:
137 $(CC) $(CFLAGS) -Fo$@ $<
138
139 #---------------------------------------
140
141 $(LIBOBJS): $(LIBHDRS)
142
143 logtab.h: make-logtab
144 $(PERL) make-logtab > logtab.h
145
146 mpi.obj: mpi.c logtab.h $(LIBHDRS)
147
148 mplogic.obj: mplogic.c mpi-priv.h mplogic.h $(LIBHDRS)
149
150 mpmontg.obj: mpmontg.c mpi-priv.h mplogic.h mpprime.h $(LIBHDRS)
151
152 mpprime.obj: mpprime.c mpi-priv.h mpprime.h mplogic.h primes.c $(LIBHDRS)
153
154 mpi_mips.obj: mpi_mips.s
155 $(CC) -Fo$@ $(ASFLAGS) -c mpi_mips.s
156
157 mpi.lib: $(LIBOBJS)
158 ar -cvr mpi.lib $(LIBOBJS)
159 $(RANLIB) mpi.lib
160
161 lib libs: mpi.lib
162
163 #---------------------------------------
164
165 MPTESTOBJS = mptest1.obj mptest2.obj mptest3.obj mptest3a.obj mptest4.obj \
166 mptest4a.obj mptest4b.obj mptest6.obj mptest7.obj mptest8.obj mptest9.obj
167 MPTESTS = $(MPTESTOBJS:.obj=.exe)
168
169 $(MPTESTOBJS): mptest%.obj: tests/mptest-%.c $(LIBHDRS)
170 $(CC) $(CFLAGS) -Fo$@ -c $<
171
172 $(MPTESTS): mptest%.exe: mptest%.obj mpi.lib $(LIBS)
173 $(CC) $(CFLAGS) -Fo$@ $^
174
175 tests: mptest1.exe mptest2.exe mptest3.exe mptest3a.exe mptest4.exe \
176 mptest4a.exe mptest4b.exe mptest6.exe bbsrand.exe
177
178 utests: mptest7.exe mptest8.exe mptest9.exe
179
180 #---------------------------------------
181
182 EXTRAOBJS = bbsrand.obj bbs_rand.obj prng.obj
183 UTILOBJS = primegen.obj metime.obj identest.obj basecvt.obj fact.obj \
184 exptmod.obj pi.obj makeprime.obj karatsuba.obj gcd.obj invmod.obj lap.obj \
185 isprime.obj dec2hex.obj hex2dec.obj
186 UTILS = $(UTILOBJS:.obj=.exe)
187
188 $(UTILS): %.exe : %.obj mpi.lib $(LIBS)
189 $(CC) $(CFLAGS) -Fo$@ $^
190
191 $(UTILOBJS) $(EXTRAOBJS): %.obj : utils/%.c $(LIBHDRS)
192 $(CC) $(CFLAGS) -Fo$@ -c $<
193
194 prng.exe: prng.obj bbs_rand.obj mpi.lib $(LIBS)
195 $(CC) $(CFLAGS) -Fo$@ $^
196
197 bbsrand.exe: bbsrand.obj bbs_rand.obj mpi.lib $(LIBS)
198 $(CC) $(CFLAGS) -Fo$@ $^
199
200 utils: $(UTILS) prng.exe bbsrand.exe
201
202 #---------------------------------------
203
204 test-info.c: test-arrays.txt
205 $(PERL) make-test-arrays test-arrays.txt > test-info.c
206
207 mpi-test.obj: mpi-test.c test-info.c $(LIBHDRS)
208 $(CC) $(CFLAGS) -Fo$@ -c $<
209
210 mpi-test.exe: mpi-test.obj mpi.lib $(LIBS)
211 $(CC) $(CFLAGS) -Fo$@ $^
212
213 mdxptest.obj: mdxptest.c $(LIBHDRS) mpi-priv.h
214
215 mdxptest.exe: mdxptest.obj mpi.lib $(LIBS)
216 $(CC) $(CFLAGS) -Fo$@ $^
217
218 mulsqr.obj: mulsqr.c logtab.h mpi.h mpi-config.h mpprime.h
219 $(CC) $(CFLAGS) -DMP_SQUARE=1 -Fo$@ -c mulsqr.c
220
221 mulsqr.exe: mulsqr.obj mpi.lib $(LIBS)
222 $(CC) $(CFLAGS) -Fo$@ $^
223
224 #---------------------------------------
225
226 alltests: tests utests mpi-test.exe
227
228 tools: $(TOOLS)
229
230 doc:
231 (cd doc; ./build)
232
233 clean:
234 rm -f *.obj *.lib *.pdb *.ilk
235 cd utils; rm -f *.obj *.lib *.pdb *.ilk
236
237 distclean: clean
238 rm -f mptest? mpi-test metime mulsqr karatsuba
239 rm -f mptest?a mptest?b
240 rm -f utils/mptest?
241 rm -f test-info.c logtab.h
242 rm -f mpi.lib
243 rm -f $(TOOLS)
244
245 dist: Makefile $(HDRS) $(SRCS) $(DOCS)
246 tar -cvf mpi-$(VERS).tar Makefile $(HDRS) $(SRCS) $(DOCS)
247 pgps -ab mpi-$(VERS).tar
248 chmod +r mpi-$(VERS).tar.asc
249 gzip -9 mpi-$(VERS).tar
250
251
252 print:
253 @echo LIBOBJS = $(LIBOBJS)
254 # END

mercurial