-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (70 loc) · 2.75 KB
/
Makefile
File metadata and controls
84 lines (70 loc) · 2.75 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
#
# **************************************************************
# * Simple C++ Makefile Template *
# * *
# * Author: Arash Partow (2003) *
# * URL: http://www.partow.net/programming/makefile/index.html *
# * *
# * Copyright notice: *
# * Free use of this C++ Makefile template is permitted under *
# * the guidelines and in accordance with the the MIT License *
# * http://www.opensource.org/licenses/MIT *
# * *
# **************************************************************
#
#
# Modifications of the original file are licenced under MIT Licence
#
#(c) Ludovic 'Archivist' Lagouardette 2018
#
CXX := -c++
CXXFLAGS := -pedantic-errors -Wall -Wextra -Werror -O3 -fPIC -std=c++17 \
# -DCOMPAT_TLS
# -DNO_TLS
# ^ Enable this flag if your compiler ABI have issues with thread local storage
LDFLAGS := -L/usr/lib -lstdc++ -lm -lpthread
BUILD := build
OBJ_DIR := $(BUILD)/objects
APP_DIR := $(BUILD)/apps
TARGET := tests.cpp
INCLUDE := -Iinclude/
SRC := \
src/FastRandom/memory_randomize.cpp \
src/FastRandom/uuid.cpp \
src/FastRandom/base_prng.cpp \
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
TEST_OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.test.o)
TARGETNAME := $(TARGET:%.cpp=%)
all: build $(TARGET)
$(OBJ_DIR)/%.test.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -fopenmp -DUSE_CATCH $(INCLUDE) -o $@ -c $<
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
$(APP_DIR)/$(TARGETNAME): $(TEST_OBJECTS) build
@mkdir -p $(@D)
$(CXX) -DUSE_CATCH -fopenmp $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/$(TARGETNAME) src/$(TARGET) $(TEST_OBJECTS)
lib: $(OBJECTS) build
$(CXX) $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) --shared -o $(APP_DIR)/libFastRandom.so $(OBJECTS)
ar rvs $(APP_DIR)/libFastRandom.a $(OBJECTS)
install: lib
cp $(APP_DIR)/libFastRandom.so /usr/local/lib
cp $(APP_DIR)/libFastRandom.a /usr/local/lib
cp include/FastRandom /usr/local/include/FastRandom -r
test:
$(CXX) -fopenmp $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/garbage_out $(SRC) src/garbage_out.cpp
sh ./diehard.sh
.PHONY: all build clean
ASTYLE_FLAGS= --style=stroustrup --align-reference=type --align-pointer=type --break-blocks \
--indent-namespaces --indent=tab --add-brackets
format:
astyle $(ASTYLE_FLAGS) include/FastRandom/*
astyle $(ASTYLE_FLAGS) src/FastRandom/*
build:
@mkdir -p $(APP_DIR)
@mkdir -p $(OBJ_DIR)
clean:
rm -rf build/*
rm -rf src/FastRandom/*.orig
rm -rf include/FastRandom/*.orig