Uwe Hermann | 7eb845e | 2008-11-02 17:01:06 +0000 | [diff] [blame] | 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 | ## |
Uwe Hermann | 7eb845e | 2008-11-02 17:01:06 +0000 | [diff] [blame] | 15 | |
| 16 | CONFIG_LZMA=y |
| 17 | CONFIG_NRV2B=y |
| 18 | CONFIG_BUILTIN_LAR=y |
| 19 | |
| 20 | PBUILDER_CONFIG=bayou.xml |
| 21 | BUILTIN_LAR=builtin.lar |
| 22 | |
Martin Roth | 6116f36 | 2016-03-08 12:32:40 -0700 | [diff] [blame] | 23 | export src := $(CURDIR) |
Stefan Reinauer | 7b76912 | 2010-04-20 23:04:46 +0000 | [diff] [blame] | 24 | export obj := $(src)/build |
Uwe Hermann | 7eb845e | 2008-11-02 17:01:06 +0000 | [diff] [blame] | 25 | |
Stefan Reinauer | 7b76912 | 2010-04-20 23:04:46 +0000 | [diff] [blame] | 26 | LIBPAYLOAD_DIR := $(obj)/libpayload |
| 27 | |
| 28 | CC?=gcc |
| 29 | STRIP?=strip |
| 30 | OBJCOPY?=objcopy |
Uwe Hermann | 7eb845e | 2008-11-02 17:01:06 +0000 | [diff] [blame] | 31 | |
| 32 | FFLAGS-y= |
| 33 | FFLAGS-$(CONFIG_BUILTIN_LAR) += -DCONFIG_BUILTIN_LAR |
| 34 | FFLAGS-$(CONFIG_LZMA) += -DCONFIG_LZMA |
| 35 | FFLAGS-$(CONFIG_NRV2B) += -DCONFIG_NRV2B |
| 36 | |
| 37 | OBJECTS-y=main.o payload.o config.o menu.o self.o |
| 38 | OBJECTS-$(CONFIG_LZMA) += lzma.o |
| 39 | OBJECTS-$(CONFIG_NRV2B) += nrv2b.o |
| 40 | OBJECTS-$(CONFIG_BUILTIN_LAR) += builtin-lar.o |
| 41 | |
| 42 | CFLAGS= -Wall -Werror -Os $(FFLAGS-y) |
| 43 | LDFLAGS=-Wl,-T,bayou.ldscript -static |
| 44 | LIBGCC=$(shell $(CC) -m32 -print-libgcc-file-name) |
| 45 | |
| 46 | LPCC=$(LIBPAYLOAD_DIR)/bin/lpgcc |
| 47 | |
| 48 | bayou.elf: $(OBJECTS-y) |
Uwe Hermann | 54c5276 | 2008-11-02 17:48:20 +0000 | [diff] [blame] | 49 | $(LPCC) $(LDFLAGS) -m32 -o $@ $(OBJECTS-y) |
Stefan Reinauer | 7b76912 | 2010-04-20 23:04:46 +0000 | [diff] [blame] | 50 | @$(STRIP) $@ |
Uwe Hermann | 7eb845e | 2008-11-02 17:01:06 +0000 | [diff] [blame] | 51 | |
| 52 | builtin-lar.o: $(BUILTIN_LAR) |
Stefan Reinauer | 7b76912 | 2010-04-20 23:04:46 +0000 | [diff] [blame] | 53 | @$(OBJCOPY) -I binary -B i386 -O elf32-i386 $(BUILTIN_LAR) $@ |
Uwe Hermann | 7eb845e | 2008-11-02 17:01:06 +0000 | [diff] [blame] | 54 | |
| 55 | builtin.lar: util/pbuilder/pbuilder |
Stefan Reinauer | 7b76912 | 2010-04-20 23:04:46 +0000 | [diff] [blame] | 56 | @rm -f $@ |
Uwe Hermann | 7eb845e | 2008-11-02 17:01:06 +0000 | [diff] [blame] | 57 | util/pbuilder/pbuilder -c $(PBUILDER_CONFIG) create $@ |
| 58 | |
| 59 | util/pbuilder/pbuilder: |
Stefan Reinauer | 7b76912 | 2010-04-20 23:04:46 +0000 | [diff] [blame] | 60 | $(MAKE) -C util/pbuilder |
Uwe Hermann | 7eb845e | 2008-11-02 17:01:06 +0000 | [diff] [blame] | 61 | |
| 62 | %.o: %.c |
Uwe Hermann | 54c5276 | 2008-11-02 17:48:20 +0000 | [diff] [blame] | 63 | $(LPCC) $(CFLAGS) -c -o $@ $< |
Uwe Hermann | 7eb845e | 2008-11-02 17:01:06 +0000 | [diff] [blame] | 64 | |
| 65 | clean: |
| 66 | rm -f *.o bayou.elf builtin.lar |
Stefan Reinauer | 7b76912 | 2010-04-20 23:04:46 +0000 | [diff] [blame] | 67 | $(MAKE) -C util/pbuilder clean |