-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
54 lines (46 loc) · 1.1 KB
/
Makefile
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
##
## SPDX-License-Identifier: MIT
## Copyright (c) 2019 Andriy Berestovskyy <berestovskyy@gmail.com>
##
# List of benchmarks
SUBDIRS += memory-latency
SUBDIRS += memory-loads
# Default directories
BUILDDIR ?= build
BENCHMARK ?= benchmark
# Default target
all: $(BENCHMARK) subdirs
.PHONY: all
# Compile Benchmark library
$(BENCHMARK):
@echo "==> $@"
mkdir -p $(BUILDDIR) \
&& cd $(BUILDDIR) \
&& cmake $(abspath $@) \
-DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_GTEST_TESTS=OFF \
&& make -j
.PHONY: $(BENCHMARK)
# Make subdirs
subdirs: $(SUBDIRS)
.PHONY: subdirs
$(SUBDIRS): $(BENCHMARK)
@echo "==> $@"
$(MAKE) -C $@ BENCHMARK=$(abspath $(BENCHMARK)) \
BUILDDIR=$(abspath $(BUILDDIR))
.PHONY: $(SUBDIRS)
# Clean target
clean: $(BENCHMARK)-clean subdirs-clean
.PHONY: clean
# Clean Benchmark library
$(BENCHMARK)-clean:
@echo "==> $@"
rm -rdf $(BUILDDIR)
.PHONY: $(BENCHMARK)-clean
# Clean subdirs
SUBDIRS_CLEAN = $(addsuffix .clean,$(SUBDIRS))
subdirs-clean: $(SUBDIRS_CLEAN)
.PHONY: subdirs-clean
$(SUBDIRS_CLEAN):
@echo "==> $(basename $@)"
$(MAKE) -C $(basename $@) clean
.PHONY: $(SUBDIRS_CLEAN)