xref: /linux/arch/csky/Makefile (revision ed5c2f5fd10dda07263f79f338a512c0f49f76f5)
1# SPDX-License-Identifier: GPL-2.0-only
2OBJCOPYFLAGS		:=-O binary
3GZFLAGS			:=-9
4
5ifdef CONFIG_CPU_HAS_FPU
6FPUEXT = f
7endif
8
9ifdef CONFIG_CPU_HAS_VDSP
10VDSPEXT = v
11endif
12
13ifdef CONFIG_CPU_HAS_TEE
14TEEEXT = t
15endif
16
17ifdef CONFIG_CPU_CK610
18CPUTYPE	= ck610
19CSKYABI	= abiv1
20endif
21
22ifdef CONFIG_CPU_CK810
23CPUTYPE = ck810
24CSKYABI	= abiv2
25endif
26
27ifdef CONFIG_CPU_CK807
28CPUTYPE = ck807
29CSKYABI	= abiv2
30endif
31
32ifdef CONFIG_CPU_CK860
33CPUTYPE = ck860
34CSKYABI	= abiv2
35endif
36
37ifneq ($(CSKYABI),)
38MCPU_STR = $(CPUTYPE)$(FPUEXT)$(VDSPEXT)$(TEEEXT)
39KBUILD_CFLAGS += -mcpu=$(CPUTYPE) -Wa,-mcpu=$(MCPU_STR)
40KBUILD_CFLAGS += -DCSKYCPU_DEF_NAME=\"$(MCPU_STR)\"
41KBUILD_CFLAGS += -msoft-float -mdiv
42KBUILD_CFLAGS += -fno-tree-vectorize
43endif
44
45KBUILD_CFLAGS += -pipe
46ifeq ($(CSKYABI),abiv2)
47KBUILD_CFLAGS += -mno-stack-size
48endif
49
50ifdef CONFIG_FRAME_POINTER
51KBUILD_CFLAGS += -mbacktrace
52endif
53
54abidirs := $(patsubst %,arch/csky/%/,$(CSKYABI))
55KBUILD_CFLAGS += $(patsubst %,-I$(srctree)/%inc,$(abidirs))
56
57KBUILD_CPPFLAGS += -mlittle-endian
58LDFLAGS += -EL
59
60KBUILD_AFLAGS += $(KBUILD_CFLAGS)
61
62head-y := arch/csky/kernel/head.o
63
64core-y += arch/csky/$(CSKYABI)/
65
66libs-y += arch/csky/lib/ \
67	$(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
68
69boot := arch/csky/boot
70
71all: zImage
72
73zImage Image uImage: vmlinux
74	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
75
76define archhelp
77  echo  '* zImage       - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
78  echo  '  Image        - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
79  echo  '  uImage       - U-Boot wrapped zImage'
80endef
81