blob: 7a4b08b484291999b7382dc61ad09004dc38246f [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##
Uwe Hermann7eb845e2008-11-02 17:01:06 +000015
16CONFIG_LZMA=y
17CONFIG_NRV2B=y
18CONFIG_BUILTIN_LAR=y
19
20PBUILDER_CONFIG=bayou.xml
21BUILTIN_LAR=builtin.lar
22
Martin Roth6116f362016-03-08 12:32:40 -070023export src := $(CURDIR)
Stefan Reinauer7b769122010-04-20 23:04:46 +000024export obj := $(src)/build
Uwe Hermann7eb845e2008-11-02 17:01:06 +000025
Stefan Reinauer7b769122010-04-20 23:04:46 +000026LIBPAYLOAD_DIR := $(obj)/libpayload
27
28CC?=gcc
29STRIP?=strip
30OBJCOPY?=objcopy
Uwe Hermann7eb845e2008-11-02 17:01:06 +000031
32FFLAGS-y=
33FFLAGS-$(CONFIG_BUILTIN_LAR) += -DCONFIG_BUILTIN_LAR
34FFLAGS-$(CONFIG_LZMA) += -DCONFIG_LZMA
35FFLAGS-$(CONFIG_NRV2B) += -DCONFIG_NRV2B
36
37OBJECTS-y=main.o payload.o config.o menu.o self.o
38OBJECTS-$(CONFIG_LZMA) += lzma.o
39OBJECTS-$(CONFIG_NRV2B) += nrv2b.o
40OBJECTS-$(CONFIG_BUILTIN_LAR) += builtin-lar.o
41
42CFLAGS= -Wall -Werror -Os $(FFLAGS-y)
43LDFLAGS=-Wl,-T,bayou.ldscript -static
44LIBGCC=$(shell $(CC) -m32 -print-libgcc-file-name)
45
46LPCC=$(LIBPAYLOAD_DIR)/bin/lpgcc
47
48bayou.elf: $(OBJECTS-y)
Uwe Hermann54c52762008-11-02 17:48:20 +000049 $(LPCC) $(LDFLAGS) -m32 -o $@ $(OBJECTS-y)
Stefan Reinauer7b769122010-04-20 23:04:46 +000050 @$(STRIP) $@
Uwe Hermann7eb845e2008-11-02 17:01:06 +000051
52builtin-lar.o: $(BUILTIN_LAR)
Stefan Reinauer7b769122010-04-20 23:04:46 +000053 @$(OBJCOPY) -I binary -B i386 -O elf32-i386 $(BUILTIN_LAR) $@
Uwe Hermann7eb845e2008-11-02 17:01:06 +000054
55builtin.lar: util/pbuilder/pbuilder
Stefan Reinauer7b769122010-04-20 23:04:46 +000056 @rm -f $@
Uwe Hermann7eb845e2008-11-02 17:01:06 +000057 util/pbuilder/pbuilder -c $(PBUILDER_CONFIG) create $@
58
59util/pbuilder/pbuilder:
Stefan Reinauer7b769122010-04-20 23:04:46 +000060 $(MAKE) -C util/pbuilder
Uwe Hermann7eb845e2008-11-02 17:01:06 +000061
62%.o: %.c
Uwe Hermann54c52762008-11-02 17:48:20 +000063 $(LPCC) $(CFLAGS) -c -o $@ $<
Uwe Hermann7eb845e2008-11-02 17:01:06 +000064
65clean:
66 rm -f *.o bayou.elf builtin.lar
Stefan Reinauer7b769122010-04-20 23:04:46 +000067 $(MAKE) -C util/pbuilder clean