|
1 # |
|
2 # Makefile for elliptic curve library |
|
3 |
|
4 # This Source Code Form is subject to the terms of the Mozilla Public |
|
5 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
7 |
|
8 ## Define CC to be the C compiler you wish to use. The GNU cc |
|
9 ## compiler (gcc) should work, at the very least |
|
10 #CC=cc |
|
11 #CC=gcc |
|
12 |
|
13 ## |
|
14 ## Define PERL to point to your local Perl interpreter. It |
|
15 ## should be Perl 5.x, although it's conceivable that Perl 4 |
|
16 ## might work ... I haven't tested it. |
|
17 ## |
|
18 #PERL=/usr/bin/perl |
|
19 #PERL=perl |
|
20 |
|
21 include ../mpi/target.mk |
|
22 |
|
23 ## |
|
24 ## Define platform-dependent variables for use of floating-point code. |
|
25 ## |
|
26 ifeq ($(TARGET),v9SOLARIS) |
|
27 ECL_USE_FP=1 |
|
28 else |
|
29 ifeq ($(TARGET),v8plusSOLARIS) |
|
30 ECL_USE_FP=1 |
|
31 else |
|
32 ifeq ($(TARGET),v8SOLARIS) |
|
33 ECL_USE_FP=1 |
|
34 else |
|
35 ifeq ($(TARGET),x86LINUX) |
|
36 ECL_USE_FP=1 |
|
37 endif |
|
38 endif |
|
39 endif |
|
40 endif |
|
41 |
|
42 ## |
|
43 ## Add to definition of CFLAGS depending on use of floating-point code. |
|
44 ## |
|
45 ifeq ($(ECL_USE_FP),1) |
|
46 CFLAGS+= -DECL_USE_FP |
|
47 endif |
|
48 |
|
49 ## |
|
50 ## Define LIBS to include any libraries you need to link against. |
|
51 ## If NO_TABLE is define, LIBS should include '-lm' or whatever is |
|
52 ## necessary to bring in the math library. Otherwise, it can be |
|
53 ## left alone, unless your system has other peculiar requirements. |
|
54 ## |
|
55 LIBS=-L../mpi -lmpi -lm#-lmalloc#-lefence |
|
56 |
|
57 ## |
|
58 ## Define INCLUDES to include any include directories you need to |
|
59 ## compile with. |
|
60 ## |
|
61 INCLUDES=-I../mpi |
|
62 CFLAGS+= $(INCLUDES) $(XCFLAGS) |
|
63 |
|
64 ## |
|
65 ## Define RANLIB to be the library header randomizer; you might not |
|
66 ## need this on some systems (just set it to 'echo' on these systems, |
|
67 ## such as IRIX) |
|
68 ## |
|
69 RANLIB=echo |
|
70 |
|
71 ## |
|
72 ## Define LIBOBJS to be the object files that will be created during |
|
73 ## the build process. |
|
74 ## |
|
75 LIBOBJS = ecl.o ecl_curve.o ecl_mult.o ecl_gf.o \ |
|
76 ec2_aff.o ec2_mont.o ec2_proj.o \ |
|
77 ec2_163.o ec2_193.o ec2_233.o \ |
|
78 ecp_aff.o ecp_jac.o ecp_mont.o \ |
|
79 ec_naf.o ecp_jm.o \ |
|
80 ecp_192.o ecp_224.o ecp_256.o ecp_384.o ecp_521.o \ |
|
81 ecp_256_32.o |
|
82 ifeq ($(ECL_USE_FP),1) |
|
83 LIBOBJS+= ecp_fp160.o ecp_fp192.o ecp_fp224.o ecp_fp.o |
|
84 endif |
|
85 |
|
86 ## The headers contained in this library. |
|
87 LIBHDRS = ecl-exp.h ecl.h ec2.h ecp.h ecl-priv.h ecl-curve.h |
|
88 APPHDRS = ecl-exp.h ecl.h ec2.h ecp.h ecl-priv.h ecl-curve.h |
|
89 ifeq ($(ECL_GFP_ASSEMBLY_FP),1) |
|
90 LIBHDRS += ecp_fp.h |
|
91 APPHDRS += ecp_fp.h |
|
92 endif |
|
93 |
|
94 |
|
95 help: |
|
96 @ echo "" |
|
97 @ echo "The following targets can be built with this Makefile:" |
|
98 @ echo "" |
|
99 @ echo "libecl.a - elliptic curve library" |
|
100 @ echo "tests - build command line tests" |
|
101 @ echo "test - run command line tests" |
|
102 @ echo "clean - clean up objects and such" |
|
103 @ echo "" |
|
104 |
|
105 .SUFFIXES: .c .o .i |
|
106 |
|
107 .c.i: |
|
108 $(CC) $(CFLAGS) -E $< > $@ |
|
109 |
|
110 #--------------------------------------- |
|
111 |
|
112 $(LIBOBJS): $(LIBHDRS) |
|
113 |
|
114 ecl.o: ecl.c $(LIBHDRS) |
|
115 ecl_curve.o: ecl_curve.c $(LIBHDRS) |
|
116 ecl_mult.o: ecl_mult.c $(LIBHDRS) |
|
117 ecl_gf.o: ecl_gf.c $(LIBHDRS) |
|
118 ec2_aff.o: ec2_aff.c $(LIBHDRS) |
|
119 ec2_mont.o: ec2_mont.c $(LIBHDRS) |
|
120 ec2_proj.o: ec2_proj.c $(LIBHDRS) |
|
121 ec2_163.o: ec2_163.c $(LIBHDRS) |
|
122 ec2_193.o: ec2_193.c $(LIBHDRS) |
|
123 ec2_233.o: ec2_233.c $(LIBHDRS) |
|
124 ecp_aff.o: ecp_aff.c $(LIBHDRS) |
|
125 ecp_jac.o: ecp_jac.c $(LIBHDRS) |
|
126 ecp_jm.o: ecp_jm.c $(LIBHDRS) |
|
127 ecp_mont.o: ecp_mont.c $(LIBHDRS) |
|
128 ecp_192.o: ecp_192.c $(LIBHDRS) |
|
129 ecp_224.o: ecp_224.c $(LIBHDRS) |
|
130 ecp_256.o: ecp_256.c $(LIBHDRS) |
|
131 ecp_384.o: ecp_384.c $(LIBHDRS) |
|
132 ecp_521.o: ecp_521.c $(LIBHDRS) |
|
133 ecp_fp.o: ecp_fp.c $(LIBHDRS) |
|
134 ifeq ($(ECL_USE_FP),1) |
|
135 ecp_fp160.o: ecp_fp160.c ecp_fpinc.c $(LIBHDRS) |
|
136 ecp_fp192.o: ecp_fp192.c ecp_fpinc.c $(LIBHDRS) |
|
137 ecp_fp224.o: ecp_fp224.c ecp_fpinc.c $(LIBHDRS) |
|
138 endif |
|
139 |
|
140 libecl.a: $(LIBOBJS) |
|
141 ar -cvr libecl.a $(LIBOBJS) |
|
142 $(RANLIB) libecl.a |
|
143 |
|
144 lib libs: libecl.a |
|
145 |
|
146 ecl.i: ecl.h |
|
147 |
|
148 #--------------------------------------- |
|
149 |
|
150 ECLTESTOBJS = ec2_test.o ecp_test.o ec_naft.o |
|
151 ifeq ($(ECL_USE_FP),1) |
|
152 ECLTESTOBJS+= ecp_fpt.o |
|
153 endif |
|
154 ECLTESTS = $(ECLTESTOBJS:.o=) |
|
155 |
|
156 $(ECLTESTOBJS): %.o: tests/%.c $(LIBHDRS) |
|
157 $(CC) $(CFLAGS) -o $@ -c $< $(INCLUDES) |
|
158 |
|
159 $(ECLTESTS): %: %.o libecl.a |
|
160 $(CC) $(CFLAGS) -o $@ $^ $(LIBS) |
|
161 |
|
162 ifeq ($(ECL_USE_FP),1) |
|
163 tests: ec2_test ecp_test ec_naft ecp_fpt |
|
164 else |
|
165 tests: ec2_test ecp_test ec_naft |
|
166 endif |
|
167 |
|
168 #--------------------------------------- |
|
169 |
|
170 ifeq ($(ECL_USE_FP),1) |
|
171 test: tests |
|
172 ./ecp_test |
|
173 ./ec2_test |
|
174 ./ec_naft |
|
175 ./ecp_fpt |
|
176 else |
|
177 test: tests |
|
178 ./ecp_test |
|
179 ./ec_naft |
|
180 ./ec2_test |
|
181 endif |
|
182 |
|
183 #--------------------------------------- |
|
184 |
|
185 alltests: tests |
|
186 |
|
187 clean: |
|
188 rm -f *.o *.a *.i |
|
189 rm -f core |
|
190 rm -f *~ .*~ |
|
191 rm -f $(ECLTESTS) |
|
192 |
|
193 clobber: clean |
|
194 |
|
195 # END |