-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.conf
91 lines (74 loc) · 2.84 KB
/
Makefile.conf
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
#==============================================================================
# Makefile config variables
#==============================================================================
# Project info
PROJECT_NAME := Improved ID-based Proxy Signature Scheme with Message Recovery
VERSION := 0.0.1
BINARY := IdSignature
# Project directories
INC_DIR := include
SRC_DIR := src
LIB_DIR := lib
TST_DIR := test
BEN_DIR := benchmark
OBJ_DIR := build
BIN_DIR := bin
# Lanuch the project with the debug configuration
USE_DEBUG := true
# Use the clang compiler
USE_CLANG := false
# Compiler options
CC := gcc
CFLAGS := -fdiagnostics-color=always -Wall -Wextra -Wno-unknown-pragmas -I$(INC_DIR)
CDEFINE := -DVERSION="\"$(VERSION)\"" -DPROJECT_NAME="\"$(PROJECT_NAME)\"" -DPBC_SUPPORT
LDLIBS := -lpbc -lgmp -lm -lnettle
# Dynamic library
DYN_BINARY := lib$(BINARY).so
# Dynamic library options
DYN_CFLAGS := $(CFLAGS) -fPIC
DYN_LDLIBS := $(LDLIBS)
DYN_CDEFINE := $(CDEFINE) -DDYNAMIC
# Dynamic library
STAT_BINARY := lib$(BINARY).a
# Static library options
STAT_CFLAGS := $(CFLAGS)
STAT_LDLIBS := $(LDLIBS)
STAT_CDEFINE := $(CDEFINE) -DSTATIC
# Entry point
ENTRY_FILE_NAME := $(BINARY).c
ENTRY_FILE := $(SRC_DIR)/$(ENTRY_FILE_NAME)
ENTRY_OBJECT := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(ENTRY_FILE))
# Header files
HEADER_FILES := $(wildcard $(INC_DIR)/*.h)
# Source files
SOURCE_FILES := $(filter-out $(ENTRY_FILE),$(wildcard $(SRC_DIR)/*.c))
SOURCE_OBJECTS := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SOURCE_FILES))
# Test
TEST_BINARY := $(BINARY)_test
TEST_ENTRY_FILE_NAME := test-main
TEST_ENTRY_FILE := $(TST_DIR)/$(TEST_ENTRY_FILE_NAME).c
TEST_ENTRY_OBJECT := $(patsubst $(TST_DIR)/%.c,$(OBJ_DIR)/%.o,$(TEST_ENTRY_FILE))
TEST_SOURCE_FILES := $(filter-out $(TEST_ENTRY_FILE),$(wildcard $(TST_DIR)/*.c))
TEST_SOURCE_OBJECTS := $(patsubst $(TST_DIR)/%.c,$(OBJ_DIR)/%.o,$(TEST_SOURCE_FILES))
# Test options
TEST_CFLAGS := $(CFLAGS) -I$(TST_DIR)
TEST_LDLIBS := $(LDLIBS) -lcheck
TEST_CDEFINE := $(CDEFINE) -DTEST
# Benchmark
BENCH_BINARY := $(BINARY)_bench
BENCH_ENTRY_FILE_NAME := bench-main
BENCH_ENTRY_FILE := $(BEN_DIR)/$(BENCH_ENTRY_FILE_NAME).c
BENCH_ENTRY_OBJECT := $(patsubst $(BEN_DIR)/%.c,$(OBJ_DIR)/%.o,$(BENCH_ENTRY_FILE))
BENCH_SOURCE_FILES := $(filter-out $(BENCH_ENTRY_FILE),$(wildcard $(BEN_DIR)/*.c)) $(wildcard $(LIB_DIR)/*.c)
BENCH_SOURCE_OBJECTS := $(patsubst $(LIB_DIR)/%.c,$(OBJ_DIR)/%.o,$(patsubst $(BEN_DIR)/%.c,$(OBJ_DIR)/%.o,$(BENCH_SOURCE_FILES)))
# Benchmark options
BENCH_CFLAGS := $(CFLAGS) -I$(BEN_DIR) -I$(LIB_DIR)
BENCH_LDLIBS := $(LDLIBS)
BENCH_CDEFINE := $(CDEFINE) -DBENCH
# Formatting constants
RED := $(shell tput setaf 1)
GREEN := $(shell tput setaf 2)
YELLOW := $(shell tput setaf 3)
BLUE := $(shell tput setaf 4)
BOLD := $(shell tput bold)
RESET := $(shell tput sgr0)