-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (26 loc) · 781 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
37
38
39
40
41
42
TARGET = mpi-kmeans
MPICC = mpicc
SRCDIR = src
OBJDIR = obj
BINDIR = bin
CFLAGS = -Wall -std=c90 -O2 -I./$(SRCDIR)
LDFLAGS = -lm
C_SOURCES = $(wildcard $(SRCDIR)/*.c)
C_OBJECTS = $(C_SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
.PHONY: all
all: remove $(BINDIR)/$(TARGET) clean
$(BINDIR)/$(TARGET): $(C_OBJECTS) $(BINDIR)
$(MPICC) $(C_OBJECTS) $(LDFLAGS) -o $@
windows: remove build_win clean
build_win: $(C_OBJECTS) $(BINDIR)
$(MPICC) $(C_OBJECTS) $(LDFLAGS) -o $(BINDIR)/$(TARGET).exe
$(C_OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c $(OBJDIR)
$(MPICC) $(CFLAGS) -c $< -o $@
$(OBJDIR):
mkdir -p $@
$(BINDIR):
mkdir -p $@
clean:
$(RM) -rf $(C_OBJECTS) $(OBJDIR)
remove:
$(RM) -rf $(C_OBJECTS) $(OBJDIR) $(BINDIR)