-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (74 loc) · 2.56 KB
/
Makefile
File metadata and controls
107 lines (74 loc) · 2.56 KB
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
##############################################
# Table of Contents #
# 1: Basic Flags in the compile and linking #
# 2: where to put and to find files? #
# 3: Compiling and Linking #
##############################################
# Part 1: Basic Flags in the compile and linking
##############################################
# Table of Contents #
# 1: Basic Flags in the compile and linking #
# 2: where to put and to find files? #
# 3: Compiling and Linking #
##############################################
# Part 1: Basic Flags in the compile and linking
CC = mpiicc
#MPI_INCLUDE := $(shell mpicc -showme:compile)
#MPI_LINK := $(shell mpicc -showme:link)
#INCLUDE = -Iinclude $(MPI_INCLUDE)
#LDLIBS = $(MPI_LINK) -lm -L./lib/sha256_intel_avx/ -lsha256_avx
INCLUDE = -Iinclude
LDLIBS = -lm -L./lib/sha256_intel_avx/ -lsha256_avx
LDFLAGS = -march=native -fno-strict-aliasing -O3 -flto -qopenmp -pthread
CFLAGS = -march=native -fno-strict-aliasing -O3 -flto -qopenmp -Wall
#CFLAGS += -DVERBOSE_LEVEL=2
# Part 2: where to put and to find files?
# store *.o files in obj/
OBJDIR = obj
# all source files can be found in these folders
SRC = src
SRC_UTIL = $(SRC)/util
#SRC_SHA256 = $(SRC)/sha256
## extract all *.c filenames from the directories
FILENAMES = $(wildcard $(SRC)/*.c)
FILENAMES += $(wildcard $(SRC_UTIL)/*.c)
# Substitution References: replaces all *.c with *.o
# note that it will keep the directory structure
OBJECTS := $(FILENAMES:$(SRC)/%.c=$(OBJDIR)/%.o)
# Part 3: Compiling and Linking
lib:
cd lib/sha256_intel_avx && make clean && make all
# BUILD OBJECT FILES IN OBJECTDIR directory
$(OBJDIR)/%.o: $(SRC)/%.c
mkdir -p '$(@D)'
$(CC) -c $< $(INCLUDE) $(CFLAGS) -o $@
TARGETS = phase_ii
# REMOVE TARGETS FROM $(OBJECTS)
TARGET_OBJECTS = $(addprefix $(OBJDIR)/, $(addsuffix .o, $(TARGETS)) )
COMMON_OBJECTS = $(filter-out $(TARGET_OBJECTS), $(OBJECTS) )
$(info common objects = $(COMMON_OBJECTS))
all: $(TARGETS) lib
mkdir -p obj
mkdir -p data
mkdir -p data/digests
mkdir -p data/messages
mkdir -p data/digests
mkdir -p data/messages
mkdir -p data/stats
mkdir -p data/verify
# we wish to build X:
# 1- remove all $(TARGETS) members from dependencies
# 2- add X.o as a dependency
phase_ii: $(OBJDIR)/phase_ii.o $(COMMON_OBJECTS)
$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
.PHONY: clean
clean:
rm -f $(OBJECTS)
rm -f $(TARGETS)
purge:
rm -f $(OBJECTS)
rm -f $(TARGETS)
rm -rf data/digests
rm -rf data/messages
rm -rf data/stats
rm -rf data/verify