blob: 4691a127d13f0d7ec7ffbf80d15645f2aaf05f19 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001
2#include linux kernel .config file
3-include $(LINUX_DIR)/.config
4
5#include lib and app config file
6include $(LIB_CFG_MK)
7include $(APP_CFG_MK)
8
9CFLAGS := -g -Os -pipe -fno-builtin -Wall
10
11CFLAGS += -ffunction-sections
12
13CFLAGS += -fomit-frame-pointer -msoft-float -fno-common -march=armv7-a -fno-short-enums
14
15ifeq ($(THUMB),yes)
16CFLAGS += -mthumb -mthumb-interwork -Wa,-mimplicit-it=thumb
17endif
18
19CFLAGS += -nostdinc
20CFLAGS += -idirafter $(STAGEDIR)/include
21ifeq ($(LIBC_TYPE),uClibc)
22CFLAGS += -isystem $(STAGEDIR)/libc/usr/include
23else
24CFLAGS += -isystem $(STAGEDIR)/libc/include
25endif
26CFLAGS += -isystem $(CROSS_COMPILE_INCLUDE_FIXED_PATH)
27CFLAGS += -isystem $(CROSS_COMPILE_INCLUDE_PATH)
28
29CFLAGS += -I$(PUB_ROOT_DIR)/include/infra
30
31LDFLAGS := -g -fno-common -fno-builtin
32
33LDFLAGS += -Wl,--gc-sections
34
35TARGETARCH := arm-linux
36HOSTARCH := $(shell sh $(BUILD_DIR)/config.guess)
37
38CONFIGURE_OPTS = --host=$(TARGETARCH) --build=$(HOSTARCH) --target=$(TARGETARCH)
39
40ARFLAGS := rcs
41
42export CFLAGS
43export LDFLAGS
44export ARFLAGS
45
46#LDFLAGS -static
47#$(CC) $(LD_BEGIN) $(LDFLAGS) -o $@ $^ -Wl,--start-group $(LDLIBS) $(LDLIBS_$@) -Wl,--end-group $(LD_END)
48LD_BEGIN = -nostdlib
49ifeq ($(LIBC_TYPE),uClibc)
50LD_BEGIN += $(STAGEDIR)/libc/usr/lib/crt1.o
51LD_BEGIN += $(STAGEDIR)/libc/usr/lib/crti.o
52else
53LD_BEGIN += $(STAGEDIR)/libc/lib/crt1.o
54LD_BEGIN += $(STAGEDIR)/libc/lib/crti.o
55endif
56
57LD_BEGIN += $(CROSS_COMPILE_CRTBEGIN)
58
59LD_END = -L $(STAGEDIR)/libc/lib
60LD_END += -Wl,-rpath-link,$(STAGEDIR)/libc/lib
61LD_END += -L $(STAGEDIR)/libc/usr/lib
62LD_END += -Wl,-rpath-link,$(STAGEDIR)/libc/usr/lib
63LD_END += -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group
64LD_END += $(CROSS_COMPILE_CRTEND)
65ifeq ($(LIBC_TYPE),uClibc)
66LD_END += $(STAGEDIR)/libc/usr/lib/crtn.o
67else
68LD_END += $(STAGEDIR)/libc/lib/crtn.o
69endif
70