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