security/nss/lib/freebl/mpi/Makefile

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 #
michael@0 2 # Makefile for MPI library
michael@0 3
michael@0 4 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 5 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 7
michael@0 8 ## Define CC to be the C compiler you wish to use. The GNU cc
michael@0 9 ## compiler (gcc) should work, at the very least
michael@0 10 #CC=cc
michael@0 11 #CC=gcc
michael@0 12
michael@0 13 ##
michael@0 14 ## Define PERL to point to your local Perl interpreter. It
michael@0 15 ## should be Perl 5.x, although it's conceivable that Perl 4
michael@0 16 ## might work ... I haven't tested it.
michael@0 17 ##
michael@0 18 #PERL=/usr/bin/perl
michael@0 19 #PERL=perl
michael@0 20
michael@0 21 include target.mk
michael@0 22
michael@0 23 CFLAGS+= $(XCFLAGS)
michael@0 24
michael@0 25 ##
michael@0 26 ## Define LIBS to include any libraries you need to link against.
michael@0 27 ## If NO_TABLE is define, LIBS should include '-lm' or whatever is
michael@0 28 ## necessary to bring in the math library. Otherwise, it can be
michael@0 29 ## left alone, unless your system has other peculiar requirements.
michael@0 30 ##
michael@0 31 LIBS=#-lmalloc#-lefence#-lm
michael@0 32
michael@0 33 ##
michael@0 34 ## Define RANLIB to be the library header randomizer; you might not
michael@0 35 ## need this on some systems (just set it to 'echo' on these systems,
michael@0 36 ## such as IRIX)
michael@0 37 ##
michael@0 38 RANLIB=echo
michael@0 39
michael@0 40 ##
michael@0 41 ## This is the version string used for the documentation and
michael@0 42 ## building the distribution tarball. Don't mess with it unless
michael@0 43 ## you are releasing a new version
michael@0 44 VERS=1.7p6
michael@0 45
michael@0 46 ## ----------------------------------------------------------------------
michael@0 47 ## You probably don't need to change anything below this line...
michael@0 48 ##
michael@0 49
michael@0 50 ##
michael@0 51 ## This is the list of source files that need to be packed into
michael@0 52 ## the distribution file
michael@0 53 SRCS= mpi.c mpprime.c mplogic.c mp_gf2m.c mpmontg.c mpi-test.c primes.c \
michael@0 54 mpcpucache.c tests/ \
michael@0 55 utils/gcd.c utils/invmod.c utils/lap.c \
michael@0 56 utils/ptab.pl utils/sieve.c utils/isprime.c\
michael@0 57 utils/dec2hex.c utils/hex2dec.c utils/bbs_rand.c \
michael@0 58 utils/bbsrand.c utils/prng.c utils/primegen.c \
michael@0 59 utils/basecvt.c utils/makeprime.c\
michael@0 60 utils/fact.c utils/exptmod.c utils/pi.c utils/metime.c \
michael@0 61 utils/mpi.h utils/mpprime.h mulsqr.c \
michael@0 62 make-test-arrays test-arrays.txt all-tests make-logtab \
michael@0 63 types.pl stats timetest multest
michael@0 64
michael@0 65 ## These are the header files that go into the distribution file
michael@0 66 HDRS=mpi.h mpi-config.h utils/mpi.h utils/mpi-config.h mpprime.h mplogic.h mp_gf2m.h \
michael@0 67 mp_gf2m-priv.h utils/bbs_rand.h tests/mpi.h tests/mpprime.h
michael@0 68
michael@0 69 ## These are the documentation files that go into the distribution file
michael@0 70 DOCS=README doc utils/README utils/PRIMES
michael@0 71
michael@0 72 ## This is the list of tools built by 'make tools'
michael@0 73 TOOLS=gcd invmod isprime lap dec2hex hex2dec primegen prng \
michael@0 74 basecvt fact exptmod pi makeprime identest
michael@0 75
michael@0 76 LIBOBJS = mpprime.o mpmontg.o mplogic.o mp_gf2m.o mpi.o mpcpucache.o $(AS_OBJS)
michael@0 77 LIBHDRS = mpi-config.h mpi-priv.h mpi.h
michael@0 78 APPHDRS = mpi-config.h mpi.h mplogic.h mp_gf2m.h mpprime.h
michael@0 79
michael@0 80 help:
michael@0 81 @ echo ""
michael@0 82 @ echo "The following targets can be built with this Makefile:"
michael@0 83 @ echo ""
michael@0 84 @ echo "libmpi.a - arithmetic and prime testing library"
michael@0 85 @ echo "mpi-test - test driver (requires MP_IOFUNC)"
michael@0 86 @ echo "tools - command line tools"
michael@0 87 @ echo "doc - manual pages for tools"
michael@0 88 @ echo "clean - clean up objects and such"
michael@0 89 @ echo "distclean - get ready for distribution"
michael@0 90 @ echo "dist - distribution tarball"
michael@0 91 @ echo ""
michael@0 92
michael@0 93 .SUFFIXES: .c .o .i
michael@0 94
michael@0 95 .c.i:
michael@0 96 $(CC) $(CFLAGS) -E $< > $@
michael@0 97
michael@0 98 #.c.o: $*.h $*.c
michael@0 99 # $(CC) $(CFLAGS) -c $<
michael@0 100
michael@0 101 #---------------------------------------
michael@0 102
michael@0 103 $(LIBOBJS): $(LIBHDRS)
michael@0 104
michael@0 105 logtab.h: make-logtab
michael@0 106 $(PERL) make-logtab > logtab.h
michael@0 107
michael@0 108 mpi.o: mpi.c logtab.h $(LIBHDRS)
michael@0 109
michael@0 110 mplogic.o: mplogic.c mpi-priv.h mplogic.h $(LIBHDRS)
michael@0 111
michael@0 112 mp_gf2m.o: mp_gf2m.c mpi-priv.h mp_gf2m.h mp_gf2m-priv.h $(LIBHDRS)
michael@0 113
michael@0 114 mpmontg.o: mpmontg.c mpi-priv.h mplogic.h mpprime.h $(LIBHDRS)
michael@0 115
michael@0 116 mpprime.o: mpprime.c mpi-priv.h mpprime.h mplogic.h primes.c $(LIBHDRS)
michael@0 117
michael@0 118 mpcpucache.o: mpcpucache.c $(LIBHDRS)
michael@0 119
michael@0 120 mpi_mips.o: mpi_mips.s
michael@0 121 $(CC) -o $@ $(ASFLAGS) -c mpi_mips.s
michael@0 122
michael@0 123 mpi_sparc.o : montmulf.h
michael@0 124
michael@0 125 mpv_sparcv9.s: vis_64.il mpv_sparc.c
michael@0 126 $(CC) -o $@ $(SOLARIS_FPU_FLAGS) -S vis_64.il mpv_sparc.c
michael@0 127
michael@0 128 mpv_sparcv8.s: vis_64.il mpv_sparc.c
michael@0 129 $(CC) -o $@ $(SOLARIS_FPU_FLAGS) -S vis_32.il mpv_sparc.c
michael@0 130
michael@0 131 montmulfv8.o montmulfv9.o mpv_sparcv8.o mpv_sparcv9.o : %.o : %.s
michael@0 132 $(CC) -o $@ $(SOLARIS_ASM_FLAGS) -c $<
michael@0 133
michael@0 134 mpi_arm.o: mpi_arm.c $(LIBHDRS)
michael@0 135
michael@0 136 # This rule is used to build the .s sources, which are then hand optimized.
michael@0 137 #montmulfv8.s montmulfv9.s : montmulf%.s : montmulf%.il montmulf.c montmulf.h
michael@0 138 # $(CC) -o $@ $(SOLARIS_ASM_FLAGS) -S montmulf$*.il montmulf.c
michael@0 139
michael@0 140
michael@0 141 libmpi.a: $(LIBOBJS)
michael@0 142 ar -cvr libmpi.a $(LIBOBJS)
michael@0 143 $(RANLIB) libmpi.a
michael@0 144
michael@0 145 lib libs: libmpi.a
michael@0 146
michael@0 147 mpi.i: mpi.h
michael@0 148
michael@0 149 #---------------------------------------
michael@0 150
michael@0 151 MPTESTOBJS = mptest1.o mptest2.o mptest3.o mptest3a.o mptest4.o mptest4a.o \
michael@0 152 mptest4b.o mptest6.o mptest7.o mptest8.o mptest9.o mptestb.o
michael@0 153 MPTESTS = $(MPTESTOBJS:.o=)
michael@0 154
michael@0 155 $(MPTESTOBJS): mptest%.o: tests/mptest-%.c $(LIBHDRS)
michael@0 156 $(CC) $(CFLAGS) -o $@ -c $<
michael@0 157
michael@0 158 $(MPTESTS): mptest%: mptest%.o libmpi.a
michael@0 159 $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
michael@0 160
michael@0 161 tests: mptest1 mptest2 mptest3 mptest3a mptest4 mptest4a mptest4b mptest6 \
michael@0 162 mptestb bbsrand
michael@0 163
michael@0 164 utests: mptest7 mptest8 mptest9
michael@0 165
michael@0 166 #---------------------------------------
michael@0 167
michael@0 168 EXTRAOBJS = bbsrand.o bbs_rand.o prng.o
michael@0 169 UTILOBJS = primegen.o metime.o identest.o basecvt.o fact.o exptmod.o pi.o \
michael@0 170 makeprime.o gcd.o invmod.o lap.o isprime.o \
michael@0 171 dec2hex.o hex2dec.o
michael@0 172 UTILS = $(UTILOBJS:.o=)
michael@0 173
michael@0 174 $(UTILS): % : %.o libmpi.a
michael@0 175 $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
michael@0 176
michael@0 177 $(UTILOBJS) $(EXTRAOBJS): %.o : utils/%.c $(LIBHDRS)
michael@0 178 $(CC) $(CFLAGS) -o $@ -c $<
michael@0 179
michael@0 180 prng: prng.o bbs_rand.o libmpi.a
michael@0 181 $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
michael@0 182
michael@0 183 bbsrand: bbsrand.o bbs_rand.o libmpi.a
michael@0 184 $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
michael@0 185
michael@0 186 utils: $(UTILS) prng bbsrand
michael@0 187
michael@0 188 #---------------------------------------
michael@0 189
michael@0 190 test-info.c: test-arrays.txt
michael@0 191 $(PERL) make-test-arrays test-arrays.txt > test-info.c
michael@0 192
michael@0 193 mpi-test.o: mpi-test.c test-info.c $(LIBHDRS)
michael@0 194 $(CC) $(CFLAGS) -o $@ -c $<
michael@0 195
michael@0 196 mpi-test: mpi-test.o libmpi.a
michael@0 197 $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
michael@0 198
michael@0 199 mdxptest.o: mdxptest.c $(LIBHDRS) mpi-priv.h
michael@0 200
michael@0 201 mdxptest: mdxptest.o libmpi.a
michael@0 202 $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
michael@0 203
michael@0 204 mulsqr.o: mulsqr.c logtab.h mpi.h mpi-config.h mpprime.h
michael@0 205 $(CC) $(CFLAGS) -DMP_SQUARE=1 -o $@ -c mulsqr.c
michael@0 206
michael@0 207 mulsqr: mulsqr.o libmpi.a
michael@0 208 $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
michael@0 209
michael@0 210 #---------------------------------------
michael@0 211
michael@0 212 alltests: tests utests mpi-test
michael@0 213
michael@0 214 tools: $(TOOLS)
michael@0 215
michael@0 216 doc:
michael@0 217 (cd doc; ./build)
michael@0 218
michael@0 219 clean:
michael@0 220 rm -f *.o *.a *.i
michael@0 221 rm -f core
michael@0 222 rm -f *~ .*~
michael@0 223 rm -f utils/*.o
michael@0 224 rm -f utils/core
michael@0 225 rm -f utils/*~ utils/.*~
michael@0 226
michael@0 227 clobber: clean
michael@0 228 rm -f $(TOOLS) $(UTILS)
michael@0 229
michael@0 230 distclean: clean
michael@0 231 rm -f mptest? mpi-test metime mulsqr karatsuba
michael@0 232 rm -f mptest?a mptest?b
michael@0 233 rm -f utils/mptest?
michael@0 234 rm -f test-info.c logtab.h
michael@0 235 rm -f libmpi.a
michael@0 236 rm -f $(TOOLS)
michael@0 237
michael@0 238 dist: Makefile $(HDRS) $(SRCS) $(DOCS)
michael@0 239 tar -cvf mpi-$(VERS).tar Makefile $(HDRS) $(SRCS) $(DOCS)
michael@0 240 pgps -ab mpi-$(VERS).tar
michael@0 241 chmod +r mpi-$(VERS).tar.asc
michael@0 242 gzip -9 mpi-$(VERS).tar
michael@0 243
michael@0 244 # END

mercurial