blob: 48f6d8655735fee33285b3e84a7118d57e02b6e1 [file] [log] [blame]
Patrick Georgi499fc922012-03-09 10:53:52 +01001##
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##
Patrick Georgi499fc922012-03-09 10:53:52 +010017
18OS_ARCH = $(shell uname)
19NVRAMTOOLFLAGS := -I$(top)/util/nvramtool
Patrick Georgi499fc922012-03-09 10:53:52 +010020ifeq ($(OS_ARCH), NetBSD)
Raymond Danksa2937142012-04-27 08:46:55 -060021NVRAMTOOLLDLFLAGS = -l$(shell uname -p)
22endif
Zheng Baob13e94c2012-09-28 16:02:35 +080023ifeq ($(shell uname -o 2>/dev/null), Cygwin)
Raymond Danksa2937142012-04-27 08:46:55 -060024NVRAMTOOLFLAGS += -O2 -g -Wall -W -D__GLIBC__
Raymond Danksa2937142012-04-27 08:46:55 -060025HOSTCFLAGS =
Patrick Georgi499fc922012-03-09 10:53:52 +010026endif
27
28nvramtoolobj :=
29nvramtoolobj += cli/nvramtool.o cli/opts.o
30nvramtoolobj += cmos_lowlevel.o cmos_ops.o common.o compute_ip_checksum.o
Vikram Narayanana8111cf2012-04-14 15:25:13 +053031nvramtoolobj += hexdump.o input_file.o layout.o accessors/layout-common.o accessors/layout-text.o accessors/layout-bin.o lbtable.o
Patrick Georgi44a89b32012-05-01 12:10:45 +020032nvramtoolobj += reg_expr.o cbfs.o accessors/cmos-mem.o
Patrick Georgi499fc922012-03-09 10:53:52 +010033
Zheng Bao54516722012-10-22 16:41:42 +080034ifeq ($(shell uname -s 2>/dev/null | cut -c-7), MINGW32)
35NVRAMTOOLLDFLAGS += -lregex -lwsock32
36nvramtoolobj += win32mmap.o
37endif
38
Patrick Georgi499fc922012-03-09 10:53:52 +010039$(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli:
40 mkdir -p $@
41
42$(objutil)/nvramtool/%.o: $(top)/util/nvramtool/%.c
43 printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
44 $(HOSTCC) $(NVRAMTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $<
45
46$(objutil)/nvramtool/nvramtool: $(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj))
47 printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
Raymond Danksa2937142012-04-27 08:46:55 -060048 $(HOSTCC) $(NVRAMTOOLFLAGS) -o $@ $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj)) $(NVRAMTOOLLDFLAGS)