xref: /openbmc/u-boot/arch/powerpc/lib/Makefile (revision f9727161)
1#
2# (C) Copyright 2000-2006
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
5# SPDX-License-Identifier:	GPL-2.0+
6#
7
8include $(TOPDIR)/config.mk
9
10## Build a couple of necessary functions into a private libgcc
11LIBGCC	= $(obj)libgcc.o
12GLSOBJS	+= _ashldi3.o
13GLSOBJS	+= _ashrdi3.o
14GLSOBJS	+= _lshrdi3.o
15LGOBJS	:= $(addprefix $(obj),$(GLSOBJS)) \
16	   $(addprefix $(obj),$(GLCOBJS))
17
18## But only build it if the user asked for it
19ifdef USE_PRIVATE_LIBGCC
20TARGETS	+= $(LIBGCC)
21endif
22
23LIB	= $(obj)lib$(ARCH).o
24
25MINIMAL=
26
27ifdef CONFIG_SPL_BUILD
28ifdef CONFIG_SPL_INIT_MINIMAL
29MINIMAL=y
30endif
31endif
32
33ifdef MINIMAL
34COBJS-y += cache.o time.o
35SOBJS-y += ticks.o
36else
37
38SOBJS-y	+= ppcstring.o
39
40SOBJS-y	+= ppccache.o
41SOBJS-y	+= ticks.o
42SOBJS-y	+= reloc.o
43
44COBJS-$(CONFIG_BAT_RW) += bat_rw.o
45ifndef CONFIG_SPL_BUILD
46ifndef CONFIG_SYS_GENERIC_BOARD
47COBJS-y	+= board.o
48endif
49endif
50COBJS-$(CONFIG_CMD_BOOTM) += bootm.o
51COBJS-y	+= cache.o
52COBJS-y	+= extable.o
53COBJS-y	+= interrupts.o
54COBJS-$(CONFIG_CMD_KGDB) += kgdb.o
55COBJS-${CONFIG_CMD_IDE} += ide.o
56COBJS-y	+= time.o
57
58# Don't include the MPC5xxx special memcpy into the
59# SPL U-Boot image. memcpy is used in the SPL NOR
60# flash driver. And we need the real, fast memcpy
61# here. We have no problems with unaligned access.
62ifndef CONFIG_SPL_BUILD
63# Workaround for local bus unaligned access problems
64# on MPC512x and MPC5200
65ifdef CONFIG_MPC512X
66$(obj)ppcstring.o: AFLAGS += -Dmemcpy=__memcpy
67COBJS-y += memcpy_mpc5200.o
68endif
69ifdef CONFIG_MPC5200
70$(obj)ppcstring.o: AFLAGS += -Dmemcpy=__memcpy
71COBJS-y += memcpy_mpc5200.o
72endif
73endif
74
75endif # not minimal
76
77ifdef CONFIG_SPL_BUILD
78COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
79endif
80
81COBJS	+= $(sort $(COBJS-y))
82
83SRCS	:= $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
84	   $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
85OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
86
87TARGETS += $(LIB)
88
89all: $(TARGETS)
90
91$(LIB):	$(obj).depend $(OBJS)
92	$(call cmd_link_o_target, $(OBJS))
93
94$(LIBGCC): $(obj).depend $(LGOBJS)
95	$(call cmd_link_o_target, $(LGOBJS))
96
97#########################################################################
98
99# defines $(obj).depend target
100include $(SRCTREE)/rules.mk
101
102sinclude $(obj).depend
103
104#########################################################################
105