2018-12-02 14:11:10 +00:00
|
|
|
# MAKEFILE for MS Windows (nmake + Windows SDK)
|
2003-03-13 02:11:11 +00:00
|
|
|
#
|
2018-12-02 14:11:10 +00:00
|
|
|
# BEWARE: variable OBJECTS is updated via ./updatemakes.sh
|
2003-03-13 02:11:11 +00:00
|
|
|
|
2018-12-02 14:11:10 +00:00
|
|
|
### USAGE:
|
|
|
|
# Open a command prompt with WinSDK variables set and start:
|
|
|
|
#
|
|
|
|
# nmake -f makefile.msvc all
|
|
|
|
# test.exe
|
|
|
|
# nmake -f makefile.msvc PREFIX=c:\devel\libtom install
|
|
|
|
|
|
|
|
#The following can be overridden from command line e.g. make -f makefile.msvc CC=gcc ARFLAGS=rcs
|
|
|
|
PREFIX = c:\devel
|
|
|
|
CFLAGS = /Ox
|
|
|
|
|
|
|
|
#Compilation flags
|
|
|
|
LTM_CFLAGS = /nologo /I./ /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /W3 $(CFLAGS)
|
|
|
|
LTM_LDFLAGS = advapi32.lib
|
2003-03-13 02:11:11 +00:00
|
|
|
|
2018-12-02 14:11:10 +00:00
|
|
|
#Libraries to be created (this makefile builds only static libraries)
|
|
|
|
LIBMAIN_S =tommath.lib
|
2003-03-13 02:11:11 +00:00
|
|
|
|
2018-12-02 14:11:10 +00:00
|
|
|
#List of objects to compile (all goes to tommath.lib)
|
2018-12-02 12:58:50 +00:00
|
|
|
OBJECTS=bn_error.obj bn_fast_mp_invmod.obj bn_fast_mp_montgomery_reduce.obj bn_fast_s_mp_mul_digs.obj \
|
2014-10-13 13:50:16 +00:00
|
|
|
bn_fast_s_mp_mul_high_digs.obj bn_fast_s_mp_sqr.obj bn_mp_2expt.obj bn_mp_abs.obj bn_mp_add.obj bn_mp_add_d.obj \
|
2014-10-18 16:56:56 +00:00
|
|
|
bn_mp_addmod.obj bn_mp_and.obj bn_mp_clamp.obj bn_mp_clear.obj bn_mp_clear_multi.obj bn_mp_cmp.obj bn_mp_cmp_d.obj \
|
2018-12-02 12:58:50 +00:00
|
|
|
bn_mp_cmp_mag.obj bn_mp_cnt_lsb.obj bn_mp_complement.obj bn_mp_copy.obj bn_mp_count_bits.obj bn_mp_div.obj \
|
|
|
|
bn_mp_div_2.obj bn_mp_div_2d.obj bn_mp_div_3.obj bn_mp_div_d.obj bn_mp_dr_is_modulus.obj bn_mp_dr_reduce.obj \
|
2018-09-10 16:49:10 +00:00
|
|
|
bn_mp_dr_setup.obj bn_mp_exch.obj bn_mp_export.obj bn_mp_expt_d.obj bn_mp_expt_d_ex.obj bn_mp_exptmod.obj \
|
2018-12-02 20:18:32 +00:00
|
|
|
bn_mp_exptmod_fast.obj bn_mp_exteuclid.obj bn_mp_fread.obj bn_mp_fwrite.obj bn_mp_gcd.obj bn_mp_get_bit.obj \
|
|
|
|
bn_mp_get_double.obj bn_mp_get_int.obj bn_mp_get_long.obj bn_mp_get_long_long.obj bn_mp_grow.obj bn_mp_import.obj \
|
|
|
|
bn_mp_init.obj bn_mp_init_copy.obj bn_mp_init_multi.obj bn_mp_init_set.obj bn_mp_init_set_int.obj bn_mp_init_size.obj \
|
2018-12-28 08:41:54 +00:00
|
|
|
bn_mp_invmod.obj bn_mp_invmod_slow.obj bn_mp_is_square.obj bn_mp_iseven.obj bn_mp_isodd.obj bn_mp_jacobi.obj \
|
|
|
|
bn_mp_karatsuba_mul.obj bn_mp_karatsuba_sqr.obj bn_mp_kronecker.obj bn_mp_lcm.obj bn_mp_lshd.obj bn_mp_mod.obj \
|
|
|
|
bn_mp_mod_2d.obj bn_mp_mod_d.obj bn_mp_montgomery_calc_normalization.obj bn_mp_montgomery_reduce.obj \
|
|
|
|
bn_mp_montgomery_setup.obj bn_mp_mul.obj bn_mp_mul_2.obj bn_mp_mul_2d.obj bn_mp_mul_d.obj bn_mp_mulmod.obj \
|
|
|
|
bn_mp_n_root.obj bn_mp_n_root_ex.obj bn_mp_neg.obj bn_mp_or.obj bn_mp_prime_fermat.obj \
|
|
|
|
bn_mp_prime_frobenius_underwood.obj bn_mp_prime_is_divisible.obj bn_mp_prime_is_prime.obj \
|
|
|
|
bn_mp_prime_miller_rabin.obj bn_mp_prime_next_prime.obj bn_mp_prime_rabin_miller_trials.obj \
|
|
|
|
bn_mp_prime_random_ex.obj bn_mp_prime_strong_lucas_selfridge.obj bn_mp_radix_size.obj bn_mp_radix_smap.obj \
|
|
|
|
bn_mp_rand.obj bn_mp_read_radix.obj bn_mp_read_signed_bin.obj bn_mp_read_unsigned_bin.obj bn_mp_reduce.obj \
|
|
|
|
bn_mp_reduce_2k.obj bn_mp_reduce_2k_l.obj bn_mp_reduce_2k_setup.obj bn_mp_reduce_2k_setup_l.obj \
|
|
|
|
bn_mp_reduce_is_2k.obj bn_mp_reduce_is_2k_l.obj bn_mp_reduce_setup.obj bn_mp_rshd.obj bn_mp_set.obj \
|
|
|
|
bn_mp_set_double.obj bn_mp_set_int.obj bn_mp_set_long.obj bn_mp_set_long_long.obj bn_mp_shrink.obj \
|
2018-12-02 20:18:32 +00:00
|
|
|
bn_mp_signed_bin_size.obj bn_mp_sqr.obj bn_mp_sqrmod.obj bn_mp_sqrt.obj bn_mp_sqrtmod_prime.obj bn_mp_sub.obj \
|
|
|
|
bn_mp_sub_d.obj bn_mp_submod.obj bn_mp_tc_and.obj bn_mp_tc_div_2d.obj bn_mp_tc_or.obj bn_mp_tc_xor.obj \
|
|
|
|
bn_mp_to_signed_bin.obj bn_mp_to_signed_bin_n.obj bn_mp_to_unsigned_bin.obj bn_mp_to_unsigned_bin_n.obj \
|
|
|
|
bn_mp_toom_mul.obj bn_mp_toom_sqr.obj bn_mp_toradix.obj bn_mp_toradix_n.obj bn_mp_unsigned_bin_size.obj bn_mp_xor.obj \
|
|
|
|
bn_mp_zero.obj bn_prime_tab.obj bn_reverse.obj bn_s_mp_add.obj bn_s_mp_exptmod.obj bn_s_mp_mul_digs.obj \
|
|
|
|
bn_s_mp_mul_high_digs.obj bn_s_mp_sqr.obj bn_s_mp_sub.obj bncore.obj
|
2003-05-29 13:35:26 +00:00
|
|
|
|
2018-12-02 14:11:10 +00:00
|
|
|
HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h
|
2014-10-13 13:49:23 +00:00
|
|
|
|
2018-12-02 14:11:10 +00:00
|
|
|
HEADERS=tommath_private.h $(HEADERS_PUB)
|
2005-08-01 16:37:28 +00:00
|
|
|
|
2018-12-02 14:11:10 +00:00
|
|
|
#The default rule for make builds the tommath.lib library (static)
|
|
|
|
default: $(LIBMAIN_S)
|
|
|
|
|
|
|
|
#Dependencies on *.h
|
|
|
|
$(OBJECTS): $(HEADERS)
|
2018-02-02 12:43:13 +00:00
|
|
|
|
|
|
|
.c.obj:
|
|
|
|
$(CC) $(LTM_CFLAGS) /c $< /Fo$@
|
2018-12-02 14:11:10 +00:00
|
|
|
|
|
|
|
#Create tomcrypt.lib
|
|
|
|
$(LIBMAIN_S): $(OBJECTS)
|
|
|
|
lib /out:$(LIBMAIN_S) $(OBJECTS)
|
|
|
|
|
2018-12-02 17:46:35 +00:00
|
|
|
#Build test_standalone suite
|
2019-03-04 00:02:22 +00:00
|
|
|
test.exe: $(LIBMAIN_S) demo/main.c demo/opponent.c demo/test.c
|
|
|
|
cl $(LTM_CFLAGS) $(TOBJECTS) $(LIBMAIN_S) $(LTM_LDFLAGS) demo/main.c demo/opponent.c demo/test.c /DLTM_DEMO_TEST_VS_MTEST=0 /Fe$@
|
2018-12-02 14:11:10 +00:00
|
|
|
@echo NOTICE: start the tests by launching test.exe
|
|
|
|
|
2018-12-02 17:46:35 +00:00
|
|
|
test_standalone: test.exe
|
2018-12-02 14:11:10 +00:00
|
|
|
|
2018-12-02 17:46:35 +00:00
|
|
|
all: $(LIBMAIN_S) test_standalone
|
2018-12-02 14:11:10 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
@-cmd /c del /Q /S *.OBJ *.LIB *.EXE *.DLL 2>nul
|
|
|
|
|
|
|
|
#Install the library + headers
|
|
|
|
install: $(LIBMAIN_S)
|
|
|
|
cmd /c if not exist "$(PREFIX)\bin" mkdir "$(PREFIX)\bin"
|
|
|
|
cmd /c if not exist "$(PREFIX)\lib" mkdir "$(PREFIX)\lib"
|
|
|
|
cmd /c if not exist "$(PREFIX)\include" mkdir "$(PREFIX)\include"
|
|
|
|
copy /Y $(LIBMAIN_S) "$(PREFIX)\lib"
|
|
|
|
copy /Y tommath*.h "$(PREFIX)\include"
|
|
|
|
|
|
|
|
# ref: $Format:%D$
|
|
|
|
# git commit: $Format:%H$
|
|
|
|
# commit time: $Format:%ai$
|