Thomas Heijligen has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/74519 )
Change subject: Makefile: Build man-page only when sphinx is available ......................................................................
Makefile: Build man-page only when sphinx is available
Currently, it's not possible to compile the upstream branch using the `make' command without sphinx beeing installed.
Check if sphinx-build is installed and only then build or install the man-page.
The problem was noticed from commit f4f2f3dd19784efa26fd5619b7a44b4cdf14b04c move manpage to sphinx.
Change-Id: If1b81d9bc25ecac19d493b44b00a7c42d0643fe6 Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.com --- M Makefile M Makefile.include 2 files changed, 46 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/19/74519/1
diff --git a/Makefile b/Makefile index 0e16942..ec79963 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ RANLIB ?= ranlib PKG_CONFIG ?= pkg-config BUILD_DETAILS_FILE ?= build_details.txt +SPHINXBUILD ?= sphinx-build
# The following parameter changes the default programmer that will be used if there is no -p/--programmer # argument given when running flashrom. The predefined setting does not enable any default so that every @@ -259,6 +260,7 @@ HAS_LINUX_SPI := $(call c_compile_test, Makefile.d/linux_spi_test.c) HAS_LINUX_I2C := $(call c_compile_test, Makefile.d/linux_i2c_test.c) HAS_SERIAL := $(strip $(if $(filter $(TARGET_OS), DOS libpayload), no, yes)) +HAS_SPHINXBUILD := $(shell command -v $(SPHINXBUILD) &>/dev/null && echo yes || echo no) EXEC_SUFFIX := $(strip $(if $(filter $(TARGET_OS), DOS MinGW), .exe))
override CFLAGS += -Iinclude @@ -958,7 +960,7 @@ OBJS = $(CHIP_OBJS) $(PROGRAMMER_OBJS) $(LIB_OBJS)
-all: $(PROGRAM)$(EXEC_SUFFIX) man8/$(PROGRAM).8 +all: $(PROGRAM)$(EXEC_SUFFIX) $(if $(findstring $(HAS_SPHINXBUILD),yes), man8/$(PROGRAM).8) ifeq ($(ARCH), x86) @+$(MAKE) -C util/ich_descriptors_tool/ HOST_OS=$(HOST_OS) TARGET_OS=$(TARGET_OS) endif @@ -1019,6 +1021,7 @@ echo "The following features are unavailable on your machine: $(UNSUPPORTED_FEATURES)" \ exit 1; \ fi + @echo "Found "sphinx-build" to generate man-pages: $(HAS_SPHINXBUILD)"
%.o: %.c | config $(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_FLAGS) $(SCMDEF) -o $@ -c $< @@ -1030,9 +1033,13 @@ $(AR) rcs $@ $^ $(RANLIB) $@
-SPHINXBUILD ?= sphinx-build man8/$(PROGRAM).8: doc/* - @FLASHROM_VERSION=$(VERSION) $(SPHINXBUILD) -b man doc . + @if [ "$(HAS_SPHINXBUILD)" = "yes" ]; then \ + $(SPHINXBUILD) -Drelease=$(VERSION) -b man doc .; \ + else \ + echo "$(SPHINXBUILD) not found. Can't build man-page"; \ + exit 1; \ + fi
$(PROGRAM).bash: util/$(PROGRAM).bash-completion.tmpl @# Add to the bash completion file a list of enabled programmers. @@ -1049,20 +1056,28 @@ man8 .doctrees $(PROGRAM).bash $(BUILD_DETAILS_FILE) @+$(MAKE) -C util/ich_descriptors_tool/ clean
-install: $(PROGRAM)$(EXEC_SUFFIX) man8/$(PROGRAM).8 $(PROGRAM).bash +install: install-bin install-bash $(call install-man) + +install-bin: $(PROGRAM)$(EXEC_SUFFIX) mkdir -p $(DESTDIR)$(PREFIX)/sbin - mkdir -p $(DESTDIR)$(MANDIR)/man8 - mkdir -p $(DESTDIR)$(BASHCOMPDIR) $(INSTALL) -m 0755 $(PROGRAM)$(EXEC_SUFFIX) $(DESTDIR)$(PREFIX)/sbin - $(INSTALL) -m 0644 man8/$(PROGRAM).8 $(DESTDIR)$(MANDIR)/man8 + +install-bash: $(PROGRAM).bash + mkdir -p $(DESTDIR)$(BASHCOMPDIR) $(INSTALL) -m 0644 $(PROGRAM).bash $(DESTDIR)$(BASHCOMPDIR)
-libinstall: libflashrom.a include/libflashrom.h +install-man: man8/$(PROGRAM).8 + mkdir -p $(DESTDIR)$(MANDIR)/man8 + $(INSTALL) -m 0644 man8/$(PROGRAM).8 $(DESTDIR)$(MANDIR)/man8 + +install-lib: libflashrom.a include/libflashrom.h mkdir -p $(DESTDIR)$(PREFIX)/lib $(INSTALL) -m 0644 libflashrom.a $(DESTDIR)$(PREFIX)/lib mkdir -p $(DESTDIR)$(PREFIX)/include $(INSTALL) -m 0644 include/libflashrom.h $(DESTDIR)$(PREFIX)/include
+libinstall: install-lib + _export: man8/$(PROGRAM).8 @rm -rf "$(EXPORTDIR)/flashrom-$(RELEASENAME)" @mkdir -p "$(EXPORTDIR)/flashrom-$(RELEASENAME)" diff --git a/Makefile.include b/Makefile.include index a55f6f5..ee7f530 100644 --- a/Makefile.include +++ b/Makefile.include @@ -52,6 +52,10 @@ $(call debug_shell, $(if $(PKG_CONFIG_LIBDIR),PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR),) $(PKG_CONFIG) --modversion $1 2>/dev/null) endef
+define install-man +$(if $(findstring $(HAS_SPHINXBUILD),yes), install-man) +endef + define dependency_cflags $(call debug_shell, $(if $(PKG_CONFIG_LIBDIR),PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR),) $(PKG_CONFIG) --cflags $1 2>/dev/null) endef