Extract devmem-specific code to a separate file providing unified API. Move hexdump() and cbmem_print_entry() to common.c. Create common function for getting coreboot table entries. This can be adjusted later to use higher-level API that selects appropriate backend. BUG=b:391874512 TEST=cbmem -l; cbmem -x; cbmem -r 434f4e53; cbmem -t Change-Id: Ic11f0659833e03324f6909fa3c1d62c36988b7b7 Signed-off-by: Jakub Czapiga <czapiga@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/86557 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
43 lines
1.1 KiB
Makefile
43 lines
1.1 KiB
Makefile
##
|
|
## SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
PROGRAM = cbmem
|
|
TOP ?= $(abspath ../..)
|
|
ROOT = $(TOP)/src
|
|
COMMONLIB = $(ROOT)/commonlib
|
|
CC ?= $(CROSS_COMPILE)gcc
|
|
INSTALL ?= /usr/bin/env install
|
|
PREFIX ?= /usr/local
|
|
CFLAGS ?= -O2
|
|
WERROR=-Werror
|
|
CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wshadow $(WERROR)
|
|
CPPFLAGS += -I . -I $(ROOT)/commonlib/include -I $(ROOT)/commonlib/bsd/include
|
|
CPPFLAGS += -include $(ROOT)/commonlib/bsd/include/commonlib/bsd/compiler.h
|
|
|
|
OBJS = $(PROGRAM).o devmem_drv.o $(COMMONLIB)/bsd/ipchksum.o
|
|
|
|
all: $(PROGRAM)
|
|
|
|
$(PROGRAM): $(OBJS)
|
|
|
|
clean:
|
|
rm -f $(PROGRAM) $(OBJS:.c=.o) .dependencies *~ junit.xml
|
|
|
|
install: $(PROGRAM)
|
|
$(INSTALL) -d $(DESTDIR)$(PREFIX)/sbin/
|
|
$(INSTALL) cbmem $(DESTDIR)$(PREFIX)/sbin/
|
|
|
|
distclean: clean
|
|
|
|
.dependencies:
|
|
@$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .dependencies
|
|
|
|
help:
|
|
@echo "${PROGRAM}: View machine's cbmem contents"
|
|
@echo "Targets: all, clean, distclean, help, install"
|
|
@echo "To disable warnings as errors, run make as:"
|
|
@echo " make all WERROR=\"\""
|
|
|
|
.PHONY: all clean distclean install help
|
|
|
|
-include .dependencies
|