2018-12-02 14:11:10 +00:00
|
|
|
# MAKEFILE for MS Windows (nmake + Windows SDK)
|
2003-03-13 02:11:11 +00:00
|
|
|
#
|
2019-05-24 10:10:07 +00:00
|
|
|
# BEWARE: variable OBJECTS is updated via helper.pl
|
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
|
2019-06-07 15:56:59 +00:00
|
|
|
LTM_CFLAGS = /nologo /I./ /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /D__STDC_WANT_SECURE_LIB__=1 /D_CRT_HAS_CXX17=0 /Wall /wd4146 /wd4127 /wd4710 /wd4711 /wd4820 /WX $(CFLAGS)
|
2018-12-02 14:11:10 +00:00
|
|
|
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)
|
2019-06-06 10:09:39 +00:00
|
|
|
OBJECTS=bn_cutoffs.obj bn_deprecated.obj bn_mp_2expt.obj bn_mp_abs.obj bn_mp_add.obj bn_mp_add_d.obj 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 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_decr.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 bn_mp_dr_setup.obj \
|
|
|
|
bn_mp_error_to_string.obj bn_mp_exch.obj bn_mp_export.obj bn_mp_expt_d.obj bn_mp_exptmod.obj bn_mp_exteuclid.obj \
|
|
|
|
bn_mp_fread.obj bn_mp_fwrite.obj bn_mp_gcd.obj bn_mp_get_double.obj bn_mp_get_i32.obj bn_mp_get_i64.obj \
|
|
|
|
bn_mp_get_mag32.obj bn_mp_get_mag64.obj bn_mp_grow.obj bn_mp_ilogb.obj bn_mp_import.obj bn_mp_incr.obj bn_mp_init.obj \
|
|
|
|
bn_mp_init_copy.obj bn_mp_init_i32.obj bn_mp_init_i64.obj bn_mp_init_multi.obj bn_mp_init_set.obj bn_mp_init_size.obj \
|
|
|
|
bn_mp_init_u32.obj bn_mp_init_u64.obj bn_mp_invmod.obj bn_mp_is_square.obj bn_mp_iseven.obj bn_mp_isodd.obj \
|
2019-05-25 04:42:01 +00:00
|
|
|
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 \
|
2019-05-20 08:41:06 +00:00
|
|
|
bn_mp_montgomery_calc_normalization.obj bn_mp_montgomery_reduce.obj bn_mp_montgomery_setup.obj bn_mp_mul.obj \
|
2019-05-25 04:42:01 +00:00
|
|
|
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_neg.obj bn_mp_or.obj \
|
|
|
|
bn_mp_prime_fermat.obj bn_mp_prime_frobenius_underwood.obj bn_mp_prime_is_prime.obj \
|
2019-05-22 13:34:49 +00:00
|
|
|
bn_mp_prime_miller_rabin.obj bn_mp_prime_next_prime.obj bn_mp_prime_rabin_miller_trials.obj \
|
|
|
|
bn_mp_prime_rand.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 \
|
2019-06-06 10:09:39 +00:00
|
|
|
bn_mp_set_double.obj bn_mp_set_i32.obj bn_mp_set_i64.obj bn_mp_set_u32.obj bn_mp_set_u64.obj bn_mp_shrink.obj \
|
|
|
|
bn_mp_signed_bin_size.obj bn_mp_signed_rsh.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_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_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_s_mp_add.obj bn_s_mp_balance_mul.obj \
|
|
|
|
bn_s_mp_exptmod.obj bn_s_mp_exptmod_fast.obj bn_s_mp_get_bit.obj bn_s_mp_invmod_fast.obj bn_s_mp_invmod_slow.obj \
|
|
|
|
bn_s_mp_karatsuba_mul.obj bn_s_mp_karatsuba_sqr.obj bn_s_mp_montgomery_reduce_fast.obj bn_s_mp_mul_digs.obj \
|
|
|
|
bn_s_mp_mul_digs_fast.obj bn_s_mp_mul_high_digs.obj bn_s_mp_mul_high_digs_fast.obj \
|
2019-05-22 13:34:49 +00:00
|
|
|
bn_s_mp_prime_is_divisible.obj bn_s_mp_rand_jenkins.obj bn_s_mp_rand_platform.obj bn_s_mp_reverse.obj \
|
2019-05-20 08:41:06 +00:00
|
|
|
bn_s_mp_sqr.obj bn_s_mp_sqr_fast.obj bn_s_mp_sub.obj bn_s_mp_toom_mul.obj bn_s_mp_toom_sqr.obj
|
2003-05-29 13:35:26 +00:00
|
|
|
|
2019-05-19 10:53:49 +00:00
|
|
|
HEADERS_PUB=tommath.h
|
|
|
|
HEADERS=tommath_private.h tommath_class.h tommath_superclass.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
|
|
|
|
2019-06-06 14:22:54 +00:00
|
|
|
#Create tommath.lib
|
2018-12-02 14:11:10 +00:00
|
|
|
$(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
|
|
|
|
2019-05-04 16:57:07 +00:00
|
|
|
tune: $(LIBMAIN_S)
|
|
|
|
$(MAKE) -C etc tune
|
|
|
|
$(MAKE)
|
|
|
|
|
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"
|