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