michael@0: # michael@0: # Makefile.win - gmake Makefile for building MPI with MSVC on NT michael@0: michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ## Define CC to be the C compiler you wish to use. The GNU cc michael@0: ## compiler (gcc) should work, at the very least michael@0: #CC=cc michael@0: #CC=gcc michael@0: CC=cl.exe michael@0: ifeq ($(CPU_ARCH),x86_64) michael@0: AS=ml64.exe michael@0: else michael@0: AS=ml.exe michael@0: endif michael@0: michael@0: ## michael@0: ## Define PERL to point to your local Perl interpreter. It michael@0: ## should be Perl 5.x, although it's conceivable that Perl 4 michael@0: ## might work ... I haven't tested it. michael@0: ## michael@0: #PERL=/usr/bin/perl michael@0: #PERL=perl michael@0: michael@0: ## michael@0: ## Define CFLAGS to contain any local options your compiler michael@0: ## setup requires. michael@0: ## michael@0: ## Conditional compilation options are no longer here; see michael@0: ## the file 'mpi-config.h' instead. michael@0: ## michael@0: MPICMN = -I. -DMP_API_COMPATIBLE -DMP_IOFUNC michael@0: michael@0: ifeq ($(CPU_ARCH),x86_64) michael@0: AS_SRCS = mpi_x86_64.asm michael@0: CFLAGS = -O2 -Z7 -MD -W3 -nologo -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \ michael@0: -DWIN32 -D_WIN64 -D_AMD64_ -D_M_AMD64 -D_WINDOWS -DWIN95 $(MPICMN) michael@0: ASFLAGS = -Cp -Sn -Zi -I. michael@0: else michael@0: #NT michael@0: AS_SRCS = mpi_x86.asm michael@0: MPICMN += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE -DMP_ASSEMBLY_DIV_2DX1D michael@0: #CFLAGS= -Od -Z7 -MD -W3 -nologo -D_X86_ -DXP_PC \ michael@0: -DDEBUG -D_DEBUG -UNDEBUG -DWIN32 -D_WINDOWS -DWIN95 $(MPICMN) michael@0: #CFLAGS = -O2 -MD -W3 -nologo -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \ michael@0: -DWIN32 -D_WINDOWS -DWIN95 $(MPICMN) michael@0: #CFLAGS = -Od -Z7 -MD -W3 -nologo -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \ michael@0: -DWIN32 -D_WINDOWS -DWIN95 $(MPICMN) michael@0: CFLAGS = -O2 -Z7 -MD -W3 -nologo -D_X86_ -DXP_PC -UDEBUG -U_DEBUG -DNDEBUG \ michael@0: -DWIN32 -D_WINDOWS -DWIN95 $(MPICMN) michael@0: ASFLAGS = -Cp -Sn -Zi -coff -I. michael@0: endif michael@0: michael@0: ## michael@0: ## Define LIBS to include any libraries you need to link against. michael@0: ## If NO_TABLE is define, LIBS should include '-lm' or whatever is michael@0: ## necessary to bring in the math library. Otherwise, it can be michael@0: ## left alone, unless your system has other peculiar requirements. michael@0: ## michael@0: LIBS=#-lmalloc#-lefence#-lm michael@0: michael@0: ## michael@0: ## Define RANLIB to be the library header randomizer; you might not michael@0: ## need this on some systems (just set it to 'echo' on these systems, michael@0: ## such as IRIX) michael@0: ## michael@0: RANLIB=echo michael@0: michael@0: ## michael@0: ## This is the version string used for the documentation and michael@0: ## building the distribution tarball. Don't mess with it unless michael@0: ## you are releasing a new version michael@0: VERS=1.7p6 michael@0: michael@0: ## ---------------------------------------------------------------------- michael@0: ## You probably don't need to change anything below this line... michael@0: ## michael@0: michael@0: ## michael@0: ## This is the list of source files that need to be packed into michael@0: ## the distribution file michael@0: SRCS= mpi.c mpprime.c mplogic.c mpmontg.c mpi-test.c primes.c tests/ \ michael@0: utils/gcd.c utils/invmod.c utils/lap.c \ michael@0: utils/ptab.pl utils/sieve.c utils/isprime.c\ michael@0: utils/dec2hex.c utils/hex2dec.c utils/bbs_rand.c \ michael@0: utils/bbsrand.c utils/prng.c utils/primegen.c \ michael@0: utils/basecvt.c utils/makeprime.c\ michael@0: utils/fact.c utils/exptmod.c utils/pi.c utils/metime.c \ michael@0: utils/mpi.h utils/mpprime.h mulsqr.c \ michael@0: make-test-arrays test-arrays.txt all-tests make-logtab \ michael@0: types.pl stats timetest multest michael@0: michael@0: ## These are the header files that go into the distribution file michael@0: HDRS=mpi.h mpi-config.h utils/mpi.h utils/mpi-config.h mpprime.h mplogic.h \ michael@0: utils/bbs_rand.h tests/mpi.h tests/mpprime.h michael@0: michael@0: ## These are the documentation files that go into the distribution file michael@0: DOCS=README doc utils/README utils/PRIMES michael@0: michael@0: ## This is the list of tools built by 'make tools' michael@0: TOOLS=gcd.exe invmod.exe isprime.exe lap.exe dec2hex.exe hex2dec.exe \ michael@0: primegen.exe prng.exe basecvt.exe fact.exe exptmod.exe pi.exe makeprime.exe michael@0: michael@0: AS_OBJS = $(AS_SRCS:.asm=.obj) michael@0: LIBOBJS = mpprime.obj mpmontg.obj mplogic.obj mpi.obj $(AS_OBJS) michael@0: LIBHDRS = mpi-config.h mpi-priv.h mpi.h michael@0: APPHDRS = mpi-config.h mpi.h mplogic.h mpprime.h michael@0: michael@0: michael@0: help: michael@0: @ echo "" michael@0: @ echo "The following targets can be built with this Makefile:" michael@0: @ echo "" michael@0: @ echo "mpi.lib - arithmetic and prime testing library" michael@0: @ echo "mpi-test - test driver (requires MP_IOFUNC)" michael@0: @ echo "tools - command line tools" michael@0: @ echo "doc - manual pages for tools" michael@0: @ echo "clean - clean up objects and such" michael@0: @ echo "distclean - get ready for distribution" michael@0: @ echo "dist - distribution tarball" michael@0: @ echo "" michael@0: michael@0: .SUFFIXES: .c .obj .i .lib .exe .asm michael@0: michael@0: .c.i: michael@0: $(CC) $(CFLAGS) -E $< > $@ michael@0: michael@0: .c.obj: michael@0: $(CC) $(CFLAGS) -c $< michael@0: michael@0: .asm.obj: michael@0: $(AS) $(ASFLAGS) -c $< michael@0: michael@0: .obj.exe: michael@0: $(CC) $(CFLAGS) -Fo$@ $< michael@0: michael@0: #--------------------------------------- michael@0: michael@0: $(LIBOBJS): $(LIBHDRS) michael@0: michael@0: logtab.h: make-logtab michael@0: $(PERL) make-logtab > logtab.h michael@0: michael@0: mpi.obj: mpi.c logtab.h $(LIBHDRS) michael@0: michael@0: mplogic.obj: mplogic.c mpi-priv.h mplogic.h $(LIBHDRS) michael@0: michael@0: mpmontg.obj: mpmontg.c mpi-priv.h mplogic.h mpprime.h $(LIBHDRS) michael@0: michael@0: mpprime.obj: mpprime.c mpi-priv.h mpprime.h mplogic.h primes.c $(LIBHDRS) michael@0: michael@0: mpi_mips.obj: mpi_mips.s michael@0: $(CC) -Fo$@ $(ASFLAGS) -c mpi_mips.s michael@0: michael@0: mpi.lib: $(LIBOBJS) michael@0: ar -cvr mpi.lib $(LIBOBJS) michael@0: $(RANLIB) mpi.lib michael@0: michael@0: lib libs: mpi.lib michael@0: michael@0: #--------------------------------------- michael@0: michael@0: MPTESTOBJS = mptest1.obj mptest2.obj mptest3.obj mptest3a.obj mptest4.obj \ michael@0: mptest4a.obj mptest4b.obj mptest6.obj mptest7.obj mptest8.obj mptest9.obj michael@0: MPTESTS = $(MPTESTOBJS:.obj=.exe) michael@0: michael@0: $(MPTESTOBJS): mptest%.obj: tests/mptest-%.c $(LIBHDRS) michael@0: $(CC) $(CFLAGS) -Fo$@ -c $< michael@0: michael@0: $(MPTESTS): mptest%.exe: mptest%.obj mpi.lib $(LIBS) michael@0: $(CC) $(CFLAGS) -Fo$@ $^ michael@0: michael@0: tests: mptest1.exe mptest2.exe mptest3.exe mptest3a.exe mptest4.exe \ michael@0: mptest4a.exe mptest4b.exe mptest6.exe bbsrand.exe michael@0: michael@0: utests: mptest7.exe mptest8.exe mptest9.exe michael@0: michael@0: #--------------------------------------- michael@0: michael@0: EXTRAOBJS = bbsrand.obj bbs_rand.obj prng.obj michael@0: UTILOBJS = primegen.obj metime.obj identest.obj basecvt.obj fact.obj \ michael@0: exptmod.obj pi.obj makeprime.obj karatsuba.obj gcd.obj invmod.obj lap.obj \ michael@0: isprime.obj dec2hex.obj hex2dec.obj michael@0: UTILS = $(UTILOBJS:.obj=.exe) michael@0: michael@0: $(UTILS): %.exe : %.obj mpi.lib $(LIBS) michael@0: $(CC) $(CFLAGS) -Fo$@ $^ michael@0: michael@0: $(UTILOBJS) $(EXTRAOBJS): %.obj : utils/%.c $(LIBHDRS) michael@0: $(CC) $(CFLAGS) -Fo$@ -c $< michael@0: michael@0: prng.exe: prng.obj bbs_rand.obj mpi.lib $(LIBS) michael@0: $(CC) $(CFLAGS) -Fo$@ $^ michael@0: michael@0: bbsrand.exe: bbsrand.obj bbs_rand.obj mpi.lib $(LIBS) michael@0: $(CC) $(CFLAGS) -Fo$@ $^ michael@0: michael@0: utils: $(UTILS) prng.exe bbsrand.exe michael@0: michael@0: #--------------------------------------- michael@0: michael@0: test-info.c: test-arrays.txt michael@0: $(PERL) make-test-arrays test-arrays.txt > test-info.c michael@0: michael@0: mpi-test.obj: mpi-test.c test-info.c $(LIBHDRS) michael@0: $(CC) $(CFLAGS) -Fo$@ -c $< michael@0: michael@0: mpi-test.exe: mpi-test.obj mpi.lib $(LIBS) michael@0: $(CC) $(CFLAGS) -Fo$@ $^ michael@0: michael@0: mdxptest.obj: mdxptest.c $(LIBHDRS) mpi-priv.h michael@0: michael@0: mdxptest.exe: mdxptest.obj mpi.lib $(LIBS) michael@0: $(CC) $(CFLAGS) -Fo$@ $^ michael@0: michael@0: mulsqr.obj: mulsqr.c logtab.h mpi.h mpi-config.h mpprime.h michael@0: $(CC) $(CFLAGS) -DMP_SQUARE=1 -Fo$@ -c mulsqr.c michael@0: michael@0: mulsqr.exe: mulsqr.obj mpi.lib $(LIBS) michael@0: $(CC) $(CFLAGS) -Fo$@ $^ michael@0: michael@0: #--------------------------------------- michael@0: michael@0: alltests: tests utests mpi-test.exe michael@0: michael@0: tools: $(TOOLS) michael@0: michael@0: doc: michael@0: (cd doc; ./build) michael@0: michael@0: clean: michael@0: rm -f *.obj *.lib *.pdb *.ilk michael@0: cd utils; rm -f *.obj *.lib *.pdb *.ilk michael@0: michael@0: distclean: clean michael@0: rm -f mptest? mpi-test metime mulsqr karatsuba michael@0: rm -f mptest?a mptest?b michael@0: rm -f utils/mptest? michael@0: rm -f test-info.c logtab.h michael@0: rm -f mpi.lib michael@0: rm -f $(TOOLS) michael@0: michael@0: dist: Makefile $(HDRS) $(SRCS) $(DOCS) michael@0: tar -cvf mpi-$(VERS).tar Makefile $(HDRS) $(SRCS) $(DOCS) michael@0: pgps -ab mpi-$(VERS).tar michael@0: chmod +r mpi-$(VERS).tar.asc michael@0: gzip -9 mpi-$(VERS).tar michael@0: michael@0: michael@0: print: michael@0: @echo LIBOBJS = $(LIBOBJS) michael@0: # END