-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMake.env
More file actions
116 lines (98 loc) · 4.04 KB
/
Make.env
File metadata and controls
116 lines (98 loc) · 4.04 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
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
# Copyright 2025 MaLiang <bigml@qq.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the “Software”), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies
# or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# linux, osx, esp
TARGET = linux
# $make ... RELEASE=1 可生成执行更快速的代码(例如, hash table 操作速度有3倍以上差异),
# 并且可以发现程序中隐含的bug
RELEASE = 0
CC = gcc
AR = ar
TAR = tar
MAKE = make
RANLIB = ranlib
MULTIMAKE = $(BASEDIR)/tools/multimake.sh
CPWITHDIR = $(BASEDIR)/tools/cpwithdir.sh
INCBASE = -I. -I $(BASEDIR)/include/ -I $(BASEDIR)/deps/mbedtls/include/
# reef used other's function, so, reef first
LIBBASE = -L $(BASEDIR)/src/ -L $(BASEDIR)/deps/mbedtls/library/
# C99 new features:
# 1. variadic macros
# e.g. #define eprintf(format, ...) printf(stderr, format, ##__VA_ARGS__)
# 2. declare variables at locations other than the start of a block
# e.g. for (int i = 0; i < n; ++i) { ... }
# 3. stdint.h, which defines int8_t, uint8_t, and INT32_MAX...
# 4. new initializer mechanisms
# e.g. struct { int x, y; } a[10] = { [3] = { .y = 12, .x = 1 } };
# 5. one-line comments beginning with //
# 6. Variable length arrays, e.g. int x, a[x];
# 7. __func__ predefined identifier
# ...
CFLAGS = -std=c99
# 目标运行环境
ifeq ($(TARGET), linux)
CFLAGS += -DMOS_LINUX -D_GNU_SOURCE
INCBASE += -I /usr/local/include
LIBBASE += -Wl,--whole-archive -lreef -Wl,--no-whole-archive -lmbedtls -lmbedx509 -lmbedcrypto -L /usr/local/lib -lpthread -lrt -ldl
endif
ifeq ($(TARGET), osx)
CFLAGS += -DMOS_OSX
INCBASE += -I /usr/local/include
LIBBASE += -lreef -lmbedtls -lmbedx509 -lmbedcrypto -L /usr/local/lib -lpthread
endif
ifeq ($(TARGET), esp)
# need XTROOT enviorment variable seted
# And, XTROOT/local linked to rtos sdk path.
XTROOT := $(shell echo $(XTROOT))
CC = xtensa-lx106-elf-gcc
AR = xtensa-lx106-elf-ar
NM = xtensa-lx106-elf-nm
OBJCOPY = xtensa-lx106-elf-objcopy
OBJDUMP = xtensa-lx106-elf-objdump
CFLAGS += -DMOS_ESP -Wpointer-arith -Os -fno-inline-functions -fno-builtin-printf
LDFLAGS = -Teagle.app.v6.ld -mlongcalls
INCBASE += -I $(XTROOT)/local/include \
-I $(XTROOT)/local/extra_include \
-I $(XTROOT)/local/driver_lib/include \
-I $(XTROOT)/local/include/espressif \
-I $(XTROOT)/local/include/lwip \
-I $(XTROOT)/local/include/lwip/ipv4 \
-I $(XTROOT)/local/include/lwip/ipv6
LIBBASE += -nostdlib -L $(XTROOT)/local/lib -lmain
endif
# If optimization level is >= 2 in gcc-4.1, strict-aliasing is used,
# and this could cause probelms when a pointer is referencing to a different type
# of object and the object is refered thereafter by using this pointer.
# That is the case in this example.
# So you should force the compiler to not use strict-aliasing
# by a argument "-fno-strict-aliasing" if you want to use "-O2" or "-O3".
ifeq ($(RELEASE), 1)
CFLAGS += -fno-strict-aliasing -O3 -Wall -DRELEASE -Wno-unused-function
else
CFLAGS += -pg -g -Wall -Wno-unused-function
endif
ifeq ($(TRACE_SHORT), 1)
CFLAGS += -DTRACE_SHORT
endif
ifeq ($(USE_MEMCACHE), 1)
CFLAGS += -DUSE_MEMCACHE
LIBBASE += -lmemcached
endif
ifeq ($(USE_FCGI), 1)
CFLAGS += -DUSE_FCGI
LIBBASE += -lfcgi
endif