1
0

package-bin.mk 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Copyright (C) 2007-2020 OpenWrt.org
  4. ifeq ($(DUMP),)
  5. define BuildTarget/bin
  6. TARGET_VARIANT=$(if $(ALL_VARIANTS),$(if $(VARIANT),$(filter-out *,$(VARIANT)),$(firstword $(ALL_VARIANTS))))
  7. ifeq ($(if $(TARGET_VARIANT),$(BUILD_VARIANT)),$(TARGET_VARIANT))
  8. ifdef Package/$(1)/install
  9. ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
  10. $(_pkg_target)compile: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
  11. compile: install-bin-$(1)
  12. else
  13. compile: $(1)-disabled
  14. $(1)-disabled:
  15. @echo "WARNING: skipping $(1) -- package not selected" >&2
  16. endif
  17. endif
  18. endif
  19. $(PKG_BUILD_DIR)/.pkgdir/$(1).installed: $(STAMP_BUILT)
  20. rm -rf $(PKG_BUILD_DIR)/.pkgdir/$(1) $$@
  21. mkdir -p $(PKG_BUILD_DIR)/.pkgdir/$(1)
  22. $(call Package/$(1)/install,$(PKG_BUILD_DIR)/.pkgdir/$(1))
  23. touch $$@
  24. install-bin-$(1): $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
  25. rm -rf $(BIN_DIR)/$(1)
  26. -rmdir $(PKG_BUILD_DIR)/.pkgdir/$(1) >/dev/null 2>/dev/null
  27. if [ -d $(PKG_BUILD_DIR)/.pkgdir/$(1) ]; then \
  28. $(INSTALL_DIR) $(BIN_DIR)/$(1) && \
  29. $(CP) $(PKG_BUILD_DIR)/.pkgdir/$(1)/. $(BIN_DIR)/$(1)/; \
  30. fi
  31. clean-$(1):
  32. rm -rf $(BIN_DIR)/$(1)
  33. clean: clean-$(1)
  34. .PHONY: install-bin-$(1)
  35. endef
  36. endif