openwrt/tools/ninja/Makefile
Michael Pratt df303c7ef4 tools/ninja: use existing ninja to build ninja
Add methods to skip the building and execution of Ninja by python
in order to allow Make to execute Ninja after the configure script.

This allows the user to build Ninja only once
if they already have an older version of Ninja built.

It also allows the user to test the jobserver functionality
by having Ninja built twice (clean then compile).

Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/16693
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-10-14 13:58:44 +02:00

37 lines
845 B
Makefile

include $(TOPDIR)/rules.mk
PKG_NAME:=ninja
PKG_VERSION:=1.11.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/ninja-build/ninja/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=31747ae633213f1eda3842686f83c2aa1412e0f5691d1c14dbbcc67fe7400cea
include $(INCLUDE_DIR)/host-build.mk
define Host/Configure
cd $(HOST_BUILD_DIR) && \
$(HOST_MAKE_VARS) \
CXX="$(HOSTCXX_NOCACHE)" \
$(STAGING_DIR_HOST)/bin/$(PYTHON) configure.py \
$(if $(shell $(STAGING_DIR_HOST)/bin/ninja --version),,--bootstrap) \
--no-rebuild \
--verbose
-$(Host/Install)
endef
define Host/Compile
+$(NINJA) -C $(HOST_BUILD_DIR)
endef
define Host/Install
$(INSTALL_BIN) $(HOST_BUILD_DIR)/ninja $(STAGING_DIR_HOST)/bin/
endef
define Host/Clean
rm -f $(STAGING_DIR_HOST)/bin/ninja
endef
$(eval $(call HostBuild))