michael@0: # michael@0: # Makefile for MPI library 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: 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: include target.mk michael@0: michael@0: CFLAGS+= $(XCFLAGS) 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 mp_gf2m.c mpmontg.c mpi-test.c primes.c \ michael@0: mpcpucache.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 mp_gf2m.h \ michael@0: mp_gf2m-priv.h 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 invmod isprime lap dec2hex hex2dec primegen prng \ michael@0: basecvt fact exptmod pi makeprime identest michael@0: michael@0: LIBOBJS = mpprime.o mpmontg.o mplogic.o mp_gf2m.o mpi.o mpcpucache.o $(AS_OBJS) michael@0: LIBHDRS = mpi-config.h mpi-priv.h mpi.h michael@0: APPHDRS = mpi-config.h mpi.h mplogic.h mp_gf2m.h mpprime.h 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 "libmpi.a - 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 .o .i michael@0: michael@0: .c.i: michael@0: $(CC) $(CFLAGS) -E $< > $@ michael@0: michael@0: #.c.o: $*.h $*.c michael@0: # $(CC) $(CFLAGS) -c $< 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.o: mpi.c logtab.h $(LIBHDRS) michael@0: michael@0: mplogic.o: mplogic.c mpi-priv.h mplogic.h $(LIBHDRS) michael@0: michael@0: mp_gf2m.o: mp_gf2m.c mpi-priv.h mp_gf2m.h mp_gf2m-priv.h $(LIBHDRS) michael@0: michael@0: mpmontg.o: mpmontg.c mpi-priv.h mplogic.h mpprime.h $(LIBHDRS) michael@0: michael@0: mpprime.o: mpprime.c mpi-priv.h mpprime.h mplogic.h primes.c $(LIBHDRS) michael@0: michael@0: mpcpucache.o: mpcpucache.c $(LIBHDRS) michael@0: michael@0: mpi_mips.o: mpi_mips.s michael@0: $(CC) -o $@ $(ASFLAGS) -c mpi_mips.s michael@0: michael@0: mpi_sparc.o : montmulf.h michael@0: michael@0: mpv_sparcv9.s: vis_64.il mpv_sparc.c michael@0: $(CC) -o $@ $(SOLARIS_FPU_FLAGS) -S vis_64.il mpv_sparc.c michael@0: michael@0: mpv_sparcv8.s: vis_64.il mpv_sparc.c michael@0: $(CC) -o $@ $(SOLARIS_FPU_FLAGS) -S vis_32.il mpv_sparc.c michael@0: michael@0: montmulfv8.o montmulfv9.o mpv_sparcv8.o mpv_sparcv9.o : %.o : %.s michael@0: $(CC) -o $@ $(SOLARIS_ASM_FLAGS) -c $< michael@0: michael@0: mpi_arm.o: mpi_arm.c $(LIBHDRS) michael@0: michael@0: # This rule is used to build the .s sources, which are then hand optimized. michael@0: #montmulfv8.s montmulfv9.s : montmulf%.s : montmulf%.il montmulf.c montmulf.h michael@0: # $(CC) -o $@ $(SOLARIS_ASM_FLAGS) -S montmulf$*.il montmulf.c michael@0: michael@0: michael@0: libmpi.a: $(LIBOBJS) michael@0: ar -cvr libmpi.a $(LIBOBJS) michael@0: $(RANLIB) libmpi.a michael@0: michael@0: lib libs: libmpi.a michael@0: michael@0: mpi.i: mpi.h michael@0: michael@0: #--------------------------------------- michael@0: michael@0: MPTESTOBJS = mptest1.o mptest2.o mptest3.o mptest3a.o mptest4.o mptest4a.o \ michael@0: mptest4b.o mptest6.o mptest7.o mptest8.o mptest9.o mptestb.o michael@0: MPTESTS = $(MPTESTOBJS:.o=) michael@0: michael@0: $(MPTESTOBJS): mptest%.o: tests/mptest-%.c $(LIBHDRS) michael@0: $(CC) $(CFLAGS) -o $@ -c $< michael@0: michael@0: $(MPTESTS): mptest%: mptest%.o libmpi.a michael@0: $(CC) $(CFLAGS) -o $@ $^ $(LIBS) michael@0: michael@0: tests: mptest1 mptest2 mptest3 mptest3a mptest4 mptest4a mptest4b mptest6 \ michael@0: mptestb bbsrand michael@0: michael@0: utests: mptest7 mptest8 mptest9 michael@0: michael@0: #--------------------------------------- michael@0: michael@0: EXTRAOBJS = bbsrand.o bbs_rand.o prng.o michael@0: UTILOBJS = primegen.o metime.o identest.o basecvt.o fact.o exptmod.o pi.o \ michael@0: makeprime.o gcd.o invmod.o lap.o isprime.o \ michael@0: dec2hex.o hex2dec.o michael@0: UTILS = $(UTILOBJS:.o=) michael@0: michael@0: $(UTILS): % : %.o libmpi.a michael@0: $(CC) $(CFLAGS) -o $@ $^ $(LIBS) michael@0: michael@0: $(UTILOBJS) $(EXTRAOBJS): %.o : utils/%.c $(LIBHDRS) michael@0: $(CC) $(CFLAGS) -o $@ -c $< michael@0: michael@0: prng: prng.o bbs_rand.o libmpi.a michael@0: $(CC) $(CFLAGS) -o $@ $^ $(LIBS) michael@0: michael@0: bbsrand: bbsrand.o bbs_rand.o libmpi.a michael@0: $(CC) $(CFLAGS) -o $@ $^ $(LIBS) michael@0: michael@0: utils: $(UTILS) prng bbsrand 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.o: mpi-test.c test-info.c $(LIBHDRS) michael@0: $(CC) $(CFLAGS) -o $@ -c $< michael@0: michael@0: mpi-test: mpi-test.o libmpi.a michael@0: $(CC) $(CFLAGS) -o $@ $^ $(LIBS) michael@0: michael@0: mdxptest.o: mdxptest.c $(LIBHDRS) mpi-priv.h michael@0: michael@0: mdxptest: mdxptest.o libmpi.a michael@0: $(CC) $(CFLAGS) -o $@ $^ $(LIBS) michael@0: michael@0: mulsqr.o: mulsqr.c logtab.h mpi.h mpi-config.h mpprime.h michael@0: $(CC) $(CFLAGS) -DMP_SQUARE=1 -o $@ -c mulsqr.c michael@0: michael@0: mulsqr: mulsqr.o libmpi.a michael@0: $(CC) $(CFLAGS) -o $@ $^ $(LIBS) michael@0: michael@0: #--------------------------------------- michael@0: michael@0: alltests: tests utests mpi-test 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 *.o *.a *.i michael@0: rm -f core michael@0: rm -f *~ .*~ michael@0: rm -f utils/*.o michael@0: rm -f utils/core michael@0: rm -f utils/*~ utils/.*~ michael@0: michael@0: clobber: clean michael@0: rm -f $(TOOLS) $(UTILS) 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 libmpi.a 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: # END