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