-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
36 lines (26 loc) · 788 Bytes
/
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
CC = gcc
MPI = mpicc
CFLAGS = -I./include
SRCDIR = utils/src
INCDIR = utils/headers
SRCS = $(wildcard $(SRCDIR)/*.c)
OBJS = $(SRCS:$(SRCDIR)/%.c=%.o)
SEQ_OBJS = sequential_test.o $(OBJS)
PAR_OBJS = parallel_test.o $(OBJS)
DEPS = $(wildcard $(INCDIR)/*.h)
TARGET_SEQ = test/test_seq
TARGET_PAR = test/test_par
.PHONY: all clean
all: $(TARGET_SEQ) $(TARGET_PAR) clean
$(TARGET_SEQ): $(SEQ_OBJS)
$(CC) $(SEQ_OBJS) -o $(TARGET_SEQ) -O3 -lm
$(TARGET_PAR): $(PAR_OBJS)
$(MPI) $(PAR_OBJS) -o $(TARGET_PAR) -O3 -lm
sequential_test.o: sequential_test.c
$(CC) -c sequential_test.c -o sequential_test.o
parallel_test.o: parallel_test.c
$(MPI) $(CFLAGS) -c parallel_test.c -o parallel_test.o
%.o: $(SRCDIR)/%.c $(DEPS)
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f $(SEQ_OBJS) $(PAR_OBJS)