-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRules.mak
181 lines (125 loc) · 3.93 KB
/
Rules.mak
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# rule for all modules
############## Common for all modules
# support PC environments
# ARCH=
# released or debug version, different on debug and log info£¬2007.03.15
# must be 'release' or 'debug'
EDITION=debug
#EDITION=release
ifeq ($(EDITION),release)
C_FLAGS += -D__EXT_RELEASE__
else
endif
ifeq ($(ARCH),arm)
# C_FLAGS += -D__ARM_CMN__=1 -DARCH_ARM=1 -DARCH_X86=0 -DARCH_X86_32=0
CROSS_COMPILER=arm-none-eabi-
LDFLAGS+=
flag=
C_FLAGS +=-DARM -DARCH_ARM=1
else
ARCH=X86
C_FLAGS +=-D$(ARCH) -DARCH_X86=1 -DARCH_X86_32=1 -DARCH_ARM=0
EXTENSION=
endif
ifeq ($(ARCH),X86)
else
ARCH=arm
endif
CC = $(CROSS_COMPILER)gcc
CXX = $(CROSS_COMPILER)g++
STRIP = $(CROSS_COMPILER)strip
LD = $(CROSS_COMPILER)ld
RANLIB = $(CROSS_COMPILER)ranlib
STRIP = $(CROSS_COMPILER)strip
AR = $(CROSS_COMPILER)ar
OBJCOPY = $(CROSS_COMPILER)objcopy
ASM = yasm
RM = rm -r -f
MKDIR = mkdir -p
MODE = 700
OWNER = root
CHOWN = chown
CHMOD = chmod
COPY = cp
MOVE = mv
LN = ln -sf
# configuration options for manage this project
#BUILDTIME := $(shell TZ=UTC date -u "+%Y_%m_%d-%H_%M")
BUILDTIME := $(shell TZ=CN date -u "+%Y_%m_%d")
GCC_VERSION := $(shell $(CC) -dumpversion )
RELEASES_NAME=$(NAME)_$(GCC_VERSION)_$(ARCH)_$(EDITION)_$(BUILDTIME).tar.gz
export BUILDTIME
export RELEASES_NAME
BIN_DIR=$(ROOT_DIR)/Linux.bin.$(ARCH)
OBJ_DIR=Linux.obj.$(ARCH)
############## definitions for different modules
EXE=rtosLwip$(BOARD_NAME).bin
RTOS_HOME=$(RULE_DIR)/freeRtos
LWIP_HOME=$(RULE_DIR)/lwip
RTOS_HEADER= \
-I$(RTOS_HOME)/Source/include \
-I$(RTOS_HOME)/Source/portable/GCC/POSIX \
# -I$(LWIP_HOME)/project \
LWIP_HEADER= \
-I$(LWIP_HOME)/exts/include \
-I$(LWIP_HOME)/src/include \
-I$(LWIP_HOME)/src/include/ipv4 \
-I$(LWIP_HOME)/ports/freeRtos \
APP_HEADER= \
-I$(LWIP_HOME)/project
CFLAGS += -DROOT_DIR='"$(ROOT_DIR)"' -I$(ROOT_DIR)
###################################################################
# define directories for header file and build flags
###################################################################
RTOS_FLAGS+=
LWIP_FLAGS+=-DLWIP_DEBUG -DLWIP_V2=1
CWARNS += -W
CWARNS += -Wall
#CWARNS += -Werror
CWARNS += -Wextra
# -Wno-format
CWARNS += -Wformat=0
CWARNS += -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute
# CWARNS += -Wmissing-prototypes
CWARNS += -Wno-cast-align
CWARNS += -Wparentheses
CWARNS += -Wshadow
CWARNS += -Wno-sign-compare
CWARNS += -Wswitch
CWARNS += -Wuninitialized
CWARNS += -Wunknown-pragmas
CWARNS += -Wunused-function
CWARNS += -Wunused-label
# CWARNS += -Wunused-parameter
CWARNS += -Wunused-value
#CWARNS += -Wunused-variable
CWARNS += -fno-strict-aliasing
#CWARNS += -Wno-unused-function
CW_WARNS += -Wstrict-prototypes -Wpointer-arith -Wchar-subscripts -Wcast-align
# -std=gnu99
CFLAGS += \
-O1 -g3 \
\
-Wcomment -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs \
-Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return \
-Wno-deprecated-declarations -Wredundant-decls \
-Wunreachable-code
CFLAGS += -m32
CFLAGS += -DDEBUG=1
#CFLAGS += -g -DUSE_STDIO=1 -D__GCC_POSIX__=1
CFLAGS += -g -UUSE_STDIO -D__GCC_POSIX__=1
ifneq ($(shell uname), Darwin)
CFLAGS += -pthread
endif
# MAX_NUMBER_OF_TASKS = max pthreads used in the POSIX port.
# Default value is 64 (_POSIX_THREAD_THREADS_MAX), the minimum number required by POSIX.
CFLAGS += -DMAX_NUMBER_OF_TASKS=300
CFLAGS += $(INCLUDES) $(CWARNS) -O2
# can't use this options, pbuf in Lwip and gmac of atmel must be alligned differently, such as 8 bytes border or others
# CPACK_FLAGS = -fpack-struct
# -fpack-struct, add 05.07,2018,JL
# -Wlong-long: disable ISO C90 not support 'long long' warns in RTK SDK
# -Wpacked : disable warns for 'packed' in LwIP protocols
# -Wnested-externs : nested extern declaration
# for FreeRTOS, declarations of sysclk_get_cpu_hz()
#CFLAGS += -Werror=implicit-function-declaration