From 21859c08a3af907425256bdc5e92d40ecf3a0d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Tue, 1 Aug 2000 23:53:22 +0200 Subject: [PATCH] Improved support for cross-compilation. Rev: src/modules/Gmp/Makefile.in:1.12 Rev: src/modules/Gmp/prime_table.pike:1.1 --- .gitattributes | 1 + src/modules/Gmp/Makefile.in | 9 +++++--- src/modules/Gmp/prime_table.pike | 39 ++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100755 src/modules/Gmp/prime_table.pike diff --git a/.gitattributes b/.gitattributes index 8a79a980a3..e66cd7bfbe 100644 --- a/.gitattributes +++ b/.gitattributes @@ -220,6 +220,7 @@ testfont binary /src/modules/Gmp/my_mpz_xor.c foreign_ident /src/modules/Gmp/next_prime.c foreign_ident /src/modules/Gmp/prime_table.c foreign_ident +/src/modules/Gmp/prime_table.pike foreign_ident /src/modules/Gmp/testsuite.in foreign_ident /src/modules/Gz/Makefile.in foreign_ident /src/modules/Gz/acconfig.h foreign_ident diff --git a/src/modules/Gmp/Makefile.in b/src/modules/Gmp/Makefile.in index 5336b65185..761fee43d8 100644 --- a/src/modules/Gmp/Makefile.in +++ b/src/modules/Gmp/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.11 1999/11/18 07:58:54 hubbe Exp $ +# $Id: Makefile.in,v 1.12 2000/08/01 21:53:22 grubba Exp $ @make_variables@ VPATH=@srcdir@:@srcdir@/../..:../.. MODULE_LDFLAGS=@LDFLAGS@ @LIBS@ @@ -12,12 +12,15 @@ CONFIG_HEADERS=@CONFIG_HEADERS@ next_prime.o: prime_table.out -prime_table.out: prime_table - ./prime_table $(PRIME_LIMIT) >prime_table.out +prime_table.out: prime_table@CROSS@ + ./prime_table@CROSS@ $(PRIME_LIMIT) >prime_table.out prime_table: $(SRCDIR)/prime_table.c $(CC) $(CFLAGS) $(SRCDIR)/prime_table.c -o prime_table +prime_table.pike: $(SRCDIR)/prime_table.pike + test -f prime_table.pike || ln -s $(SRCDIR)/prime_table.pike + depend: prime_table.out @dependencies@ diff --git a/src/modules/Gmp/prime_table.pike b/src/modules/Gmp/prime_table.pike new file mode 100755 index 0000000000..c745a7072a --- /dev/null +++ b/src/modules/Gmp/prime_table.pike @@ -0,0 +1,39 @@ +#!/usr/local/bin/pike +#pragma strict_types +/* $Id: prime_table.pike,v 1.1 2000/08/01 21:53:22 grubba Exp $ + * + * Generates a table of primes. + * Used when cross-compiling. + * + * Henrik Grubbstr�m 2000-08-01 + */ +int main(int argc, array(string) argv) +{ + if (argc != 2) { + werror("Bad number of arguments!\n"); + exit(1); + } + int count = (int)argv[1]; + write(sprintf("/* Automatically generated by\n" + " * $Id: prime_table.pike,v 1.1 2000/08/01 21:53:22 grubba Exp $\n" + " *%{ %s%}\n" + " * Do not edit.\n" + " */\n" + "\n" + "#define NUMBER_OF_PRIMES %d\n" + "\n" + "const unsigned long primes[NUMBER_OF_PRIMES] = {", + argv, count)); + int prime = 1; + for (int i=0; i < count; i++) { + prime = (prime+1)->next_prime(); + if (!(i%10)) { + write(sprintf("\n %d,", prime)); + } else { + write(sprintf(" %d,", prime)); + } + } + write("\n};\n" + "\n"); + return 0; +} -- GitLab