2 ## Integration of nvramtool into the coreboot build system
4 ## (C) 2005-2008 coresystems GmbH
5 ## written by Stefan Reinauer <stepan@coresystems.de>
6 ## (C) 2012 secunet Security Networks AG
8 ## SPDX-License-Identifier: GPL-2.0-only
10 OS_ARCH = $(shell uname)
11 NVRAMTOOLFLAGS := -I$(top)/util/nvramtool
12 ifeq ($(OS_ARCH), NetBSD)
13 NVRAMTOOLLDLFLAGS = -l$(shell uname -p)
15 ifeq ($(shell uname -o 2>/dev/null), Cygwin)
16 NVRAMTOOLFLAGS += -O2 -g -Wall -W -D__GLIBC__
21 nvramtoolobj += cli/nvramtool.o cli/opts.o
22 nvramtoolobj += cmos_lowlevel.o cmos_ops.o common.o compute_ip_checksum.o
23 nvramtoolobj += hexdump.o input_file.o layout.o accessors/layout-common.o accessors/layout-text.o accessors/layout-bin.o lbtable.o
24 nvramtoolobj += reg_expr.o cbfs.o accessors/cmos-mem.o
26 ifeq ($(shell uname -s 2>/dev/null | cut -c-7), MINGW32)
27 NVRAMTOOLLDFLAGS += -lregex -lwsock32
28 nvramtoolobj += win32mmap.o
31 additional-dirs += $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli
33 $(objutil)/nvramtool/%.o: $(top)/util/nvramtool/%.c
34 printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
35 $(HOSTCC) $(NVRAMTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $<
37 $(objutil)/nvramtool/nvramtool: $(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj))
38 printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
39 $(HOSTCC) $(NVRAMTOOLFLAGS) -o $@ $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj)) $(NVRAMTOOLLDFLAGS)