-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (61 loc) · 1.74 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
71
72
73
74
75
76
77
78
79
80
81
82
-include config.mk
.DEFAULT_GOAL := bin
TARGETS += dgemm-debug dgemm
TARGETS += triples-debug triples
TARGETS += blas-debug blas
TARGETS += vector-debug vector
BIN := $(patsubst %,bin/${CONFIG}/%,$(TARGETS))
OBJ := $(patsubst %,obj/${CONFIG}/%.o,$(TARGETS))
LST := $(patsubst %,obj/${CONFIG}/%.lst,$(TARGETS))
CONFIG ?= icc
include make/${CONFIG}.mk
$(info CONFIG = $(CONFIG))
CXX_FLAGS = \
-pedantic -Wall \
-ansi \
-std=c++11 \
-fmax-errors=1 \
$(OPTIONS) \
-march=native \
-Wl,-Bstatic $(LIBS_STATIC) -Wl,-Bdynamic
CFLAGS = \
-pedantic -Wall \
-ansi \
-fmax-errors=1 \
$(OPTIONS) \
-march=native \
-Wl,-Bstatic $(LIBS_STATIC) -Wl,-Bdynamic
DEB_FLAGS = -DDEBU -O0 -g
OPT_FLAGS = -O3
all: bin obj lst
bin: $(BIN)
obj: $(OBJ)
lst: $(LST) Makefile
$(TARGETS): Makefile
DEFINES += -DGIT_COMMIT="$(shell git describe --always)"
DEFINES += -DCONFIG=$(CONFIG)
DEFINES += -DCOMPILER_VERSION="$(shell $(CXX) --version)"
DEFINES += -DDATE="$(shell date)"
bin/${CONFIG}/%-debug: %.cxx
@mkdir -p ${@D}
$(CXX) $(DEFINES) $(INCLUDES) ${DEB_FLAGS} $< $(CXX_FLAGS) -o $@
bin/${CONFIG}/%: %.cxx
@mkdir -p ${@D}
$(CXX) $(DEFINES) $(INCLUDES) ${OPT_FLAGS} $< $(CXX_FLAGS) -o $@
bin/${CONFIG}/%-debug: %.c
@mkdir -p ${@D}
$(CC) $(DEFINES) $(INCLUDES) ${DEB_FLAGS} $< $(CFLAGS) -o $@
bin/${CONFIG}/%: %.c
@mkdir -p ${@D}
$(CC) $(DEFINES) $(INCLUDES) ${OPT_FLAGS} $< $(CFLAGS) -o $@
obj/${CONFIG}/%-debug.o: %.cxx
@mkdir -p ${@D}
$(CXX) $(DEFINES) $(INCLUDES) ${DEB_FLAGS} -c $< $(CXX_FLAGS) -o $@
obj/${CONFIG}/%.o: %.cxx
@mkdir -p ${@D}
$(CXX) $(DEFINES) $(INCLUDES) ${OPT_FLAGS} -c $< $(CXX_FLAGS) -o $@
%.lst: %.o
objdump --demangle -f -l -Mintel -S $< > $@
clean:
rm -r bin/${CONFIG} obj/${CONFIG}
.PHONY: all clean bin obj lst