-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
70 lines (52 loc) · 1.51 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
62
63
64
65
66
67
68
69
70
vpath %.cc $(HOME)/fftw++
IDIR =$(HOME)/fftw++
# GNU compiler
ifeq ($(shell $(CXX) -v 2>&1 | tail -n 1 | head -c 3),gcc)
CXXFLAGS=-O3 -fopenmp -g -Wall -ansi -DNDEBUG -fomit-frame-pointer \
-fstrict-aliasing -ffast-math -msse2 -mfpmath=sse -march=native
#For valgrind:
#CXXFLAGS=-fopenmp -g -Wall -ansi -fomit-frame-pointer -fstrict-aliasing -ffast-math -msse2 -mfpmath=sse
endif
#Intel compiler
ifeq ($(shell $(CXX) -v 2>&1 | head -c 4),icpc)
CXXFLAGS=-O3 -openmp -ansi-alias -malign-double -fp-model fast=2
endif
#IBM compiler
ifeq ($(shell $(CXX) -qversion 2>&1 | head -c 3),IBM)
CXXFLAGS=-O5 -P -qsmp -qalign -qarch -qtune -qcache -qipa -qarch=qp
endif
CXXFLAGS += $(DEFS) -I$(IDIR)
ifneq ($(strip $(FFTW_INCLUDE_PATH)),)
CXXFLAGS+=-I$(FFTW_INCLUDE_PATH)
endif
LDFLAGS=
ifneq ($(strip $(FFTW_LIB_PATH)),)
LDFLAGS+=-L$(FFTW_LIB_PATH)
endif
#LDFLAGS=-lfftw3_threads -lfftw3 -lm
LDFLAGS+=-lfftw3_omp -lfftw3 -lm
MAKEDEPEND=$(CXXFLAGS) -O0 -M -DDEPEND
FILES=partfft
FFTW=fftw++
EXTRA=$(FFTW) convolution
ALL=$(FILES) $(EXTRA)
all: $(FILES)
%.o : %.cc %.h
$(CXX) $(CXXFLAGS) -o $@ -c $<
partfft: partfft.o $(EXTRA:=.o)
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
clean: FORCE
rm -rf $(ALL) $(ALL:=.o) $(ALL:=.d)
.SUFFIXES: .c .cc .o .d
.cc.o:
$(CXX) $(CXXFLAGS) $(INCL) -o $@ -c $<
.cc.d:
@echo Creating $@; \
rm -f $@; \
${CXX} $(MAKEDEPEND) $(INCL) $< > $@.$$$$ 2>/dev/null && \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
ifeq (,$(findstring clean,${MAKECMDGOALS}))
-include $(ALL:=.d)
endif
FORCE: