-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (39 loc) · 1.11 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
CC := mpicc
CFLAG := -std=c99 -Wall -Wextra -O3 -DNDIMS=2
INC := -Iinclude -ISimpleDecomp/include -ISimpleNpyIO/include
LIB := -lfftw3 -lm
SRCDIR := src SimpleDecomp/src SimpleNpyIO/src
OBJDIR := obj
SRCS := $(shell find $(SRCDIR) -type f -name *.c)
OBJS := $(patsubst %.c,obj/%.o,$(SRCS))
DEPS := $(patsubst %.c,obj/%.d,$(SRCS))
OUTDIR := output
TARGET := a.out
help:
@echo "all : create \"$(TARGET)\""
@echo "clean : remove \"$(TARGET)\" and object files under \"$(OBJDIR)\""
@echo "output : create \"$(OUTDIR)\" to store output"
@echo "datadel : clean-up \"$(OUTDIR)\""
@echo "help : show this message"
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(CFLAG) -o $@ $^ $(LIB)
$(OBJDIR)/%.o: %.c
@if [ ! -e $(dir $@) ]; then \
mkdir -p $(dir $@); \
fi
$(CC) $(CFLAG) -MMD $(INC) -c $< -o $@
clean:
$(RM) -r $(OBJDIR) $(TARGET)
output:
@if [ ! -e $(OUTDIR)/save ]; then \
mkdir -p $(OUTDIR)/save; \
fi
@if [ ! -e $(OUTDIR)/log ]; then \
mkdir -p $(OUTDIR)/log; \
fi
datadel:
$(RM) -r $(OUTDIR)/save/*
$(RM) -r $(OUTDIR)/log/*
-include $(DEPS)
.PHONY : all clean output datadel help