library.mk 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ifeq ($(_THEOS_RULES_LOADED),)
  2. include $(THEOS_MAKE_PATH)/rules.mk
  3. endif
  4. .PHONY: internal-library-all_ internal-library-stage_ internal-library-compile
  5. LOCAL_INSTALL_PATH ?= $(strip $($(THEOS_CURRENT_INSTANCE)_INSTALL_PATH))
  6. ifeq ($(LOCAL_INSTALL_PATH),)
  7. LOCAL_INSTALL_PATH = /usr/lib
  8. endif
  9. _LOCAL_LIBRARY_EXTENSION = $(or $($(THEOS_CURRENT_INSTANCE)_LIBRARY_EXTENSION),$(TARGET_LIB_EXT))
  10. ifeq ($(_LOCAL_LIBRARY_EXTENSION),-)
  11. _LOCAL_LIBRARY_EXTENSION =
  12. endif
  13. _THEOS_INTERNAL_LDFLAGS += $(call TARGET_LDFLAGS_DYNAMICLIB,$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION))
  14. _THEOS_INTERNAL_CFLAGS += $(TARGET_CFLAGS_DYNAMICLIB)
  15. ifeq ($(_THEOS_MAKE_PARALLEL_BUILDING), no)
  16. internal-library-all_:: $(_OBJ_DIR_STAMPS) $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION)
  17. else
  18. internal-library-all_:: $(_OBJ_DIR_STAMPS)
  19. $(ECHO_NOTHING)$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) --no-print-directory --no-keep-going \
  20. internal-library-compile \
  21. _THEOS_CURRENT_TYPE=$(_THEOS_CURRENT_TYPE) THEOS_CURRENT_INSTANCE=$(THEOS_CURRENT_INSTANCE) _THEOS_CURRENT_OPERATION=compile \
  22. THEOS_BUILD_DIR="$(THEOS_BUILD_DIR)" _THEOS_MAKE_PARALLEL=yes$(ECHO_END)
  23. internal-library-compile: $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION)
  24. endif
  25. $(eval $(call _THEOS_TEMPLATE_DEFAULT_LINKING_RULE,$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION)))
  26. ifneq ($($(THEOS_CURRENT_INSTANCE)_INSTALL),0)
  27. internal-library-stage_::
  28. $(ECHO_NOTHING)mkdir -p "$(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/"$(ECHO_END)
  29. $(ECHO_NOTHING)cp $(THEOS_OBJ_DIR)/$(THEOS_CURRENT_INSTANCE)$(_LOCAL_LIBRARY_EXTENSION) "$(THEOS_STAGING_DIR)$(LOCAL_INSTALL_PATH)/"$(ECHO_END)
  30. endif
  31. $(eval $(call __mod,instance/library.mk))