Clone a tag rather than SeaBIOS stable branch HEAD
[coreboot.git] / payloads / bayou / Makefile
1 ##
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
17 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18 ##
19
20 CONFIG_LZMA=y
21 CONFIG_NRV2B=y
22 CONFIG_BUILTIN_LAR=y
23
24 PBUILDER_CONFIG=bayou.xml
25 BUILTIN_LAR=builtin.lar
26
27 export src := $(shell pwd)
28 export obj := $(src)/build
29
30 LIBPAYLOAD_DIR := $(obj)/libpayload
31
32 CC?=gcc
33 STRIP?=strip
34 OBJCOPY?=objcopy
35
36 FFLAGS-y=
37 FFLAGS-$(CONFIG_BUILTIN_LAR) += -DCONFIG_BUILTIN_LAR
38 FFLAGS-$(CONFIG_LZMA) += -DCONFIG_LZMA
39 FFLAGS-$(CONFIG_NRV2B) += -DCONFIG_NRV2B
40
41 OBJECTS-y=main.o payload.o config.o menu.o self.o
42 OBJECTS-$(CONFIG_LZMA) += lzma.o
43 OBJECTS-$(CONFIG_NRV2B) += nrv2b.o
44 OBJECTS-$(CONFIG_BUILTIN_LAR) += builtin-lar.o
45
46 CFLAGS= -Wall -Werror -Os $(FFLAGS-y)
47 LDFLAGS=-Wl,-T,bayou.ldscript -static
48 LIBGCC=$(shell $(CC) -m32 -print-libgcc-file-name)
49
50 LPCC=$(LIBPAYLOAD_DIR)/bin/lpgcc
51
52 bayou.elf: $(OBJECTS-y)
53         $(LPCC) $(LDFLAGS) -m32 -o $@ $(OBJECTS-y)
54         @$(STRIP) $@
55
56 builtin-lar.o: $(BUILTIN_LAR)
57         @$(OBJCOPY) -I binary -B i386 -O elf32-i386 $(BUILTIN_LAR) $@
58
59 builtin.lar: util/pbuilder/pbuilder
60         @rm -f $@
61         util/pbuilder/pbuilder -c $(PBUILDER_CONFIG) create $@
62
63 util/pbuilder/pbuilder:
64         $(MAKE) -C util/pbuilder
65
66 %.o: %.c
67         $(LPCC) $(CFLAGS) -c -o $@ $<
68
69 clean:
70         rm -f *.o bayou.elf builtin.lar
71         $(MAKE) -C util/pbuilder clean
72