michael@0: # michael@0: # Makefile for elliptic curve library michael@0: michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ## Define CC to be the C compiler you wish to use. The GNU cc michael@0: ## compiler (gcc) should work, at the very least michael@0: #CC=cc michael@0: #CC=gcc michael@0: michael@0: ## michael@0: ## Define PERL to point to your local Perl interpreter. It michael@0: ## should be Perl 5.x, although it's conceivable that Perl 4 michael@0: ## might work ... I haven't tested it. michael@0: ## michael@0: #PERL=/usr/bin/perl michael@0: #PERL=perl michael@0: michael@0: include ../mpi/target.mk michael@0: michael@0: ## michael@0: ## Define platform-dependent variables for use of floating-point code. michael@0: ## michael@0: ifeq ($(TARGET),v9SOLARIS) michael@0: ECL_USE_FP=1 michael@0: else michael@0: ifeq ($(TARGET),v8plusSOLARIS) michael@0: ECL_USE_FP=1 michael@0: else michael@0: ifeq ($(TARGET),v8SOLARIS) michael@0: ECL_USE_FP=1 michael@0: else michael@0: ifeq ($(TARGET),x86LINUX) michael@0: ECL_USE_FP=1 michael@0: endif michael@0: endif michael@0: endif michael@0: endif michael@0: michael@0: ## michael@0: ## Add to definition of CFLAGS depending on use of floating-point code. michael@0: ## michael@0: ifeq ($(ECL_USE_FP),1) michael@0: CFLAGS+= -DECL_USE_FP michael@0: endif michael@0: michael@0: ## michael@0: ## Define LIBS to include any libraries you need to link against. michael@0: ## If NO_TABLE is define, LIBS should include '-lm' or whatever is michael@0: ## necessary to bring in the math library. Otherwise, it can be michael@0: ## left alone, unless your system has other peculiar requirements. michael@0: ## michael@0: LIBS=-L../mpi -lmpi -lm#-lmalloc#-lefence michael@0: michael@0: ## michael@0: ## Define INCLUDES to include any include directories you need to michael@0: ## compile with. michael@0: ## michael@0: INCLUDES=-I../mpi michael@0: CFLAGS+= $(INCLUDES) $(XCFLAGS) michael@0: michael@0: ## michael@0: ## Define RANLIB to be the library header randomizer; you might not michael@0: ## need this on some systems (just set it to 'echo' on these systems, michael@0: ## such as IRIX) michael@0: ## michael@0: RANLIB=echo michael@0: michael@0: ## michael@0: ## Define LIBOBJS to be the object files that will be created during michael@0: ## the build process. michael@0: ## michael@0: LIBOBJS = ecl.o ecl_curve.o ecl_mult.o ecl_gf.o \ michael@0: ec2_aff.o ec2_mont.o ec2_proj.o \ michael@0: ec2_163.o ec2_193.o ec2_233.o \ michael@0: ecp_aff.o ecp_jac.o ecp_mont.o \ michael@0: ec_naf.o ecp_jm.o \ michael@0: ecp_192.o ecp_224.o ecp_256.o ecp_384.o ecp_521.o \ michael@0: ecp_256_32.o michael@0: ifeq ($(ECL_USE_FP),1) michael@0: LIBOBJS+= ecp_fp160.o ecp_fp192.o ecp_fp224.o ecp_fp.o michael@0: endif michael@0: michael@0: ## The headers contained in this library. michael@0: LIBHDRS = ecl-exp.h ecl.h ec2.h ecp.h ecl-priv.h ecl-curve.h michael@0: APPHDRS = ecl-exp.h ecl.h ec2.h ecp.h ecl-priv.h ecl-curve.h michael@0: ifeq ($(ECL_GFP_ASSEMBLY_FP),1) michael@0: LIBHDRS += ecp_fp.h michael@0: APPHDRS += ecp_fp.h michael@0: endif michael@0: michael@0: michael@0: help: michael@0: @ echo "" michael@0: @ echo "The following targets can be built with this Makefile:" michael@0: @ echo "" michael@0: @ echo "libecl.a - elliptic curve library" michael@0: @ echo "tests - build command line tests" michael@0: @ echo "test - run command line tests" michael@0: @ echo "clean - clean up objects and such" michael@0: @ echo "" michael@0: michael@0: .SUFFIXES: .c .o .i michael@0: michael@0: .c.i: michael@0: $(CC) $(CFLAGS) -E $< > $@ michael@0: michael@0: #--------------------------------------- michael@0: michael@0: $(LIBOBJS): $(LIBHDRS) michael@0: michael@0: ecl.o: ecl.c $(LIBHDRS) michael@0: ecl_curve.o: ecl_curve.c $(LIBHDRS) michael@0: ecl_mult.o: ecl_mult.c $(LIBHDRS) michael@0: ecl_gf.o: ecl_gf.c $(LIBHDRS) michael@0: ec2_aff.o: ec2_aff.c $(LIBHDRS) michael@0: ec2_mont.o: ec2_mont.c $(LIBHDRS) michael@0: ec2_proj.o: ec2_proj.c $(LIBHDRS) michael@0: ec2_163.o: ec2_163.c $(LIBHDRS) michael@0: ec2_193.o: ec2_193.c $(LIBHDRS) michael@0: ec2_233.o: ec2_233.c $(LIBHDRS) michael@0: ecp_aff.o: ecp_aff.c $(LIBHDRS) michael@0: ecp_jac.o: ecp_jac.c $(LIBHDRS) michael@0: ecp_jm.o: ecp_jm.c $(LIBHDRS) michael@0: ecp_mont.o: ecp_mont.c $(LIBHDRS) michael@0: ecp_192.o: ecp_192.c $(LIBHDRS) michael@0: ecp_224.o: ecp_224.c $(LIBHDRS) michael@0: ecp_256.o: ecp_256.c $(LIBHDRS) michael@0: ecp_384.o: ecp_384.c $(LIBHDRS) michael@0: ecp_521.o: ecp_521.c $(LIBHDRS) michael@0: ecp_fp.o: ecp_fp.c $(LIBHDRS) michael@0: ifeq ($(ECL_USE_FP),1) michael@0: ecp_fp160.o: ecp_fp160.c ecp_fpinc.c $(LIBHDRS) michael@0: ecp_fp192.o: ecp_fp192.c ecp_fpinc.c $(LIBHDRS) michael@0: ecp_fp224.o: ecp_fp224.c ecp_fpinc.c $(LIBHDRS) michael@0: endif michael@0: michael@0: libecl.a: $(LIBOBJS) michael@0: ar -cvr libecl.a $(LIBOBJS) michael@0: $(RANLIB) libecl.a michael@0: michael@0: lib libs: libecl.a michael@0: michael@0: ecl.i: ecl.h michael@0: michael@0: #--------------------------------------- michael@0: michael@0: ECLTESTOBJS = ec2_test.o ecp_test.o ec_naft.o michael@0: ifeq ($(ECL_USE_FP),1) michael@0: ECLTESTOBJS+= ecp_fpt.o michael@0: endif michael@0: ECLTESTS = $(ECLTESTOBJS:.o=) michael@0: michael@0: $(ECLTESTOBJS): %.o: tests/%.c $(LIBHDRS) michael@0: $(CC) $(CFLAGS) -o $@ -c $< $(INCLUDES) michael@0: michael@0: $(ECLTESTS): %: %.o libecl.a michael@0: $(CC) $(CFLAGS) -o $@ $^ $(LIBS) michael@0: michael@0: ifeq ($(ECL_USE_FP),1) michael@0: tests: ec2_test ecp_test ec_naft ecp_fpt michael@0: else michael@0: tests: ec2_test ecp_test ec_naft michael@0: endif michael@0: michael@0: #--------------------------------------- michael@0: michael@0: ifeq ($(ECL_USE_FP),1) michael@0: test: tests michael@0: ./ecp_test michael@0: ./ec2_test michael@0: ./ec_naft michael@0: ./ecp_fpt michael@0: else michael@0: test: tests michael@0: ./ecp_test michael@0: ./ec_naft michael@0: ./ec2_test michael@0: endif michael@0: michael@0: #--------------------------------------- michael@0: michael@0: alltests: tests michael@0: michael@0: clean: michael@0: rm -f *.o *.a *.i michael@0: rm -f core michael@0: rm -f *~ .*~ michael@0: rm -f $(ECLTESTS) michael@0: michael@0: clobber: clean michael@0: michael@0: # END