blob: 88152920b245744c89ba0305897c0d6612b240a6 [file] [log] [blame]
wdenk0c8959d2002-08-14 08:04:29 +00001#
Marian Balakowiczd62379d2006-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 Denkd79de1d2013-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 Moffett78d58de2011-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 Carliera8d426f2010-11-05 15:48:07 +010023LIB = $(obj)lib$(ARCH).o
wdenk0c8959d2002-08-14 08:04:29 +000024
Scott Wood7c810902012-09-20 16:35:21 -050025MINIMAL=
26
27ifdef CONFIG_SPL_BUILD
28ifdef CONFIG_SPL_INIT_MINIMAL
29MINIMAL=y
30endif
31endif
32
33ifdef MINIMAL
Scott Wood2b36fbb2012-12-06 13:33:17 +000034COBJS-y += cache.o time.o
35SOBJS-y += ticks.o
Scott Wood7c810902012-09-20 16:35:21 -050036else
37
Marian Balakowicz699ffe52008-02-27 11:00:47 +010038SOBJS-y += ppcstring.o
Scott Wood7c810902012-09-20 16:35:21 -050039
40SOBJS-y += ppccache.o
Marian Balakowicz699ffe52008-02-27 11:00:47 +010041SOBJS-y += ticks.o
Joakim Tjernlund4ff6bc02010-01-19 14:41:55 +010042SOBJS-y += reloc.o
wdenk0c8959d2002-08-14 08:04:29 +000043
Peter Tyser86dee4a2010-10-07 22:32:48 -050044COBJS-$(CONFIG_BAT_RW) += bat_rw.o
Stefan Roese50b5ac02012-08-16 17:53:18 +020045ifndef CONFIG_SPL_BUILD
Simon Glassfa6945f2013-03-11 06:50:01 +000046ifndef CONFIG_SYS_GENERIC_BOARD
Marian Balakowicz699ffe52008-02-27 11:00:47 +010047COBJS-y += board.o
Stefan Roese50b5ac02012-08-16 17:53:18 +020048endif
Simon Glassfa6945f2013-03-11 06:50:01 +000049endif
Dirk Eibachd2df8112013-06-26 15:55:16 +020050COBJS-$(CONFIG_CMD_BOOTM) += bootm.o
Marian Balakowicz699ffe52008-02-27 11:00:47 +010051COBJS-y += cache.o
52COBJS-y += extable.o
53COBJS-y += interrupts.o
Peter Tyserda1a4fc2009-11-03 23:31:07 -060054COBJS-$(CONFIG_CMD_KGDB) += kgdb.o
Pavel Herrmann2c13c4a2012-10-09 07:01:56 +000055COBJS-${CONFIG_CMD_IDE} += ide.o
Marian Balakowicz699ffe52008-02-27 11:00:47 +010056COBJS-y += time.o
wdenk0c8959d2002-08-14 08:04:29 +000057
Stefan Roese50b5ac02012-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 Denk85aa2c42010-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 Denk16126092010-06-21 22:29:59 +020069ifdef CONFIG_MPC5200
70$(obj)ppcstring.o: AFLAGS += -Dmemcpy=__memcpy
Wolfgang Denk85aa2c42010-06-29 01:33:35 +020071COBJS-y += memcpy_mpc5200.o
Wolfgang Denk16126092010-06-21 22:29:59 +020072endif
Stefan Roese50b5ac02012-08-16 17:53:18 +020073endif
Wolfgang Denk16126092010-06-21 22:29:59 +020074
Scott Wood7c810902012-09-20 16:35:21 -050075endif # not minimal
76
Stefan Roeseec90d342012-08-23 08:34:21 +020077ifdef CONFIG_SPL_BUILD
78COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
79endif
80
Wolfgang Denk85aa2c42010-06-29 01:33:35 +020081COBJS += $(sort $(COBJS-y))
82
Kyle Moffett78d58de2011-02-23 06:40:38 +000083SRCS := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
84 $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
Wolfgang Denk85aa2c42010-06-29 01:33:35 +020085OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
86
Kyle Moffett78d58de2011-02-23 06:40:38 +000087TARGETS += $(LIB)
88
89all: $(TARGETS)
90
Marian Balakowiczd62379d2006-09-01 19:49:50 +020091$(LIB): $(obj).depend $(OBJS)
Sebastien Carliera8d426f2010-11-05 15:48:07 +010092 $(call cmd_link_o_target, $(OBJS))
wdenk0c8959d2002-08-14 08:04:29 +000093
Kyle Moffett78d58de2011-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 Balakowiczd62379d2006-09-01 19:49:50 +020099# defines $(obj).depend target
100include $(SRCTREE)/rules.mk
wdenk0c8959d2002-08-14 08:04:29 +0000101
Marian Balakowiczd62379d2006-09-01 19:49:50 +0200102sinclude $(obj).depend
wdenk0c8959d2002-08-14 08:04:29 +0000103
104#########################################################################