This repository has been archived by the owner on Jun 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (47 loc) · 1.65 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
# Put the object filenames here
# (replace AUTOMATIC_OBJS with list of .o files if you don't want to compile
# all files in this directory into a single executable)
OBJS = $(AUTOMATIC_OBJS)
# Put the executable name here
TARGET = project3
# Put C preprocessor flags here
CPPFLAGS = -Iinclude
# C Compiler
CC = mpicc
# Put C compiler flags here (default debugging options, basic optimization)
CFLAGS=-g -O1
# C++ Compiler
CXX = mpic++
# Put C++ Compiler Flags here (default debugging options, basic optimization)
CXXFLAGS=-g -O0
# Put linker flags here (such as any libraries to link)
LIBRARIES = -lm
#############################################################################
# No need to change rules below this line
#############################################################################
# Find program files in this directory
AUTOMATIC_FILES = $(wildcard *.c *.cc *.C) src/main.cc
AUTOMATIC_OBJS = $(subst .c,.o,$(subst .cc,.o,$(subst .C,.o,$(AUTOMATIC_FILES)))) src/main.o
# Compile target program
$(TARGET): $(OBJS) src/main.o
$(CXX) -o $(TARGET) $(OBJS) $(LIBRARIES)
# rule for generating dependencies from source files
%.d: %.c
set -e; $(CC) -M $(CPPFLAGS) $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
%.d: %.C
set -e; $(CXX) -M $(CPPFLAGS) $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
%.d: %.cc
set -e; $(CXX) -M $(CPPFLAGS) $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
DEPEND_FILES=$(subst .o,.d,$(OBJS))
clean:
rm -f $(OBJS) $(TARGET)
distclean:
rm -f $(OBJS) $(TARGET) $(DEPEND_FILES)
#include automatically generated dependencies
include $(DEPEND_FILES)