1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/freebl/mpi/Makefile Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,244 @@ 1.4 +# 1.5 +# Makefile for MPI library 1.6 + 1.7 +# This Source Code Form is subject to the terms of the Mozilla Public 1.8 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.10 + 1.11 +## Define CC to be the C compiler you wish to use. The GNU cc 1.12 +## compiler (gcc) should work, at the very least 1.13 +#CC=cc 1.14 +#CC=gcc 1.15 + 1.16 +## 1.17 +## Define PERL to point to your local Perl interpreter. It 1.18 +## should be Perl 5.x, although it's conceivable that Perl 4 1.19 +## might work ... I haven't tested it. 1.20 +## 1.21 +#PERL=/usr/bin/perl 1.22 +#PERL=perl 1.23 + 1.24 +include target.mk 1.25 + 1.26 +CFLAGS+= $(XCFLAGS) 1.27 + 1.28 +## 1.29 +## Define LIBS to include any libraries you need to link against. 1.30 +## If NO_TABLE is define, LIBS should include '-lm' or whatever is 1.31 +## necessary to bring in the math library. Otherwise, it can be 1.32 +## left alone, unless your system has other peculiar requirements. 1.33 +## 1.34 +LIBS=#-lmalloc#-lefence#-lm 1.35 + 1.36 +## 1.37 +## Define RANLIB to be the library header randomizer; you might not 1.38 +## need this on some systems (just set it to 'echo' on these systems, 1.39 +## such as IRIX) 1.40 +## 1.41 +RANLIB=echo 1.42 + 1.43 +## 1.44 +## This is the version string used for the documentation and 1.45 +## building the distribution tarball. Don't mess with it unless 1.46 +## you are releasing a new version 1.47 +VERS=1.7p6 1.48 + 1.49 +## ---------------------------------------------------------------------- 1.50 +## You probably don't need to change anything below this line... 1.51 +## 1.52 + 1.53 +## 1.54 +## This is the list of source files that need to be packed into 1.55 +## the distribution file 1.56 +SRCS= mpi.c mpprime.c mplogic.c mp_gf2m.c mpmontg.c mpi-test.c primes.c \ 1.57 + mpcpucache.c tests/ \ 1.58 + utils/gcd.c utils/invmod.c utils/lap.c \ 1.59 + utils/ptab.pl utils/sieve.c utils/isprime.c\ 1.60 + utils/dec2hex.c utils/hex2dec.c utils/bbs_rand.c \ 1.61 + utils/bbsrand.c utils/prng.c utils/primegen.c \ 1.62 + utils/basecvt.c utils/makeprime.c\ 1.63 + utils/fact.c utils/exptmod.c utils/pi.c utils/metime.c \ 1.64 + utils/mpi.h utils/mpprime.h mulsqr.c \ 1.65 + make-test-arrays test-arrays.txt all-tests make-logtab \ 1.66 + types.pl stats timetest multest 1.67 + 1.68 +## These are the header files that go into the distribution file 1.69 +HDRS=mpi.h mpi-config.h utils/mpi.h utils/mpi-config.h mpprime.h mplogic.h mp_gf2m.h \ 1.70 + mp_gf2m-priv.h utils/bbs_rand.h tests/mpi.h tests/mpprime.h 1.71 + 1.72 +## These are the documentation files that go into the distribution file 1.73 +DOCS=README doc utils/README utils/PRIMES 1.74 + 1.75 +## This is the list of tools built by 'make tools' 1.76 +TOOLS=gcd invmod isprime lap dec2hex hex2dec primegen prng \ 1.77 + basecvt fact exptmod pi makeprime identest 1.78 + 1.79 +LIBOBJS = mpprime.o mpmontg.o mplogic.o mp_gf2m.o mpi.o mpcpucache.o $(AS_OBJS) 1.80 +LIBHDRS = mpi-config.h mpi-priv.h mpi.h 1.81 +APPHDRS = mpi-config.h mpi.h mplogic.h mp_gf2m.h mpprime.h 1.82 + 1.83 +help: 1.84 + @ echo "" 1.85 + @ echo "The following targets can be built with this Makefile:" 1.86 + @ echo "" 1.87 + @ echo "libmpi.a - arithmetic and prime testing library" 1.88 + @ echo "mpi-test - test driver (requires MP_IOFUNC)" 1.89 + @ echo "tools - command line tools" 1.90 + @ echo "doc - manual pages for tools" 1.91 + @ echo "clean - clean up objects and such" 1.92 + @ echo "distclean - get ready for distribution" 1.93 + @ echo "dist - distribution tarball" 1.94 + @ echo "" 1.95 + 1.96 +.SUFFIXES: .c .o .i 1.97 + 1.98 +.c.i: 1.99 + $(CC) $(CFLAGS) -E $< > $@ 1.100 + 1.101 +#.c.o: $*.h $*.c 1.102 +# $(CC) $(CFLAGS) -c $< 1.103 + 1.104 +#--------------------------------------- 1.105 + 1.106 +$(LIBOBJS): $(LIBHDRS) 1.107 + 1.108 +logtab.h: make-logtab 1.109 + $(PERL) make-logtab > logtab.h 1.110 + 1.111 +mpi.o: mpi.c logtab.h $(LIBHDRS) 1.112 + 1.113 +mplogic.o: mplogic.c mpi-priv.h mplogic.h $(LIBHDRS) 1.114 + 1.115 +mp_gf2m.o: mp_gf2m.c mpi-priv.h mp_gf2m.h mp_gf2m-priv.h $(LIBHDRS) 1.116 + 1.117 +mpmontg.o: mpmontg.c mpi-priv.h mplogic.h mpprime.h $(LIBHDRS) 1.118 + 1.119 +mpprime.o: mpprime.c mpi-priv.h mpprime.h mplogic.h primes.c $(LIBHDRS) 1.120 + 1.121 +mpcpucache.o: mpcpucache.c $(LIBHDRS) 1.122 + 1.123 +mpi_mips.o: mpi_mips.s 1.124 + $(CC) -o $@ $(ASFLAGS) -c mpi_mips.s 1.125 + 1.126 +mpi_sparc.o : montmulf.h 1.127 + 1.128 +mpv_sparcv9.s: vis_64.il mpv_sparc.c 1.129 + $(CC) -o $@ $(SOLARIS_FPU_FLAGS) -S vis_64.il mpv_sparc.c 1.130 + 1.131 +mpv_sparcv8.s: vis_64.il mpv_sparc.c 1.132 + $(CC) -o $@ $(SOLARIS_FPU_FLAGS) -S vis_32.il mpv_sparc.c 1.133 + 1.134 +montmulfv8.o montmulfv9.o mpv_sparcv8.o mpv_sparcv9.o : %.o : %.s 1.135 + $(CC) -o $@ $(SOLARIS_ASM_FLAGS) -c $< 1.136 + 1.137 +mpi_arm.o: mpi_arm.c $(LIBHDRS) 1.138 + 1.139 +# This rule is used to build the .s sources, which are then hand optimized. 1.140 +#montmulfv8.s montmulfv9.s : montmulf%.s : montmulf%.il montmulf.c montmulf.h 1.141 +# $(CC) -o $@ $(SOLARIS_ASM_FLAGS) -S montmulf$*.il montmulf.c 1.142 + 1.143 + 1.144 +libmpi.a: $(LIBOBJS) 1.145 + ar -cvr libmpi.a $(LIBOBJS) 1.146 + $(RANLIB) libmpi.a 1.147 + 1.148 +lib libs: libmpi.a 1.149 + 1.150 +mpi.i: mpi.h 1.151 + 1.152 +#--------------------------------------- 1.153 + 1.154 +MPTESTOBJS = mptest1.o mptest2.o mptest3.o mptest3a.o mptest4.o mptest4a.o \ 1.155 + mptest4b.o mptest6.o mptest7.o mptest8.o mptest9.o mptestb.o 1.156 +MPTESTS = $(MPTESTOBJS:.o=) 1.157 + 1.158 +$(MPTESTOBJS): mptest%.o: tests/mptest-%.c $(LIBHDRS) 1.159 + $(CC) $(CFLAGS) -o $@ -c $< 1.160 + 1.161 +$(MPTESTS): mptest%: mptest%.o libmpi.a 1.162 + $(CC) $(CFLAGS) -o $@ $^ $(LIBS) 1.163 + 1.164 +tests: mptest1 mptest2 mptest3 mptest3a mptest4 mptest4a mptest4b mptest6 \ 1.165 + mptestb bbsrand 1.166 + 1.167 +utests: mptest7 mptest8 mptest9 1.168 + 1.169 +#--------------------------------------- 1.170 + 1.171 +EXTRAOBJS = bbsrand.o bbs_rand.o prng.o 1.172 +UTILOBJS = primegen.o metime.o identest.o basecvt.o fact.o exptmod.o pi.o \ 1.173 + makeprime.o gcd.o invmod.o lap.o isprime.o \ 1.174 + dec2hex.o hex2dec.o 1.175 +UTILS = $(UTILOBJS:.o=) 1.176 + 1.177 +$(UTILS): % : %.o libmpi.a 1.178 + $(CC) $(CFLAGS) -o $@ $^ $(LIBS) 1.179 + 1.180 +$(UTILOBJS) $(EXTRAOBJS): %.o : utils/%.c $(LIBHDRS) 1.181 + $(CC) $(CFLAGS) -o $@ -c $< 1.182 + 1.183 +prng: prng.o bbs_rand.o libmpi.a 1.184 + $(CC) $(CFLAGS) -o $@ $^ $(LIBS) 1.185 + 1.186 +bbsrand: bbsrand.o bbs_rand.o libmpi.a 1.187 + $(CC) $(CFLAGS) -o $@ $^ $(LIBS) 1.188 + 1.189 +utils: $(UTILS) prng bbsrand 1.190 + 1.191 +#--------------------------------------- 1.192 + 1.193 +test-info.c: test-arrays.txt 1.194 + $(PERL) make-test-arrays test-arrays.txt > test-info.c 1.195 + 1.196 +mpi-test.o: mpi-test.c test-info.c $(LIBHDRS) 1.197 + $(CC) $(CFLAGS) -o $@ -c $< 1.198 + 1.199 +mpi-test: mpi-test.o libmpi.a 1.200 + $(CC) $(CFLAGS) -o $@ $^ $(LIBS) 1.201 + 1.202 +mdxptest.o: mdxptest.c $(LIBHDRS) mpi-priv.h 1.203 + 1.204 +mdxptest: mdxptest.o libmpi.a 1.205 + $(CC) $(CFLAGS) -o $@ $^ $(LIBS) 1.206 + 1.207 +mulsqr.o: mulsqr.c logtab.h mpi.h mpi-config.h mpprime.h 1.208 + $(CC) $(CFLAGS) -DMP_SQUARE=1 -o $@ -c mulsqr.c 1.209 + 1.210 +mulsqr: mulsqr.o libmpi.a 1.211 + $(CC) $(CFLAGS) -o $@ $^ $(LIBS) 1.212 + 1.213 +#--------------------------------------- 1.214 + 1.215 +alltests: tests utests mpi-test 1.216 + 1.217 +tools: $(TOOLS) 1.218 + 1.219 +doc: 1.220 + (cd doc; ./build) 1.221 + 1.222 +clean: 1.223 + rm -f *.o *.a *.i 1.224 + rm -f core 1.225 + rm -f *~ .*~ 1.226 + rm -f utils/*.o 1.227 + rm -f utils/core 1.228 + rm -f utils/*~ utils/.*~ 1.229 + 1.230 +clobber: clean 1.231 + rm -f $(TOOLS) $(UTILS) 1.232 + 1.233 +distclean: clean 1.234 + rm -f mptest? mpi-test metime mulsqr karatsuba 1.235 + rm -f mptest?a mptest?b 1.236 + rm -f utils/mptest? 1.237 + rm -f test-info.c logtab.h 1.238 + rm -f libmpi.a 1.239 + rm -f $(TOOLS) 1.240 + 1.241 +dist: Makefile $(HDRS) $(SRCS) $(DOCS) 1.242 + tar -cvf mpi-$(VERS).tar Makefile $(HDRS) $(SRCS) $(DOCS) 1.243 + pgps -ab mpi-$(VERS).tar 1.244 + chmod +r mpi-$(VERS).tar.asc 1.245 + gzip -9 mpi-$(VERS).tar 1.246 + 1.247 +# END