diff options
| author | J08nY | 2017-04-05 12:46:14 +0200 |
|---|---|---|
| committer | J08nY | 2017-04-05 12:46:14 +0200 |
| commit | 2bcb800524eff712bf9c0789be90a5798e322b6d (patch) | |
| tree | 6eaaada90da519154a6ffa55846b52051625381a | |
| parent | f25a2b7bfed27160173ae62e8552f27e8c59ee58 (diff) | |
| download | ecgen-2bcb800524eff712bf9c0789be90a5798e322b6d.tar.gz ecgen-2bcb800524eff712bf9c0789be90a5798e322b6d.tar.zst ecgen-2bcb800524eff712bf9c0789be90a5798e322b6d.zip | |
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | CMakeLists.txt | 24 | ||||
| -rw-r--r-- | src/Makefile | 38 | ||||
| -rw-r--r-- | src/econvert.c | 2 | ||||
| -rw-r--r-- | src/gp.c | 8 | ||||
| -rw-r--r-- | src/gp.h | 14 | ||||
| -rw-r--r-- | src/gp/gp.gp | 4 |
7 files changed, 24 insertions, 67 deletions
@@ -3,6 +3,7 @@ data/ gen/ doc/ ecgen +econvert ### C template # Prerequisites diff --git a/CMakeLists.txt b/CMakeLists.txt index 3156c0d..64b661c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,27 +2,21 @@ cmake_minimum_required(VERSION 2.8.11) project(ecgen) set(CMAKE_LIBRARY_PATH ${CMAKE_SOURCE_DIR}/lib) - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -Wall -Werror -pedantic") SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -Wall") -add_custom_command( - OUTPUT gp.c gp.h - COMMAND gp2c -g -i4 gp/gp.gp | clang-format | awk "BEGIN{print \"#ifndef GP_H\" > \"gp.h\"; print \"#define GP_H\" >> \"gp.h\";} { if\(found\) print >> \"gp.c\"; else print >> \"gp.h\"} /End of prototype/{found=1; print \"\#include \\\"gp.h\\\"\" > \"gp.c\"; print \"#endif //GP_H\" >> \"gp.h\"}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src" - COMMENT "gp2c gp.gp" - VERBATIM -) - -add_custom_target(gp2c ALL DEPENDS gp.c gp.h) - include_directories(src) include_directories(lib) -file(GLOB ECGEN_SRC "src/ecgen.c" "src/math/*.c" "src/cm/*.c" "src/invalid/*.c" "src/io/*.c" "src/exhaustive/*.c" ) +find_library(parson parson/libparson.a) +find_library(sha1 sha1/libsha1.a) -add_executable(ecgen ${ECGEN_SRC}) +file(GLOB SRC "src/math/*.c" "src/cm/*.c" "src/invalid/*.c" "src/io/*.c" "src/exhaustive/*.c") +set(ECGEN_SRC "src/ecgen.c" ${SRC}) +set(ECONVERT_SRC "src/econvert.c" ${SRC}) -find_library(parson parson/libparson.a) +add_executable(ecgen ${ECGEN_SRC}) +add_executable(econvert ${ECONVERT_SRC}) -target_link_libraries(ecgen pari rt ${parson})
\ No newline at end of file +target_link_libraries(ecgen pari rt ${parson} ${sha1}) +target_link_libraries(econvert pari rt ${parson} ${sha1})
\ No newline at end of file diff --git a/src/Makefile b/src/Makefile index 3d51fbf..be6bdb9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,14 +6,10 @@ #### CC ?= gcc -GP2C = gp2c CFLAGS = -O3 -Wall LDFLAGS = -L../lib/parson -L../lib/sha1 -GP_CFLAGS = -O3 -Wall -fomit-frame-pointer -fno-strict-aliasing -fPIC -GPFLAGS = -g -i4 - INCLUDES = -I. -I../lib LIBS = -lrt -lpari -lparson @@ -21,45 +17,37 @@ LIBS = -lrt -lpari -lparson VPATH = cm:invalid:io:exhaustive:math -GP = -GPC = $(addsuffix .c, $(GP)) -GPO = $(addsuffix .o, $(GP)) -GPH = $(addsuffix .h, $(GP)) +ECGEN_SRC = ecgen.c $(wildcard */*.c) +ECGEN_OBJ = $(patsubst %.c,%.o, $(ECGEN_SRC)) + +ECONVERT_SRC = econvert.c $(wildcard */*.c) +ECONVERT_OBJ = $(patsubst %.c,%.o, $(ECONVERT_SRC)) -SRC = ecgen.c $(wildcard */*.c) -OBJ = $(patsubst %.c,%.o, $(SRC)) -HDR = $(wildcard *.h) $(wildcard */*.h) +SRC = $(ECGEN_SRC) $(ECONVERT_SRC) +HDR = $(wildcard */*.h) #### all: ecgen -ecgen: ecgen.o $(GPO) $(OBJ) +ecgen: ecgen.o $(ECGEN_OBJ) $(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LDFLAGS) $(LIBS) mv ecgen .. -gp2c: $(GPC) $(GPH) - -$(GPO): $(GPC) $(GPH) - $(CC) $(GP_CFLAGS) $(INCLUDES) -c -o $@ $< $(LDFLAGS) $(LIBS) +econvert: econvert.o $(ECONVERT_OBJ) + $(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LDFLAGS) $(LIBS) + mv econvert .. -%.o: %.c $(GPH) +%.o: %.c $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -%.h %.c: %.gp - $(GP2C) $(GPFLAGS) gp/$*.gp 2>/dev/null | clang-format | awk 'BEGIN{print "#ifndef GP_H" > "gp.h"; print "#define GP_H" >> "gp.h";} { if(found) print >> "gp.c"; else print >> "gp.h"} /End of prototype/{found=1; print "#include \"gp.h\"" > "gp.c"; print "#endif //GP_H" >> "gp.h"}' - #### -clean-all: clean clean-gp +clean-all: clean clean: find . -type f -name '*.o' -exec rm {} + -clean-gp: - rm -f $(GPH) - rm -f $(GPC) - format: clang-format -i $(SRC) clang-format -i $(HDR) diff --git a/src/econvert.c b/src/econvert.c index 6c53887..b9b9af5 100644 --- a/src/econvert.c +++ b/src/econvert.c @@ -24,4 +24,4 @@ * @copyright GPL v2.0 */ -int main(void) {} +int main(void) { return 0; } diff --git a/src/gp.c b/src/gp.c deleted file mode 100644 index 59cb11a..0000000 --- a/src/gp.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "gp.h" - -void init_gp(void) /* void */ -{ - pari_sp ltop = avma; - avma = ltop; - return; -} diff --git a/src/gp.h b/src/gp.h deleted file mode 100644 index 27e4726..0000000 --- a/src/gp.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef GP_H -#define GP_H -/*-*- compile-command: "cc -c -o gp/gp.gp.o -g -O3 -Wall -fomit-frame-pointer - * -fno-strict-aliasing -fPIC -I"/usr/include/x86_64-linux-gnu" gp/gp.gp.c && cc - * -o gp/gp.gp.so -shared -g -O3 -Wall -fomit-frame-pointer -fno-strict-aliasing - * -fPIC -Wl,-shared -Wl,-z,relro gp/gp.gp.o -lc -lm -L/usr/lib/x86_64-linux-gnu - * -lpari"; -*-*/ -#include <pari/pari.h> -/* -GP;install("init_gp","v","init_gp","./gp/gp.gp.so"); -*/ -void init_gp(void); -/*End of prototype*/ -#endif // GP_H diff --git a/src/gp/gp.gp b/src/gp/gp.gp deleted file mode 100644 index 7fa5fd0..0000000 --- a/src/gp/gp.gp +++ /dev/null @@ -1,4 +0,0 @@ -/* - * ecgen, tool for generating Elliptic curve domain parameters - * Copyright (C) 2017 J08nY - */ |
