helper.pl: add support to update sources.cmake
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
diff --git a/helper.pl b/helper.pl
index 20b0dc9..ac87556 100755
--- a/helper.pl
+++ b/helper.pl
@@ -221,6 +221,16 @@ sub patch_file {
return $content;
}
+sub make_sources_cmake {
+ my @list = @_;
+ my $output = "set(SOURCES\n";
+ foreach my $obj (sort @list) {
+ $output .= $obj . "\n";
+ }
+ $output .= ")\n\nset(HEADERS\ntommath.h\n)\n";
+ return $output;
+}
+
sub process_makefiles {
my $write = shift;
my $changed_count = 0;
@@ -244,10 +254,12 @@ sub process_makefiles {
}
# update OBJECTS + HEADERS in makefile*
- for my $m (qw/ makefile makefile.shared makefile_include.mk makefile.msvc makefile.unix makefile.mingw /) {
+ for my $m (qw/ makefile makefile.shared makefile_include.mk makefile.msvc makefile.unix makefile.mingw sources.cmake /) {
my $old = read_file($m);
my $new = $m eq 'makefile.msvc' ? patch_file($old, $var_obj)
- : patch_file($old, $var_o);
+ : $m eq 'sources.cmake' ? make_sources_cmake(bsd_glob("*.c"))
+ : patch_file($old, $var_o);
+
if ($old ne $new) {
write_file($m, $new) if $write;
warn "changed: $m\n";
diff --git a/sources.cmake b/sources.cmake
index 503a13c..fd353c0 100644
--- a/sources.cmake
+++ b/sources.cmake
@@ -16,18 +16,17 @@ mp_complement.c
mp_copy.c
mp_count_bits.c
mp_cutoffs.c
+mp_div.c
mp_div_2.c
mp_div_2d.c
-mp_div_3.c
-mp_div.c
mp_div_d.c
mp_dr_is_modulus.c
mp_dr_reduce.c
mp_dr_setup.c
mp_error_to_string.c
mp_exch.c
+mp_expt_n.c
mp_exptmod.c
-mp_expt_u32.c
mp_exteuclid.c
mp_fread.c
mp_from_sbin.c
@@ -38,39 +37,35 @@ mp_get_double.c
mp_get_i32.c
mp_get_i64.c
mp_get_l.c
-mp_get_ll.c
mp_get_mag_u32.c
mp_get_mag_u64.c
mp_get_mag_ul.c
-mp_get_mag_ull.c
mp_grow.c
mp_init.c
mp_init_copy.c
mp_init_i32.c
mp_init_i64.c
mp_init_l.c
-mp_init_ll.c
mp_init_multi.c
mp_init_set.c
mp_init_size.c
mp_init_u32.c
mp_init_u64.c
mp_init_ul.c
-mp_init_ull.c
mp_invmod.c
mp_is_square.c
mp_kronecker.c
mp_lcm.c
-mp_log_u32.c
+mp_log_n.c
mp_lshd.c
-mp_mod_2d.c
mp_mod.c
+mp_mod_2d.c
mp_montgomery_calc_normalization.c
mp_montgomery_reduce.c
mp_montgomery_setup.c
+mp_mul.c
mp_mul_2.c
mp_mul_2d.c
-mp_mul.c
mp_mul_d.c
mp_mulmod.c
mp_neg.c
@@ -86,17 +81,18 @@ mp_prime_rabin_miller_trials.c
mp_prime_rand.c
mp_prime_strong_lucas_selfridge.c
mp_radix_size.c
+mp_radix_size_overestimate.c
mp_rand.c
mp_read_radix.c
+mp_reduce.c
mp_reduce_2k.c
mp_reduce_2k_l.c
mp_reduce_2k_setup.c
mp_reduce_2k_setup_l.c
-mp_reduce.c
mp_reduce_is_2k.c
mp_reduce_is_2k_l.c
mp_reduce_setup.c
-mp_root_u32.c
+mp_root_n.c
mp_rshd.c
mp_sbin_size.c
mp_set.c
@@ -104,14 +100,11 @@ mp_set_double.c
mp_set_i32.c
mp_set_i64.c
mp_set_l.c
-mp_set_ll.c
mp_set_u32.c
mp_set_u64.c
mp_set_ul.c
-mp_set_ull.c
mp_shrink.c
mp_signed_rsh.c
-mp_sqr.c
mp_sqrmod.c
mp_sqrt.c
mp_sqrtmod_prime.c
@@ -127,6 +120,7 @@ mp_xor.c
mp_zero.c
s_mp_add.c
s_mp_copy_digs.c
+s_mp_div_3.c
s_mp_div_recursive.c
s_mp_div_school.c
s_mp_div_small.c
@@ -136,11 +130,11 @@ s_mp_get_bit.c
s_mp_invmod.c
s_mp_invmod_odd.c
s_mp_log.c
+s_mp_log_2expt.c
s_mp_log_d.c
-s_mp_log_pow2.c
s_mp_montgomery_reduce_comba.c
-s_mp_mul_balance.c
s_mp_mul.c
+s_mp_mul_balance.c
s_mp_mul_comba.c
s_mp_mul_high.c
s_mp_mul_high_comba.c
@@ -149,6 +143,7 @@ s_mp_mul_toom.c
s_mp_prime_is_divisible.c
s_mp_prime_tab.c
s_mp_radix_map.c
+s_mp_radix_size_overestimate.c
s_mp_rand_jenkins.c
s_mp_rand_platform.c
s_mp_sqr.c