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