@@ -1,52 +1,52 @@
|
|
1 |
-
CC=
|
2 |
-
CXX=
|
3 |
-
FLAGS=-g -Wall -Wextra
|
4 |
CFLAGS=$(FLAGS) -std=gnu11
|
5 |
CXXFLAGS=$(FLAGS) -std=gnu++11
|
6 |
LIBS=
|
7 |
LINTFILTERS=$\
|
8 |
-readability/casting,$\
|
9 |
-build/header_guard,$\
|
10 |
-build/include_subdir
|
11 |
|
12 |
APPNAME=$(shell basename $(shell pwd))
|
13 |
APPARGS=
|
14 |
HEADERS=$(wildcard *.h)
|
15 |
SOURCES=$(wildcard *.c *.cpp)
|
16 |
OBJECTS=$(SOURCES:%.cpp=build/%.o)
|
17 |
|
18 |
bin/$(APPNAME): $(OBJECTS) | bin/.
|
19 |
$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS)
|
20 |
|
21 |
build/%.o: %.c $(HEADERS) | build/.
|
22 |
$(CC) -c $(CFLAGS) $< -o $@ $(LIBS)
|
23 |
|
24 |
build/%.o: %.cpp $(HEADERS) | build/.
|
25 |
$(CXX) -c $(CXXFLAGS) $< -o $@ $(LIBS)
|
26 |
|
27 |
.PRECIOUS: %/.
|
28 |
%/.:
|
29 |
mkdir -p $(dir $@)
|
30 |
|
31 |
all: bin/$(APPNAME) lint memcheck helgrind
|
32 |
|
33 |
.PHONY: lint
|
34 |
lint:
|
35 |
cpplint --filter=$(LINTFILTERS) $(HEADERS) $(SOURCES)
|
36 |
|
37 |
.PHONY: memcheck
|
38 |
memcheck:
|
39 |
valgrind --tool=memcheck bin/$(APPNAME) $(APPARGS)
|
40 |
|
41 |
.PHONY: helgrind
|
42 |
helgrind:
|
43 |
valgrind --quiet --tool=helgrind bin/$(APPNAME) $(APPARGS)
|
44 |
|
45 |
.PHONY: gitignore
|
46 |
gitignore:
|
47 |
echo bin > .gitignore
|
48 |
echo build >> .gitignore
|
49 |
|
50 |
.PHONY: clean
|
51 |
clean:
|
52 |
rm -rf bin build
|
1 |
+
CC=mpicc
|
2 |
+
CXX=mpic++
|
3 |
+
FLAGS=-g -Wall -Wextra
|
4 |
CFLAGS=$(FLAGS) -std=gnu11
|
5 |
CXXFLAGS=$(FLAGS) -std=gnu++11
|
6 |
LIBS=
|
7 |
LINTFILTERS=$\
|
8 |
-readability/casting,$\
|
9 |
-build/header_guard,$\
|
10 |
-build/include_subdir
|
11 |
|
12 |
APPNAME=$(shell basename $(shell pwd))
|
13 |
APPARGS=
|
14 |
HEADERS=$(wildcard *.h)
|
15 |
SOURCES=$(wildcard *.c *.cpp)
|
16 |
OBJECTS=$(SOURCES:%.cpp=build/%.o)
|
17 |
|
18 |
bin/$(APPNAME): $(OBJECTS) | bin/.
|
19 |
$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS)
|
20 |
|
21 |
build/%.o: %.c $(HEADERS) | build/.
|
22 |
$(CC) -c $(CFLAGS) $< -o $@ $(LIBS)
|
23 |
|
24 |
build/%.o: %.cpp $(HEADERS) | build/.
|
25 |
$(CXX) -c $(CXXFLAGS) $< -o $@ $(LIBS)
|
26 |
|
27 |
.PRECIOUS: %/.
|
28 |
%/.:
|
29 |
mkdir -p $(dir $@)
|
30 |
|
31 |
all: bin/$(APPNAME) lint memcheck helgrind
|
32 |
|
33 |
.PHONY: lint
|
34 |
lint:
|
35 |
cpplint --filter=$(LINTFILTERS) $(HEADERS) $(SOURCES)
|
36 |
|
37 |
.PHONY: memcheck
|
38 |
memcheck:
|
39 |
valgrind --tool=memcheck bin/$(APPNAME) $(APPARGS)
|
40 |
|
41 |
.PHONY: helgrind
|
42 |
helgrind:
|
43 |
valgrind --quiet --tool=helgrind bin/$(APPNAME) $(APPARGS)
|
44 |
|
45 |
.PHONY: gitignore
|
46 |
gitignore:
|
47 |
echo bin > .gitignore
|
48 |
echo build >> .gitignore
|
49 |
|
50 |
.PHONY: clean
|
51 |
clean:
|
52 |
rm -rf bin build
|