-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (59 loc) · 1.35 KB
/
Copy pathMakefile
File metadata and controls
71 lines (59 loc) · 1.35 KB
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
#
# Makefile - membench
#
# author: srikanth yalavarthi
# last modified: 2019-10-02
# url: https://github.com/srikanthy/membench.git
#
TOOLCHAIN = gcc
ifeq ($(TOOLCHAIN), gcc)
CPP = /lib/cpp -P
CC = gcc
ARCH_FLAGS =
OMP_FLAGS = -fopenmp
DEBUG_FLAGS = -std=c11 -pedantic -g -Wall -Wextra --save-temps
OPT_FLAGS = $(OMP_FLAGS) -O0 -fno-tree-vectorize
endif
ifeq ($(TOOLCHAIN), llvm)
CPP = clang -E
CC = clang
ARCH_FLAGS =
OMP_FLAGS = -fopenmp
DEBUG_FLAGS = -std=c11 -pedantic -g -Wall -Wextra --save-temps
OPT_FLAGS = $(OMP_FLAGS) -O0 -fno-vectorize
endif
INCDIR =
LIBDIR =
LIBS =
CPPFLAGS = $(ARCH_FLAGS) $(INCDIR)
CFLAGS = $(DEBUG_FLAGS) $(OPT_FLAGS)
LDFLAGS = $(LIBDIR) $(LIBS) $(OMP_FLAGS)
RM = rm -rf
LN = ln -sf
# source files
LIB_HDR =
LIB_SRC =
EXE_SRC = membench.c
# derived files
EXE = $(EXE_SRC:.c=.x)
PPS = $(EXE_SRC:.c=.i) $(LIB_SRC:.c=.i)
ASM = $(EXE_SRC:.c=.s) $(LIB_SRC:.c=.s)
OBJ = $(EXE_SRC:.c=.o) $(LIB_SRC:.c=.o)
# build targets
all: $(EXE)
membench.o: CFLAGS += -Wno-pedantic
membench.x: membench.o $(LIB_SRC:.c=.o)
$(CC) $(LDFLAGS) -o $@ $^
# build rules
%.o : %.c
$(CPP) $(CPPFLAGS) $< > $*.i
$(CC) $(CFLAGS) -c $*.i -o $*.o
# additional rules
clean:
$(RM) $(OBJ)
$(RM) $(ASM)
$(RM) $(PPS)
distclean: clean
$(RM) $(EXE)
$(RM) membench.csv
$(RM) membench.pdf