1a55dbf7e9
Commit f1e401c6cb
(util/cbfstool/flashmap/fmap.c: fix fmaptool
endianness bugs on BE) makes use of endianness conversion macros
in cbfstool's FMAP code, which is also used by ifdtool. At least
on Linux, the <endian.h> header provides these helpers, but only
when `__USE_MISC` is defined, which is defined in the <ctypes.h>
header when `_DEFAULT_SOURCE` is defined. This was accounted for
in `Makefile.inc`, but not in `Makefile`. As a result, trying to
build ifdtool as a standalone tool (i.e. not as part of building
a coreboot image) results in build errors because the endianness
conversion macros are not defined.
Define `_DEFAULT_SOURCE` in `Makefile` to fix the build errors.
Change-Id: I8c2bbc07ddd87d885e2d6f5c7f2bd501e5c4e3b0
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59663
Reviewed-by: Patrick Georgi <patrick@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
44 lines
998 B
Makefile
44 lines
998 B
Makefile
# ifdtool - dump Intel Firmware Descriptor information
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
PROGRAM = ifdtool
|
|
|
|
CC ?= gcc
|
|
INSTALL = /usr/bin/env install
|
|
PREFIX = /usr/local
|
|
CFLAGS = -O2 -g -Wall -Wextra -Wmissing-prototypes -Werror
|
|
CFLAGS += -I../../src/commonlib/include -I../../src/commonlib/bsd/include
|
|
CFLAGS += -I../cbfstool/flashmap
|
|
CFLAGS += -include ../../src/commonlib/bsd/include/commonlib/bsd/compiler.h
|
|
CFLAGS += -D_DEFAULT_SOURCE # for endianness converting functions
|
|
LDFLAGS =
|
|
|
|
OBJS = ifdtool.o
|
|
OBJS += fmap.o
|
|
OBJS += kv_pair.o
|
|
OBJS += valstr.o
|
|
|
|
all: dep $(PROGRAM)
|
|
|
|
$(PROGRAM): $(OBJS)
|
|
$(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
|
|
|
|
clean:
|
|
rm -f $(PROGRAM) *.o *~ .dependencies
|
|
distclean: clean
|
|
|
|
dep:
|
|
@$(CC) $(CFLAGS) -MM *.c > .dependencies
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
%.o: ../cbfstool/flashmap/%.c
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
install: $(PROGRAM)
|
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
|
$(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/bin
|
|
|
|
.PHONY: all clean distclean dep
|