-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path.Makefile.inc
81 lines (68 loc) · 1.64 KB
/
.Makefile.inc
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
debug ?= false
prefix ?= /usr/local
topdir = $(shell pwd)
# compiling flags
STD += -std=c99
WARN += -Wall
EXTRA += -pedantic -Wpadded -Werror -Wextra -Wno-unused-parameter
EXTRA += -Wno-unused-function -Wfloat-equal -Winline -Wdisabled-optimization
EXTRA += -Wconversion
ifneq ($(CC), clang)
EXTRA += -Wno-format-truncation
endif
FEATURE += -fno-omit-frame-pointer
OTHER += -pipe -g -ggdb3
CC_SHARED += -fPIC
MACRO +=
INC += \
-I./include \
-I./3rds/fcunit
ifeq ($(debug), false)
OPT += -O2
FEATURE += -fstack-protector
else
OPT += -O0
FEATURE += -fstack-protector-all \
-finstrument-functions
endif
# linking flags
LD_SHARED += -shared
DEP_LDFLAGS += \
-Wl,-rpath,$(prefix)/lib \
-Wl,-rpath,$(topdir)/lib \
-Lflist \
-Lfhash \
-Lfcache \
-Lfmbuf \
-Lflock \
-Lftime \
-Lfnet \
-Lfconf \
-Lfthread_pool \
-Lflog \
-Lfev \
-Lfco
# Combined Flags
FL_CFLAGS = $(CFLAGS) $(FLIB_CFLAGS) $(STD) $(WARN) $(EXTRA) $(FEATURE) \
$(MACRO) $(OPT) $(OTHER) $(CC_SHARED) $(INC)
FL_LDFLAGS = $(LDFLAGS) $(FLIB_LDFLAGS) $(OPT) $(OTHER) $(LD_SHARED) $(DEP_LDFLAGS)
FL_BIN_LDFLAGS = $(LDFLAGS) $(FLIB_LDFLAGS) $(OPT) $(OTHER) $(DEP_LDFLAGS)
# CC and LD
FL_CC = $(CC) $(FL_CFLAGS)
FL_LD = $(CC) $(FL_LDFLAGS)
FL_BIN_LD = $(CC) $(FL_BIN_LDFLAGS)
################################################################################
# PLAT_BIT is one of the 32 or 64
PLAT_BIT = $(shell getconf LONG_BIT)
BIT ?= $(PLAT_BIT)
# only in x86_64 platform compile a 32bit app need append -m32 parameter
ifeq ($(PLAT_BIT), 64)
ifeq ($(BIT), 32)
OTHER += -m32
BUILD_BIT = 32
else
BUILD_BIT = 64
endif
else
BUILD_BIT = 32
endif