-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakefileOLD
165 lines (124 loc) · 3.93 KB
/
MakefileOLD
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
ROOT = .
################
# Local settings
################
# Compiler
SOLARIS_CC ?= /opt/csw/bin/gcc
TILERA_CC ?= tile-gcc
CC ?= gcc
# Profile
ifeq ($(VERSION),DEBUG)
CFLAGS += -g -DDEBUG -O0
else
CFLAGS += -O3 -DNDEBUG
endif
BINDIR ?= $(ROOT)/bin
BUILDIR ?= $(ROOT)/build
$(shell [ -d "$(BUILDIR)" ] || mkdir -p $(BUILDIR))
$(shell [ -d "$(BINDIR)" ] || mkdir -p $(BINDIR))
LIBAO_INC = $(ROOT)/atomic_ops
#############################
# Platform dependent settings
#############################
#
# GCC thread-local storage requires "significant
# support from the linker (ld), dynamic linker
# (ld.so), and system libraries (libc.so and libpthread.so), so it is
# not available everywhere." source: GCC-doc.
#
# pthread_spinlock is replaced by pthread_mutex
# on MacOS X, as it might not be supported.
# Comment LOCK = MUTEX below to enable.
ifndef OS_NAME
OS_NAME = $(shell uname -s)
endif
ifeq ($(OS_NAME), Darwin)
OS = MacOS
DEFINES += -UTLS
LOCK = MUTEX
endif
ifeq ($(OS_NAME), Linux)
OS = Linux
DEFINES += -DTLS
endif
ifeq ($(OS_NAME), SunOS)
OS = Solaris
CC = $(SOLARIS_CC)
DEFINES += -DTLS
endif
#################################
# Architecture dependent settings
#################################
ifndef ARCH
ARCH_NAME = $(shell uname -m)
endif
ifeq ($(ARCH_NAME), i386)
ARCH = x86
CFLAGS += -m32
LDFLAGS += -m32
endif
ifeq ($(ARCH_NAME), i686)
ARCH = x86
CFLAGS += -m32
LDFLAGS += -m32
endif
ifeq ($(ARCH_NAME), x86_64)
ARCH = x86_64
CFLAGS += -m64
LDFLAGS += -m64
endif
ifeq ($(ARCH_NAME), sun4v)
ARCH = sparc64
CFLAGS += -DSPARC=1 -DINLINED=1 -m64
LDFLAGS += -lrt -m64
endif
ifeq ($(PLATFORM_NUMA), 1)
LDFLAGS += -lnuma
endif
#################
# Global settings
#################
CFLAGS += -D_REENTRANT
CFLAGS += -D_GNU_SOURCE
CFLAGS += -DLOCKFREE
CFLAGS += -Wall
CFLAGS += -fno-strict-aliasing
CFLAGS += -I$(LIBAO_INC) -I$(ROOT)/include
#LDFLAGS += -L$(LIBAO)/lib -latomic_ops
LDFLAGS += -lpthread -lrt -lm
LINDENFLAGS = -DCACHE_LINE_SIZE=`getconf LEVEL1_DCACHE_LINESIZE` -DINTEL
SPRAY = $(BINDIR)/spray
SSSP = $(BINDIR)/sssp
BINS = $(BINDIR)/*
.PHONY: all clean
all: spray sssp
measurements.o:
$(CC) $(CFLAGS) -c -o $(BUILDIR)/measurements.o measurements.c
ssalloc.o:
$(CC) $(CFLAGS) -c -o $(BUILDIR)/ssalloc.o ssalloc.c
skiplist.o:
$(CC) $(CFLAGS) -c -o $(BUILDIR)/skiplist.o skiplist.c
fraser.o: skiplist.h
$(CC) $(CFLAGS) -c -o $(BUILDIR)/fraser.o fraser.c
linden.o: linden.h
$(CC) $(CFLAGS) $(LINDENFLAGS) -c -o $(BUILDIR)/linden.o linden.c
linden_common.o: linden_common.h
$(CC) $(CFLAGS) $(LINDENFLAGS) -c -o $(BUILDIR)/linden_common.o linden_common.c
gc.o: gc/gc.h
$(CC) $(CFLAGS) $(LINDENFLAGS) -c -o $(BUILDIR)/gc.o gc/gc.c
ptst.o: gc/ptst.h
$(CC) $(CFLAGS) $(LINDENFLAGS) -c -o $(BUILDIR)/ptst.o gc/ptst.c
intset.o: skiplist.h fraser.h
$(CC) $(CFLAGS) -c -o $(BUILDIR)/intset.o intset.c
test.o: skiplist.h fraser.h intset.h
$(CC) $(CFLAGS) -c -o $(BUILDIR)/test.o test.c
sssp.o: skiplist.h fraser.h intset.h
$(CC) $(CFLAGS) -c -o $(BUILDIR)/sssp.o sssp.c
pqueue.o: skiplist.h intset.h
$(CC) $(CFLAGS) -c -o $(BUILDIR)/pqueue.o pqueue.c
spray: measurements.o ssalloc.o skiplist.o fraser.o intset.o test.o pqueue.o linden.o linden_common.o gc.o ptst.o
$(CC) $(CFLAGS) $(BUILDIR)/pqueue.o $(BUILDIR)/measurements.o $(BUILDIR)/ssalloc.o $(BUILDIR)/skiplist.o $(BUILDIR)/fraser.o $(BUILDIR)/intset.o $(BUILDIR)/test.o $(BUILDIR)/linden.o $(BUILDIR)/linden_common.o $(BUILDIR)/ptst.o $(BUILDIR)/gc.o -o $(SPRAY) $(LDFLAGS)
sssp: measurements.o ssalloc.o skiplist.o fraser.o intset.o sssp.o pqueue.o linden.o linden_common.o gc.o ptst.o
$(CC) $(CFLAGS) $(BUILDIR)/pqueue.o $(BUILDIR)/measurements.o $(BUILDIR)/ssalloc.o $(BUILDIR)/skiplist.o $(BUILDIR)/fraser.o $(BUILDIR)/intset.o $(BUILDIR)/sssp.o $(BUILDIR)/linden.o $(BUILDIR)/linden_common.o $(BUILDIR)/ptst.o $(BUILDIR)/gc.o -o $(SSSP) $(LDFLAGS)
clean:
-rm -f $(BINS) $(BUILDIR)/*.o