blob: 88152920b245744c89ba0305897c0d6612b240a6 [file] [log] [blame]
wdenk0c8959d2002-08-14 08:04:29 +00001#
Marian Balakowiczf9328632006-09-01 19:49:50 +02002# (C) Copyright 2000-2006
wdenk0c8959d2002-08-14 08:04:29 +00003# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
Wolfgang Denk1a459662013-07-08 09:37:19 +02005# SPDX-License-Identifier: GPL-2.0+
wdenk0c8959d2002-08-14 08:04:29 +00006#
7
8include $(TOPDIR)/config.mk
9
Kyle Moffett01baa052011-02-23 06:40:38 +000010## 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
Sebastien Carlier6d8962e2010-11-05 15:48:07 +010023LIB = $(obj)lib$(ARCH).o
wdenk0c8959d2002-08-14 08:04:29 +000024
Scott Wood4b919722012-09-20 16:35:21 -050025MINIMAL=
26
27ifdef CONFIG_SPL_BUILD
28ifdef CONFIG_SPL_INIT_MINIMAL
29MINIMAL=y
30endif
31endif
32
33ifdef MINIMAL
Scott Wood06f60ae2012-12-06 13:33:17 +000034COBJS-y += cache.o time.o
35SOBJS-y += ticks.o
Scott Wood4b919722012-09-20 16:35:21 -050036else
37
Marian Balakowicz823afe72008-02-27 11:00:47 +010038SOBJS-y += ppcstring.o
Scott Wood4b919722012-09-20 16:35:21 -050039
40SOBJS-y += ppccache.o
Marian Balakowicz823afe72008-02-27 11:00:47 +010041SOBJS-y += ticks.o
Joakim Tjernlundfc4e1882010-01-19 14:41:55 +010042SOBJS-y += reloc.o
wdenk0c8959d2002-08-14 08:04:29 +000043
Peter Tyser4bbfd3e2010-10-07 22:32:48 -050044COBJS-$(CONFIG_BAT_RW) += bat_rw.o
Stefan Roese083f2e02012-08-16 17:53:18 +020045ifndef CONFIG_SPL_BUILD
Simon Glass660c60c2013-03-11 06:50:01 +000046ifndef CONFIG_SYS_GENERIC_BOARD
Marian Balakowicz823afe72008-02-27 11:00:47 +010047COBJS-y += board.o
Stefan Roese083f2e02012-08-16 17:53:18 +020048endif
Simon Glass660c60c2013-03-11 06:50:01 +000049endif
Dirk Eibachb8eee432013-06-26 15:55:16 +020050COBJS-$(CONFIG_CMD_BOOTM) += bootm.o
Marian Balakowicz823afe72008-02-27 11:00:47 +010051COBJS-y += cache.o
52COBJS-y += extable.o
53COBJS-y += interrupts.o
Peter Tyser425d3b62009-11-03 23:31:07 -060054COBJS-$(CONFIG_CMD_KGDB) += kgdb.o
Pavel Herrmann8d1165e11a2012-10-09 07:01:56 +000055COBJS-${CONFIG_CMD_IDE} += ide.o
Marian Balakowicz823afe72008-02-27 11:00:47 +010056COBJS-y += time.o
wdenk0c8959d2002-08-14 08:04:29 +000057
Stefan Roese083f2e02012-08-16 17:53:18 +020058# 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
Wolfgang Denk4ccd5512010-06-29 01:33:35 +020063# 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
Wolfgang Denk460c2ce2010-06-21 22:29:59 +020069ifdef CONFIG_MPC5200
70$(obj)ppcstring.o: AFLAGS += -Dmemcpy=__memcpy
Wolfgang Denk4ccd5512010-06-29 01:33:35 +020071COBJS-y += memcpy_mpc5200.o
Wolfgang Denk460c2ce2010-06-21 22:29:59 +020072endif
Stefan Roese083f2e02012-08-16 17:53:18 +020073endif
Wolfgang Denk460c2ce2010-06-21 22:29:59 +020074
Scott Wood4b919722012-09-20 16:35:21 -050075endif # not minimal
76
Stefan Roeseea8256f2012-08-23 08:34:21 +020077ifdef CONFIG_SPL_BUILD
78COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
79endif
80
Wolfgang Denk4ccd5512010-06-29 01:33:35 +020081COBJS += $(sort $(COBJS-y))
82
Kyle Moffett01baa052011-02-23 06:40:38 +000083SRCS := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
84 $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
Wolfgang Denk4ccd5512010-06-29 01:33:35 +020085OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
86
Kyle Moffett01baa052011-02-23 06:40:38 +000087TARGETS += $(LIB)
88
89all: $(TARGETS)
90
Marian Balakowiczf9328632006-09-01 19:49:50 +020091$(LIB): $(obj).depend $(OBJS)
Sebastien Carlier6d8962e2010-11-05 15:48:07 +010092 $(call cmd_link_o_target, $(OBJS))
wdenk0c8959d2002-08-14 08:04:29 +000093
Kyle Moffett01baa052011-02-23 06:40:38 +000094$(LIBGCC): $(obj).depend $(LGOBJS)
95 $(call cmd_link_o_target, $(LGOBJS))
96
wdenk0c8959d2002-08-14 08:04:29 +000097#########################################################################
98
Marian Balakowiczf9328632006-09-01 19:49:50 +020099# defines $(obj).depend target
100include $(SRCTREE)/rules.mk
wdenk0c8959d2002-08-14 08:04:29 +0000101
Marian Balakowiczf9328632006-09-01 19:49:50 +0200102sinclude $(obj).depend
wdenk0c8959d2002-08-14 08:04:29 +0000103
104#########################################################################