modules-$(CONFIG_FLASHROM) += flashrom

flashrom_depends := pciutils $(musl_dep)

flashrom_version := 1776bb46ba6ea3d1ab2ec3f0cd88158aabed7400
flashrom_dir := flashrom-$(flashrom_version)
flashrom_tar := $(flashrom_dir).tar.gz
flashrom_url := https://github.com/flashrom/flashrom/archive/$(flashrom_version).tar.gz
flashrom_hash := 65e262ca4428a0ceddd73f481ed0d8444393b73a78469f266a4457dfc834ecb7

# Default options for flashrom
flashrom_cfg := \
	WARNERROR=no \
	CONFIG_NOTHING=yes \
	CONFIG_INTERNAL=yes \
	CONFIG_INTERNAL_X86=yes \

ifeq "$(CONFIG_TARGET_ARCH)" "ppc64"
flashrom_cfg := \
	WARNERROR=no \
	CONFIG_NOTHING=yes \
	CONFIG_LINUX_MTD=yes
endif

#Only enable AST1100 if requested per board configs
ifeq "$(CONFIG_FLASHROM_AST1100)" "y"
flashrom_cfg += CONFIG_AST1100=yes
endif

flashrom_target := \
	$(MAKE_JOBS) \
	CFLAGS="-Os -I$(INSTALL)/include/pci" \
	DESTDIR="$(INSTALL)" \
	INSTALL="$(INSTALL)" \
	LDFLAGS="-L$(INSTALL)/lib" \
	PREFIX="$(INSTALL)" \
	$(CROSS_TOOLS) \
	$(flashrom_cfg) \
	flashrom

flashrom_output := \
	flashrom

flashrom_libraries := \

flashrom_configure := 
