blob: 65b01359f370945f86df448bc84b971d2e84e4b1 (
plain)
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
|
####
#
# ecgen, tool for generating Elliptic curve domain parameters
# Copyright (C) 2017 J08nY
#
####
CC ?= gcc
CFLAGS = -Wall
DEBUG ?= 0
TEST ?= 0
ifeq ($(DEBUG), 1)
CFLAGS += -DDEBUG -g -Werror -pedantic
else ifeq ($(TEST), 1)
CFLAGS += --coverage -g -O0
else
CFLAGS += -DNDEBUG -O3
endif
LDFLAGS = -L../lib/parson -L../lib/sha1 -L../lib/pari
INCLUDES = -I. -I../lib
LIBS = -lrt -lpari -lpthread -lparson -lsha1
####
ECGEN_SRC = ecgen.c $(wildcard */*.c)
ECGEN_OBJ = $(patsubst %.c,%.o, $(ECGEN_SRC))
ECONVERT_SRC = econvert.c
ECONVERT_OBJ = $(patsubst %.c,%.o, $(ECONVERT_SRC))
SRC = $(wildcard *.c) $(wildcard */*.c)
HDR = $(wildcard */*.h)
####
all: ecgen econvert
ecgen: ecgen.o $(ECGEN_OBJ)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LDFLAGS) $(LIBS)
mv ecgen ..
econvert: econvert.o $(ECONVERT_OBJ)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LDFLAGS) $(LIBS)
mv econvert ..
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
####
clean-all: clean clean-cov
rm -f ../ecgen
rm -f ../econvert
clean:
find . -type f -name '*.o' -exec rm {} +
clean-cov:
find . -type f -name '*.gcda' -exec rm {} +
find . -type f -name '*.gcno' -exec rm {} +
find . -type f -name '*.gcov' -exec rm {} +
format:
clang-format -i $(SRC)
clang-format -i $(HDR)
.PHONY: all clean-all clean format
|