@@ -1,25 +1,30 @@
|
|
1 |
-
CC=
|
2 |
-
CXX=
|
3 |
-
FLAGS=-g -Wall -Wextra
|
4 |
CFLAGS=$(FLAGS) -std=gnu11
|
5 |
CXXFLAGS=$(FLAGS) -std=gnu++11
|
6 |
LIBS=
|
7 |
|
8 |
HEADERS=$(wildcard *.h)
|
9 |
SOURCES=$(wildcard *.c*)
|
10 |
COBJECTS=$(SOURCES:.c=.o)
|
11 |
OBJECTS=$(SOURCES:.cpp=.o)
|
12 |
EXECUTABLE=$(shell basename `pwd`)
|
13 |
|
14 |
$(EXECUTABLE): $(OBJECTS)
|
15 |
$(CXX) -o $@ $^ $(CFLAGS) $(LIBS)
|
16 |
|
17 |
%.o: %.cpp $(HEADERS)
|
18 |
$(CXX) -c $< -o $@ $(CXXFLAGS)
|
19 |
|
20 |
%.o: %.c $(HEADERS)
|
21 |
$(CC) -c -o $@ $< $(CFLAGS)
|
22 |
|
|
|
|
|
|
|
|
|
|
|
23 |
.PHONY: clean
|
24 |
clean:
|
25 |
rm -rf $(EXECUTABLE) *.o *.dSYM *~
|
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 |
|
8 |
HEADERS=$(wildcard *.h)
|
9 |
SOURCES=$(wildcard *.c*)
|
10 |
COBJECTS=$(SOURCES:.c=.o)
|
11 |
OBJECTS=$(SOURCES:.cpp=.o)
|
12 |
EXECUTABLE=$(shell basename `pwd`)
|
13 |
|
14 |
$(EXECUTABLE): $(OBJECTS)
|
15 |
$(CXX) -o $@ $^ $(CFLAGS) $(LIBS)
|
16 |
|
17 |
%.o: %.cpp $(HEADERS)
|
18 |
$(CXX) -c $< -o $@ $(CXXFLAGS)
|
19 |
|
20 |
%.o: %.c $(HEADERS)
|
21 |
$(CC) -c -o $@ $< $(CFLAGS)
|
22 |
|
23 |
+
|
24 |
+
.PHONY: gitignore
|
25 |
+
gitignore:
|
26 |
+
echo $(EXECUTABLE) > .gitignore
|
27 |
+
|
28 |
.PHONY: clean
|
29 |
clean:
|
30 |
rm -rf $(EXECUTABLE) *.o *.dSYM *~
|