-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile.common
78 lines (68 loc) · 1.95 KB
/
Makefile.common
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
# Path to root directory
ROOT ?= .
# CC, LD and AR are builtin-variables of Make (?= is useless in this case)
# To override these defines, you must use "make CC=cc" or change it here
# Linker set by default to the CC definition
LD = $(CC)
# Other tools
DOXYGEN ?= doxygen
UNIFDEF ?= unifdef
# Define global parameters
TM = stm
SRCDIR = $(ROOT)/src
INCDIR = $(ROOT)/include
LIBDIR = $(ROOT)/lib
TMLIB = $(LIBDIR)/lib$(TM).a
# Supposing all compilers has -I -L
# TODO -I$(SRCDIR) only for library build
CPPFLAGS += -I$(INCDIR) -I$(SRCDIR)
# Disable assert for non-debug build
ifneq ($(CFG),debug)
CPPFLAGS += -DNDEBUG
endif
# TODO Should be only for test binaries
LDFLAGS += -L$(LIBDIR) -l$(TM)
# Only on linux / TODO make source compatible with non-pthread OS
LDFLAGS += -lpthread
# Solaris default memory allocator is quite slow, better use mtmalloc
# LDFLAGS += -lmtmalloc
# Disable additionnal checks from glibc (__longjmp_chk/__printf_chk)
CPPFLAGS += -U_FORTIFY_SOURCE
# CPPFLAGS += -D_FORTIFY_SOURCE=0
# Enable multi-thread support in glibc
CPPFLAGS += -D_REENTRANT
# Rely on the definition of CC to determine the compiler
# if the compiler is not detected correctly, use "gmake COMPILER=your_compiler"
# Default: gcc
COMPILER ?= $(CC)
ifeq ($(COMPILER),icc)
include $(ROOT)/Makefile.icc
else
ifeq ($(COMPILER),suncc)
include $(ROOT)/Makefile.suncc
else
ifeq ($(COMPILER),xlc)
else
ifeq ($(COMPILER),llvm-gcc)
else
ifeq ($(COMPILER),clang)
include $(ROOT)/Makefile.clang
else
include $(ROOT)/Makefile.gcc
endif
endif
endif
endif
endif
########################################################################
# libatomic_ops path
# LIBAO_HOME must be set to the path of libatomic_ops
# (use the embedded light libatomic_ops if LIBAO_HOME is not defined)
########################################################################
ifndef LIBAO_HOME
LIBAO_HOME = $(SRCDIR)/atomic_ops
LIBAO_INC = $(LIBAO_HOME)
else
LIBAO_INC = $(LIBAO_HOME)/include
endif
CPPFLAGS += -I$(LIBAO_INC)