generated from gtrxAC/mre-makefile
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
executable file
·52 lines (40 loc) · 1.62 KB
/
Makefile
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
# ______________________________________________________________________________
#
# MRE Makefile
# ______________________________________________________________________________
#
GCC = arm-none-eabi-gcc
GPP = arm-none-eabi-g++
PYTHON = python3
OBJCOPY = objcopy
SDK = sdk
APP_FILE_NAME = peanut
INCLUDES = -I "$(SDK)/include" -I "src/include" -I "src/ResID" -I "src"
DEFINES = -D _MINIGUI_LIB_ -D _USE_MINIGUIENTRY -D _NOUNIX_ -D _FOR_WNC -D __MRE_SDK__ -D __MRE_VENUS_NORMAL__ -D __MMI_MAINLCD_240X320__ -D MRE -D GCC -D __MRE_COMPILER_GCC__
SHARED_PARAM = -c -fpic -march=armv5te -fvisibility=hidden -O3 -mlittle-endian $(INCLUDES) $(DEFINES) -fdata-sections -ffunction-sections
GCC_PARAM = $(SHARED_PARAM)
GPP_PARAM = $(SHARED_PARAM) -fno-threadsafe-statics -fno-exceptions -fno-non-call-exceptions
LINK_LIB = -lstdc++ $(SDK)/lib/*.a
LINK_PARAM = -fno-threadsafe-statics -Wl,--gc-sections -fpic -fpcc-struct-return --disable-libstdcxx-verbose -pie -lm -T "$(SDK)/scat.ld"
# ______________________________________________________________________________
#
all: build $(APP_FILE_NAME).vxp
# 1. Compile
build/%.o: src/%.c
$(GCC) $(GCC_PARAM) -c $< -o $@
build/%.o: src/%.cpp
$(GPP) $(GPP_PARAM) -c $< -o $@
# 2. Link
build/$(APP_FILE_NAME).axf: $(patsubst src/%.c,build/%.o,$(wildcard src/*.c))
$(GCC) -o $@ $^ $(LINK_LIB) $(LINK_PARAM)
# 3. Add resources
build/$(APP_FILE_NAME).vxp: build/$(APP_FILE_NAME).axf
$(OBJCOPY) -I elf32-little --add-section .vm_res=$(SDK)/resource.bin $^ $@
# 4. Add tags
$(APP_FILE_NAME).vxp: build/$(APP_FILE_NAME).vxp
$(PYTHON) $(SDK)/build.py $^ $@
build:
mkdir -p build
clean:
rm -rf build
rm -f *.vxp