-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
135 lines (100 loc) · 5.19 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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
SHELL := /bin/bash
# Project-specific settings
PROJECT := conduit
EMP_DIR := third-party/Empirical/include/emp
# Flags to use regardless of compiler
CFLAGS_all := -pipe -Wall -Wno-unused-function -std=c++17 -Iinclude/ -fopenmp
# Native compiler information
CFLAGS_nat := -O3 -DNDEBUG -O3 -flto -march=native $(CFLAGS_all)
CFLAGS_nat_debug := -g $(CFLAGS_all)
UIT_MPICXX ?= mpicxx
UIT_MPIEXEC ?= mpiexec
# Emscripten compiler information
CXX_web := emcc
OFLAGS_web_all := -s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall', 'cwrap']" -s TOTAL_MEMORY=67108864 --js-library $(EMP_DIR)/web/library_emp.js -s EXPORTED_FUNCTIONS="['_main', '_empCppCallback', '_empDoCppCallback']" -s DISABLE_EXCEPTION_CATCHING=1 -s NO_EXIT_RUNTIME=1 #--embed-file configs
OFLAGS_web := -Oz -DNDEBUG
OFLAGS_web_debug := -g4 -Oz -Wno-dollar-in-identifier-extension
CFLAGS_web := $(CFLAGS_all) $(OFLAGS_web) $(OFLAGS_web_all)
CFLAGS_web_debug := $(CFLAGS_all) $(OFLAGS_web_debug) $(OFLAGS_web_all)
default: $(PROJECT)
native: $(PROJECT)
web: $(PROJECT).js documentation-coverage-badge.json version-badge.json doto-badge.json
omp: CFLAGS_nat := $(CFLAGS_nat) -fopenmp
omp: $(PROJECT)
debug: CFLAGS_nat := $(CFLAGS_nat_debug)
debug: $(PROJECT)
debug-web: CFLAGS_web := $(CFLAGS_web_debug)
debug-web: $(PROJECT).js
web-debug: debug-web
$(PROJECT): source/native/$(PROJECT).cpp
$(UIT_MPICXX) $(CFLAGS_nat) source/native/$(PROJECT).cpp -lstdc++fs -lbenchmark -lmetis -lpthread -o $(PROJECT)
@echo To build the web version use: make web
$(PROJECT).js: source/web/$(PROJECT)-web.cpp
source third-party/emsdk/emsdk_env.sh; \
$(CXX_web) $(CFLAGS_web) source/web/$(PROJECT)-web.cpp -o web/$(PROJECT).js
serve:
python3 -m http.server
install-coverage-dependencies:
git submodule init
git submodule update
$(MAKE) -C third-party/force-cover/
cov: install-coverage-dependencies
$(MAKE) cov -C tests/
documentation-coverage:
$(MAKE) coverage -C docs/
documentation-coverage-badge.json: documentation-coverage
python3 ci/parse_documentation_coverage.py docs/_build/doc-coverage.json > web/documentation-coverage-badge.json
version-badge.json:
python3 ci/parse_version.py .bumpversion.cfg > web/version-badge.json
doto-badge.json:
python3 ci/parse_dotos.py $$(./ci/grep_dotos.sh) > web/doto-badge.json
clean:
rm -f $(PROJECT) web/$(PROJECT).js web/*.js.map web/*.js.map *~ source/*.o web/*.wasm web/*.wast
rm -rf coverage_include
$(MAKE) clean -C docs/
$(MAKE) clean -C demos/
$(MAKE) clean -C macrobenchmarks/
$(MAKE) clean -C microbenchmarks/
$(MAKE) clean -C tests/
docs:
$(MAKE) html -C docs/
demos:
$(MAKE) -C demos/
macrobenchmark:
$(MAKE) bench -C macrobenchmarks/
microbenchmark:
$(MAKE) bench -C microbenchmarks/
benchmark: macrobenchmark microbenchmark
test-readme-snippets:
python3 ci/test_readme_snippets.py
test-source: debug debug-web
$(UIT_MPIEXEC) -n 1 ./conduit | grep -q '>>> end <<<' && echo 'matched!' || exit 1
npm install
echo "const puppeteer = require('puppeteer'); var express = require('express'); var app = express(); app.use(express.static('web')); app.listen(3000); express.static.mime.types['wasm'] = 'application/wasm'; function sleep(millis) { return new Promise(resolve => setTimeout(resolve, millis)); } async function run() { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('http://localhost:3000/conduit.html'); await sleep(1000); const html = await page.content(); console.log(html); browser.close(); process.exit(0); } run();" | node | tr -d '\n' | grep -q "Hello, browser!" && echo "matched!" || exit 1
echo "const puppeteer = require('puppeteer'); var express = require('express'); var app = express(); app.use(express.static('web')); app.listen(3000); express.static.mime.types['wasm'] = 'application/wasm'; function sleep(millis) { return new Promise(resolve => setTimeout(resolve, millis)); } async function run() { const browser = await puppeteer.launch(); const page = await browser.newPage(); page.on('console', msg => console.log(msg.text())); await page.goto('http://localhost:3000/conduit.html'); await sleep(1000); await page.content(); browser.close(); process.exit(0); } run();" | node | grep -q "Hello, console!" && echo "matched!"|| exit 1
test:
test $TRAVIS && mkdir -p "~/.openmpi/" && touch "~/.openmpi/mca-params.conf" && grep -qxF 'btl_base_warn_component_used = 0' ~/.openmpi/mca-params.conf || echo 'btl_base_warn_component_used = 0' >> ~/.openmpi/mca-params.conf
$(MAKE) -C tests/
test-opt:
test $TRAVIS && mkdir -p "~/.openmpi/" && touch "~/.openmpi/mca-params.conf" && grep -qxF 'btl_base_warn_component_used = 0' ~/.openmpi/mca-params.conf || echo 'btl_base_warn_component_used = 0' >> ~/.openmpi/mca-params.conf
$(MAKE) opt -C tests/
test-fulldebug:
test $TRAVIS && mkdir -p "~/.openmpi/" && touch "~/.openmpi/mca-params.conf" && grep -qxF 'btl_base_warn_component_used = 0' ~/.openmpi/mca-params.conf || echo 'btl_base_warn_component_used = 0' >> ~/.openmpi/mca-params.conf
$(MAKE) fulldebug -C tests/
test-all: test test-opt test-fulldebug
.PHONY: \
benchmark \
clean \
cov \
demos \
docs \
install-coverage-dependencies \
native \
macrobenchmark \
microbenchmark \
serve \
test \
tests \
web \
# Debugging information
print-%: ; @echo '$(subst ','\'',$*=$($*))'