Patrick Georgi | 499fc92 | 2012-03-09 10:53:52 +0100 | [diff] [blame] | 1 | ## |
| 2 | ## Integration of nvramtool into the coreboot build system |
| 3 | ## |
| 4 | ## (C) 2005-2008 coresystems GmbH |
| 5 | ## written by Stefan Reinauer <stepan@coresystems.de> |
| 6 | ## (C) 2012 secunet Security Networks AG |
| 7 | ## |
| 8 | ## This program is free software; you can redistribute it and/or modify |
| 9 | ## it under the terms of the GNU General Public License as published by |
| 10 | ## the Free Software Foundation; version 2 of the License. |
| 11 | ## |
| 12 | ## This program is distributed in the hope that it will be useful, |
| 13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | ## GNU General Public License for more details. |
| 16 | ## |
| 17 | ## You should have received a copy of the GNU General Public License |
| 18 | ## along with this program; if not, write to the Free Software |
Paul Menzel | a46a712 | 2013-02-23 18:37:27 +0100 | [diff] [blame] | 19 | ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Patrick Georgi | 499fc92 | 2012-03-09 10:53:52 +0100 | [diff] [blame] | 20 | ## |
| 21 | |
| 22 | OS_ARCH = $(shell uname) |
| 23 | NVRAMTOOLFLAGS := -I$(top)/util/nvramtool |
Patrick Georgi | 499fc92 | 2012-03-09 10:53:52 +0100 | [diff] [blame] | 24 | ifeq ($(OS_ARCH), NetBSD) |
Raymond Danks | a293714 | 2012-04-27 08:46:55 -0600 | [diff] [blame] | 25 | NVRAMTOOLLDLFLAGS = -l$(shell uname -p) |
| 26 | endif |
Zheng Bao | b13e94c | 2012-09-28 16:02:35 +0800 | [diff] [blame] | 27 | ifeq ($(shell uname -o 2>/dev/null), Cygwin) |
Raymond Danks | a293714 | 2012-04-27 08:46:55 -0600 | [diff] [blame] | 28 | NVRAMTOOLFLAGS += -O2 -g -Wall -W -D__GLIBC__ |
Raymond Danks | a293714 | 2012-04-27 08:46:55 -0600 | [diff] [blame] | 29 | HOSTCFLAGS = |
Patrick Georgi | 499fc92 | 2012-03-09 10:53:52 +0100 | [diff] [blame] | 30 | endif |
| 31 | |
| 32 | nvramtoolobj := |
| 33 | nvramtoolobj += cli/nvramtool.o cli/opts.o |
| 34 | nvramtoolobj += cmos_lowlevel.o cmos_ops.o common.o compute_ip_checksum.o |
Vikram Narayanan | a8111cf | 2012-04-14 15:25:13 +0530 | [diff] [blame] | 35 | nvramtoolobj += hexdump.o input_file.o layout.o accessors/layout-common.o accessors/layout-text.o accessors/layout-bin.o lbtable.o |
Patrick Georgi | 44a89b3 | 2012-05-01 12:10:45 +0200 | [diff] [blame] | 36 | nvramtoolobj += reg_expr.o cbfs.o accessors/cmos-mem.o |
Patrick Georgi | 499fc92 | 2012-03-09 10:53:52 +0100 | [diff] [blame] | 37 | |
Zheng Bao | 5451672 | 2012-10-22 16:41:42 +0800 | [diff] [blame] | 38 | ifeq ($(shell uname -s 2>/dev/null | cut -c-7), MINGW32) |
| 39 | NVRAMTOOLLDFLAGS += -lregex -lwsock32 |
| 40 | nvramtoolobj += win32mmap.o |
| 41 | endif |
| 42 | |
Patrick Georgi | 499fc92 | 2012-03-09 10:53:52 +0100 | [diff] [blame] | 43 | $(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli: |
| 44 | mkdir -p $@ |
| 45 | |
| 46 | $(objutil)/nvramtool/%.o: $(top)/util/nvramtool/%.c |
| 47 | printf " HOSTCC $(subst $(objutil)/,,$(@))\n" |
| 48 | $(HOSTCC) $(NVRAMTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $< |
| 49 | |
| 50 | $(objutil)/nvramtool/nvramtool: $(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj)) |
| 51 | printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" |
Raymond Danks | a293714 | 2012-04-27 08:46:55 -0600 | [diff] [blame] | 52 | $(HOSTCC) $(NVRAMTOOLFLAGS) -o $@ $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj)) $(NVRAMTOOLLDFLAGS) |
Patrick Georgi | 499fc92 | 2012-03-09 10:53:52 +0100 | [diff] [blame] | 53 | |
| 54 | |