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 for elliptic curve 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 ../mpi/target.mk |
michael@0 | 22 | |
michael@0 | 23 | ## |
michael@0 | 24 | ## Define platform-dependent variables for use of floating-point code. |
michael@0 | 25 | ## |
michael@0 | 26 | ifeq ($(TARGET),v9SOLARIS) |
michael@0 | 27 | ECL_USE_FP=1 |
michael@0 | 28 | else |
michael@0 | 29 | ifeq ($(TARGET),v8plusSOLARIS) |
michael@0 | 30 | ECL_USE_FP=1 |
michael@0 | 31 | else |
michael@0 | 32 | ifeq ($(TARGET),v8SOLARIS) |
michael@0 | 33 | ECL_USE_FP=1 |
michael@0 | 34 | else |
michael@0 | 35 | ifeq ($(TARGET),x86LINUX) |
michael@0 | 36 | ECL_USE_FP=1 |
michael@0 | 37 | endif |
michael@0 | 38 | endif |
michael@0 | 39 | endif |
michael@0 | 40 | endif |
michael@0 | 41 | |
michael@0 | 42 | ## |
michael@0 | 43 | ## Add to definition of CFLAGS depending on use of floating-point code. |
michael@0 | 44 | ## |
michael@0 | 45 | ifeq ($(ECL_USE_FP),1) |
michael@0 | 46 | CFLAGS+= -DECL_USE_FP |
michael@0 | 47 | endif |
michael@0 | 48 | |
michael@0 | 49 | ## |
michael@0 | 50 | ## Define LIBS to include any libraries you need to link against. |
michael@0 | 51 | ## If NO_TABLE is define, LIBS should include '-lm' or whatever is |
michael@0 | 52 | ## necessary to bring in the math library. Otherwise, it can be |
michael@0 | 53 | ## left alone, unless your system has other peculiar requirements. |
michael@0 | 54 | ## |
michael@0 | 55 | LIBS=-L../mpi -lmpi -lm#-lmalloc#-lefence |
michael@0 | 56 | |
michael@0 | 57 | ## |
michael@0 | 58 | ## Define INCLUDES to include any include directories you need to |
michael@0 | 59 | ## compile with. |
michael@0 | 60 | ## |
michael@0 | 61 | INCLUDES=-I../mpi |
michael@0 | 62 | CFLAGS+= $(INCLUDES) $(XCFLAGS) |
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 | ## Define LIBOBJS to be the object files that will be created during |
michael@0 | 73 | ## the build process. |
michael@0 | 74 | ## |
michael@0 | 75 | LIBOBJS = ecl.o ecl_curve.o ecl_mult.o ecl_gf.o \ |
michael@0 | 76 | ec2_aff.o ec2_mont.o ec2_proj.o \ |
michael@0 | 77 | ec2_163.o ec2_193.o ec2_233.o \ |
michael@0 | 78 | ecp_aff.o ecp_jac.o ecp_mont.o \ |
michael@0 | 79 | ec_naf.o ecp_jm.o \ |
michael@0 | 80 | ecp_192.o ecp_224.o ecp_256.o ecp_384.o ecp_521.o \ |
michael@0 | 81 | ecp_256_32.o |
michael@0 | 82 | ifeq ($(ECL_USE_FP),1) |
michael@0 | 83 | LIBOBJS+= ecp_fp160.o ecp_fp192.o ecp_fp224.o ecp_fp.o |
michael@0 | 84 | endif |
michael@0 | 85 | |
michael@0 | 86 | ## The headers contained in this library. |
michael@0 | 87 | LIBHDRS = ecl-exp.h ecl.h ec2.h ecp.h ecl-priv.h ecl-curve.h |
michael@0 | 88 | APPHDRS = ecl-exp.h ecl.h ec2.h ecp.h ecl-priv.h ecl-curve.h |
michael@0 | 89 | ifeq ($(ECL_GFP_ASSEMBLY_FP),1) |
michael@0 | 90 | LIBHDRS += ecp_fp.h |
michael@0 | 91 | APPHDRS += ecp_fp.h |
michael@0 | 92 | endif |
michael@0 | 93 | |
michael@0 | 94 | |
michael@0 | 95 | help: |
michael@0 | 96 | @ echo "" |
michael@0 | 97 | @ echo "The following targets can be built with this Makefile:" |
michael@0 | 98 | @ echo "" |
michael@0 | 99 | @ echo "libecl.a - elliptic curve library" |
michael@0 | 100 | @ echo "tests - build command line tests" |
michael@0 | 101 | @ echo "test - run command line tests" |
michael@0 | 102 | @ echo "clean - clean up objects and such" |
michael@0 | 103 | @ echo "" |
michael@0 | 104 | |
michael@0 | 105 | .SUFFIXES: .c .o .i |
michael@0 | 106 | |
michael@0 | 107 | .c.i: |
michael@0 | 108 | $(CC) $(CFLAGS) -E $< > $@ |
michael@0 | 109 | |
michael@0 | 110 | #--------------------------------------- |
michael@0 | 111 | |
michael@0 | 112 | $(LIBOBJS): $(LIBHDRS) |
michael@0 | 113 | |
michael@0 | 114 | ecl.o: ecl.c $(LIBHDRS) |
michael@0 | 115 | ecl_curve.o: ecl_curve.c $(LIBHDRS) |
michael@0 | 116 | ecl_mult.o: ecl_mult.c $(LIBHDRS) |
michael@0 | 117 | ecl_gf.o: ecl_gf.c $(LIBHDRS) |
michael@0 | 118 | ec2_aff.o: ec2_aff.c $(LIBHDRS) |
michael@0 | 119 | ec2_mont.o: ec2_mont.c $(LIBHDRS) |
michael@0 | 120 | ec2_proj.o: ec2_proj.c $(LIBHDRS) |
michael@0 | 121 | ec2_163.o: ec2_163.c $(LIBHDRS) |
michael@0 | 122 | ec2_193.o: ec2_193.c $(LIBHDRS) |
michael@0 | 123 | ec2_233.o: ec2_233.c $(LIBHDRS) |
michael@0 | 124 | ecp_aff.o: ecp_aff.c $(LIBHDRS) |
michael@0 | 125 | ecp_jac.o: ecp_jac.c $(LIBHDRS) |
michael@0 | 126 | ecp_jm.o: ecp_jm.c $(LIBHDRS) |
michael@0 | 127 | ecp_mont.o: ecp_mont.c $(LIBHDRS) |
michael@0 | 128 | ecp_192.o: ecp_192.c $(LIBHDRS) |
michael@0 | 129 | ecp_224.o: ecp_224.c $(LIBHDRS) |
michael@0 | 130 | ecp_256.o: ecp_256.c $(LIBHDRS) |
michael@0 | 131 | ecp_384.o: ecp_384.c $(LIBHDRS) |
michael@0 | 132 | ecp_521.o: ecp_521.c $(LIBHDRS) |
michael@0 | 133 | ecp_fp.o: ecp_fp.c $(LIBHDRS) |
michael@0 | 134 | ifeq ($(ECL_USE_FP),1) |
michael@0 | 135 | ecp_fp160.o: ecp_fp160.c ecp_fpinc.c $(LIBHDRS) |
michael@0 | 136 | ecp_fp192.o: ecp_fp192.c ecp_fpinc.c $(LIBHDRS) |
michael@0 | 137 | ecp_fp224.o: ecp_fp224.c ecp_fpinc.c $(LIBHDRS) |
michael@0 | 138 | endif |
michael@0 | 139 | |
michael@0 | 140 | libecl.a: $(LIBOBJS) |
michael@0 | 141 | ar -cvr libecl.a $(LIBOBJS) |
michael@0 | 142 | $(RANLIB) libecl.a |
michael@0 | 143 | |
michael@0 | 144 | lib libs: libecl.a |
michael@0 | 145 | |
michael@0 | 146 | ecl.i: ecl.h |
michael@0 | 147 | |
michael@0 | 148 | #--------------------------------------- |
michael@0 | 149 | |
michael@0 | 150 | ECLTESTOBJS = ec2_test.o ecp_test.o ec_naft.o |
michael@0 | 151 | ifeq ($(ECL_USE_FP),1) |
michael@0 | 152 | ECLTESTOBJS+= ecp_fpt.o |
michael@0 | 153 | endif |
michael@0 | 154 | ECLTESTS = $(ECLTESTOBJS:.o=) |
michael@0 | 155 | |
michael@0 | 156 | $(ECLTESTOBJS): %.o: tests/%.c $(LIBHDRS) |
michael@0 | 157 | $(CC) $(CFLAGS) -o $@ -c $< $(INCLUDES) |
michael@0 | 158 | |
michael@0 | 159 | $(ECLTESTS): %: %.o libecl.a |
michael@0 | 160 | $(CC) $(CFLAGS) -o $@ $^ $(LIBS) |
michael@0 | 161 | |
michael@0 | 162 | ifeq ($(ECL_USE_FP),1) |
michael@0 | 163 | tests: ec2_test ecp_test ec_naft ecp_fpt |
michael@0 | 164 | else |
michael@0 | 165 | tests: ec2_test ecp_test ec_naft |
michael@0 | 166 | endif |
michael@0 | 167 | |
michael@0 | 168 | #--------------------------------------- |
michael@0 | 169 | |
michael@0 | 170 | ifeq ($(ECL_USE_FP),1) |
michael@0 | 171 | test: tests |
michael@0 | 172 | ./ecp_test |
michael@0 | 173 | ./ec2_test |
michael@0 | 174 | ./ec_naft |
michael@0 | 175 | ./ecp_fpt |
michael@0 | 176 | else |
michael@0 | 177 | test: tests |
michael@0 | 178 | ./ecp_test |
michael@0 | 179 | ./ec_naft |
michael@0 | 180 | ./ec2_test |
michael@0 | 181 | endif |
michael@0 | 182 | |
michael@0 | 183 | #--------------------------------------- |
michael@0 | 184 | |
michael@0 | 185 | alltests: tests |
michael@0 | 186 | |
michael@0 | 187 | clean: |
michael@0 | 188 | rm -f *.o *.a *.i |
michael@0 | 189 | rm -f core |
michael@0 | 190 | rm -f *~ .*~ |
michael@0 | 191 | rm -f $(ECLTESTS) |
michael@0 | 192 | |
michael@0 | 193 | clobber: clean |
michael@0 | 194 | |
michael@0 | 195 | # END |