blob: 0280ef5243068dd354c15ccb7dc5df0799b4eb1f [file] [log] [blame]
Uwe Hermann7eb845e2008-11-02 17:01:06 +00001##
2## This file is part of the bayou project.
3##
4## Copyright (C) 2008 Advanced Micro Devices, Inc.
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License version 2 as
8## published by the Free Software Foundation.
9##
10## This program is distributed in the hope that it will be useful,
11## but WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13## GNU General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License
16## along with this program; if not, write to the Free Software
Paul Menzela46a7122013-02-23 18:37:27 +010017## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Uwe Hermann7eb845e2008-11-02 17:01:06 +000018##
19
20CONFIG_LZMA=y
21CONFIG_NRV2B=y
22CONFIG_BUILTIN_LAR=y
23
24PBUILDER_CONFIG=bayou.xml
25BUILTIN_LAR=builtin.lar
26
Stefan Reinauer7b769122010-04-20 23:04:46 +000027export src := $(shell pwd)
28export obj := $(src)/build
Uwe Hermann7eb845e2008-11-02 17:01:06 +000029
Stefan Reinauer7b769122010-04-20 23:04:46 +000030LIBPAYLOAD_DIR := $(obj)/libpayload
31
32CC?=gcc
33STRIP?=strip
34OBJCOPY?=objcopy
Uwe Hermann7eb845e2008-11-02 17:01:06 +000035
36FFLAGS-y=
37FFLAGS-$(CONFIG_BUILTIN_LAR) += -DCONFIG_BUILTIN_LAR
38FFLAGS-$(CONFIG_LZMA) += -DCONFIG_LZMA
39FFLAGS-$(CONFIG_NRV2B) += -DCONFIG_NRV2B
40
41OBJECTS-y=main.o payload.o config.o menu.o self.o
42OBJECTS-$(CONFIG_LZMA) += lzma.o
43OBJECTS-$(CONFIG_NRV2B) += nrv2b.o
44OBJECTS-$(CONFIG_BUILTIN_LAR) += builtin-lar.o
45
46CFLAGS= -Wall -Werror -Os $(FFLAGS-y)
47LDFLAGS=-Wl,-T,bayou.ldscript -static
48LIBGCC=$(shell $(CC) -m32 -print-libgcc-file-name)
49
50LPCC=$(LIBPAYLOAD_DIR)/bin/lpgcc
51
52bayou.elf: $(OBJECTS-y)
Uwe Hermann54c52762008-11-02 17:48:20 +000053 $(LPCC) $(LDFLAGS) -m32 -o $@ $(OBJECTS-y)
Stefan Reinauer7b769122010-04-20 23:04:46 +000054 @$(STRIP) $@
Uwe Hermann7eb845e2008-11-02 17:01:06 +000055
56builtin-lar.o: $(BUILTIN_LAR)
Stefan Reinauer7b769122010-04-20 23:04:46 +000057 @$(OBJCOPY) -I binary -B i386 -O elf32-i386 $(BUILTIN_LAR) $@
Uwe Hermann7eb845e2008-11-02 17:01:06 +000058
59builtin.lar: util/pbuilder/pbuilder
Stefan Reinauer7b769122010-04-20 23:04:46 +000060 @rm -f $@
Uwe Hermann7eb845e2008-11-02 17:01:06 +000061 util/pbuilder/pbuilder -c $(PBUILDER_CONFIG) create $@
62
63util/pbuilder/pbuilder:
Stefan Reinauer7b769122010-04-20 23:04:46 +000064 $(MAKE) -C util/pbuilder
Uwe Hermann7eb845e2008-11-02 17:01:06 +000065
66%.o: %.c
Uwe Hermann54c52762008-11-02 17:48:20 +000067 $(LPCC) $(CFLAGS) -c -o $@ $<
Uwe Hermann7eb845e2008-11-02 17:01:06 +000068
69clean:
70 rm -f *.o bayou.elf builtin.lar
Stefan Reinauer7b769122010-04-20 23:04:46 +000071 $(MAKE) -C util/pbuilder clean
Uwe Hermann54c52762008-11-02 17:48:20 +000072