2
# Makefile.win - gmake Makefile for building MPI with VACPP on OS/2
4
# ***** BEGIN LICENSE BLOCK *****
5
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
7
# The contents of this file are subject to the Mozilla Public License Version
8
# 1.1 (the "License"); you may not use this file except in compliance with
9
# the License. You may obtain a copy of the License at
10
# http://www.mozilla.org/MPL/
12
# Software distributed under the License is distributed on an "AS IS" basis,
13
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14
# for the specific language governing rights and limitations under the
17
# The Original Code is the MPI Arbitrary Precision Integer Arithmetic library.
19
# The Initial Developer of the Original Code is
20
# Michael J. Fromberger <sting@linguist.dartmouth.edu>.
21
# Portions created by the Initial Developer are Copyright (C) 1998
22
# the Initial Developer. All Rights Reserved.
25
# Netscape Communications Corporation
27
# Alternatively, the contents of this file may be used under the terms of
28
# either the GNU General Public License Version 2 or later (the "GPL"), or
29
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30
# in which case the provisions of the GPL or the LGPL are applicable instead
31
# of those above. If you wish to allow use of your version of this file only
32
# under the terms of either the GPL or the LGPL, and not to allow others to
33
# use your version of this file under the terms of the MPL, indicate your
34
# decision by deleting the provisions above and replace them with the notice
35
# and other provisions required by the GPL or the LGPL. If you do not delete
36
# the provisions above, a recipient may use your version of this file under
37
# the terms of any one of the MPL, the GPL or the LGPL.
39
# ***** END LICENSE BLOCK *****
42
# $Id: Makefile.os2,v 1.3 2005/02/02 22:28:22 gerv%gerv.net Exp $
45
## Define CC to be the C compiler you wish to use. The GNU cc
46
## compiler (gcc) should work, at the very least
53
## Define PERL to point to your local Perl interpreter. It
54
## should be Perl 5.x, although it's conceivable that Perl 4
55
## might work ... I haven't tested it.
61
## Define CFLAGS to contain any local options your compiler
64
## Conditional compilation options are no longer here; see
65
## the file 'mpi-config.h' instead.
67
MPICMN = -I. -DMP_API_COMPATIBLE -DMP_IOFUNC -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD
71
MPICMN += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE -DMP_ASSEMBLY_DIV_2DX1D
72
#CFLAGS= -Od -Z7 -MD -W3 -nologo -D_X86_ -DXP_PC \
73
-DDEBUG -D_DEBUG -UNDEBUG -DWIN32 -D_WINDOWS -DWIN95 $(MPICMN)
74
#CFLAGS = -O2 -MD -W3 -nologo -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \
75
-DWIN32 -D_WINDOWS -DWIN95 $(MPICMN)
76
#CFLAGS = -Od -Z7 -MD -W3 -nologo -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \
77
-DWIN32 -D_WINDOWS -DWIN95 $(MPICMN)
78
CFLAGS = /Ti+ -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \
83
## Define LIBS to include any libraries you need to link against.
84
## If NO_TABLE is define, LIBS should include '-lm' or whatever is
85
## necessary to bring in the math library. Otherwise, it can be
86
## left alone, unless your system has other peculiar requirements.
88
LIBS=#-lmalloc#-lefence#-lm
91
## Define RANLIB to be the library header randomizer; you might not
92
## need this on some systems (just set it to 'echo' on these systems,
98
## This is the version string used for the documentation and
99
## building the distribution tarball. Don't mess with it unless
100
## you are releasing a new version
103
## ----------------------------------------------------------------------
104
## You probably don't need to change anything below this line...
108
## This is the list of source files that need to be packed into
109
## the distribution file
110
SRCS= mpi.c mpprime.c mplogic.c mpmontg.c mpi-test.c primes.c tests/ \
111
utils/gcd.c utils/invmod.c utils/lap.c \
112
utils/ptab.pl utils/sieve.c utils/isprime.c\
113
utils/dec2hex.c utils/hex2dec.c utils/bbs_rand.c \
114
utils/bbsrand.c utils/prng.c utils/primegen.c \
115
utils/basecvt.c utils/makeprime.c\
116
utils/fact.c utils/exptmod.c utils/pi.c utils/metime.c \
117
utils/mpi.h utils/mpprime.h mulsqr.c \
118
make-test-arrays test-arrays.txt all-tests make-logtab \
119
types.pl stats timetest multest
121
## These are the header files that go into the distribution file
122
HDRS=mpi.h mpi-config.h utils/mpi.h utils/mpi-config.h mpprime.h mplogic.h \
123
utils/bbs_rand.h tests/mpi.h tests/mpprime.h
125
## These are the documentation files that go into the distribution file
126
DOCS=README doc utils/README utils/PRIMES
128
## This is the list of tools built by 'make tools'
129
TOOLS=gcd.exe invmod.exe isprime.exe lap.exe dec2hex.exe hex2dec.exe \
130
primegen.exe prng.exe basecvt.exe fact.exe exptmod.exe pi.exe makeprime.exe
132
AS_OBJS = $(AS_SRCS:.asm=.obj)
133
LIBOBJS = mpprime.obj mpmontg.obj mplogic.obj mpi.obj $(AS_OBJS)
134
LIBHDRS = mpi-config.h mpi-priv.h mpi.h
135
APPHDRS = mpi-config.h mpi.h mplogic.h mpprime.h
140
@ echo "The following targets can be built with this Makefile:"
142
@ echo "mpi.lib - arithmetic and prime testing library"
143
@ echo "mpi-test.exe - test driver (requires MP_IOFUNC)"
144
@ echo "tools - command line tools"
145
@ echo "doc - manual pages for tools"
146
@ echo "clean - clean up objects and such"
147
@ echo "distclean - get ready for distribution"
148
@ echo "dist - distribution tarball"
151
.SUFFIXES: .c .obj .i .lib .exe .asm
154
$(CC) $(CFLAGS) -E $< > $@
157
$(CC) $(CFLAGS) -c $<
163
$(CC) $(CFLAGS) -Fo$@ $<
165
#---------------------------------------
167
$(LIBOBJS): $(LIBHDRS)
169
logtab.h: make-logtab
170
$(PERL) make-logtab > logtab.h
172
mpi.obj: mpi.c logtab.h $(LIBHDRS)
174
mplogic.obj: mplogic.c mpi-priv.h mplogic.h $(LIBHDRS)
176
mpmontg.obj: mpmontg.c mpi-priv.h mplogic.h mpprime.h $(LIBHDRS)
178
mpprime.obj: mpprime.c mpi-priv.h mpprime.h mplogic.h primes.c $(LIBHDRS)
180
mpi_mips.obj: mpi_mips.s
181
$(CC) -Fo$@ $(ASFLAGS) -c mpi_mips.s
184
ilib /out:mpi.lib $(LIBOBJS)
189
#---------------------------------------
191
MPTESTOBJS = mptest1.obj mptest2.obj mptest3.obj mptest3a.obj mptest4.obj \
192
mptest4a.obj mptest4b.obj mptest6.obj mptest7.obj mptest8.obj mptest9.obj
193
MPTESTS = $(MPTESTOBJS:.obj=.exe)
195
$(MPTESTOBJS): mptest%.obj: tests/mptest-%.c $(LIBHDRS)
196
$(CC) $(CFLAGS) -Fo$@ -c $<
198
$(MPTESTS): mptest%.exe: mptest%.obj mpi.lib $(LIBS)
199
$(CC) $(CFLAGS) -Fo$@ $^
201
tests: mptest1.exe mptest2.exe mptest3.exe mptest3a.exe mptest4.exe \
202
mptest4a.exe mptest4b.exe mptest6.exe bbsrand.exe
204
utests: mptest7.exe mptest8.exe mptest9.exe
206
#---------------------------------------
208
EXTRAOBJS = bbsrand.obj bbs_rand.obj prng.obj
209
UTILOBJS = primegen.obj metime.obj identest.obj basecvt.obj fact.obj \
210
exptmod.obj pi.obj makeprime.obj karatsuba.obj gcd.obj invmod.obj lap.obj \
211
isprime.obj dec2hex.obj hex2dec.obj
212
UTILS = $(UTILOBJS:.obj=.exe)
214
$(UTILS): %.exe : %.obj mpi.lib $(LIBS)
215
$(CC) $(CFLAGS) -Fo$@ $^
217
$(UTILOBJS) $(EXTRAOBJS): %.obj : utils/%.c $(LIBHDRS)
218
$(CC) $(CFLAGS) -Fo$@ -c $<
220
prng.exe: prng.obj bbs_rand.obj mpi.lib $(LIBS)
221
$(CC) $(CFLAGS) -Fo$@ $^
223
bbsrand.exe: bbsrand.obj bbs_rand.obj mpi.lib $(LIBS)
224
$(CC) $(CFLAGS) -Fo$@ $^
226
utils: $(UTILS) prng.exe bbsrand.exe
228
#---------------------------------------
230
test-info.c: test-arrays.txt
231
$(PERL) make-test-arrays test-arrays.txt > test-info.c
233
mpi-test.obj: mpi-test.c test-info.c $(LIBHDRS)
234
$(CC) $(CFLAGS) -Fo$@ -c $<
236
mpi-test.exe: mpi-test.obj mpi.lib $(LIBS)
237
$(CC) $(CFLAGS) -Fo$@ $^
239
mdxptest.obj: mdxptest.c $(LIBHDRS) mpi-priv.h
241
mdxptest.exe: mdxptest.obj mpi.lib $(LIBS)
242
$(CC) $(CFLAGS) -Fo$@ $^
244
mulsqr.obj: mulsqr.c logtab.h mpi.h mpi-config.h mpprime.h
245
$(CC) $(CFLAGS) -DMP_SQUARE=1 -Fo$@ -c mulsqr.c
247
mulsqr.exe: mulsqr.obj mpi.lib $(LIBS)
248
$(CC) $(CFLAGS) -Fo$@ $^
250
#---------------------------------------
252
alltests: tests utests mpi-test.exe
260
rm -f *.obj *.lib *.pdb *.ilk
261
cd utils; rm -f *.obj *.lib *.pdb *.ilk
264
rm -f mptest? mpi-test metime mulsqr karatsuba
265
rm -f mptest?a mptest?b
267
rm -f test-info.c logtab.h
271
dist: Makefile $(HDRS) $(SRCS) $(DOCS)
272
tar -cvf mpi-$(VERS).tar Makefile $(HDRS) $(SRCS) $(DOCS)
273
pgps -ab mpi-$(VERS).tar
274
chmod +r mpi-$(VERS).tar.asc
275
gzip -9 mpi-$(VERS).tar
279
@echo LIBOBJS = $(LIBOBJS)