$(eval $(call addlib_s,libukstore,$(CONFIG_LIBUKSTORE)))
-$(call mk_sub_libbuild_dir,libukstore,include/uk/bits)
-
-LIBUKSTORE_GEN_INCLUDES_PATH := $(call sub_libbuild_dir,libukstore,include)
-
CINCLUDES-y += -I$(LIBUKSTORE_BASE)/include
-CINCLUDES-$(CONFIG_LIBUKSTORE) += -I$(LIBUKSTORE_GEN_INCLUDES_PATH)
+CINCLUDES-$(CONFIG_LIBUKSTORE) += -I$(LIBUKSTORE_BUILD)/include
CXXINCLUDES-y += -I$(LIBUKSTORE_BASE)/include
-CXXINCLUDES-$(CONFIG_LIBUKSTORE) += -I$(LIBUKSTORE_GEN_INCLUDES_PATH)
-
-LIBUKSTORE_PHONY_SRC := $(LIBUKSTORE_BUILD)/uk_libs.in
-LIBUKSTORE_PHONY_SRC_NEW := $(addsuffix .new, $(LIBUKSTORE_PHONY_SRC))
-
-LIBUKSTORE_GEN_SRC := $(LIBUKSTORE_GEN_INCLUDES_PATH)/uk/bits/store_libs.h
-LIBUKSTORE_GEN_ARR := $(LIBUKSTORE_GEN_INCLUDES_PATH)/uk/bits/store_array.h
-LIBUKSTORE_GEN_LD := $(LIBUKSTORE_BUILD)/store_libs.lds.S
-
-UK_PREPROCESS-$(CONFIG_LIBUKSTORE) += $(LIBUKSTORE_PHONY_SRC) $(LIBUKSTORE_GEN_SRC) $(LIBUKSTORE_GEN_LD) $(LIBUKSTORE_GEN_ARR)
-
-$(LIBUKSTORE_PHONY_SRC): %: %.new
- @cmp -s $^ $@; if [ $$? -ne 0 ]; then cp $^ $@; fi
-
-$(LIBUKSTORE_BUILD)/uk_libs.in.new:
- $(call build_cmd,GEN,libukstore,$(notdir $@), \
- echo $(foreach P,$(UK_PLATS) $(UK_PLATS-y),\
- $(if $(call qstrip,$($(call uc,$(P))_LIBS) $($(call uc,$(P))_LIBS-y)),\
- $(foreach L,$($(call uc,$(P))_LIBS) $($(call uc,$(P))_LIBS-y), \
- $(if $(call qstrip,$($(call vprefix_lib,$(L),SRCS)) $($(call vprefix_lib,$(L),SRCS-y))), \
- $(L) \
- )))) \
- $(UK_LIBS) $(UK_LIBS-y) \
- | tr ' ' '\n' > $@)
-
-$(LIBUKSTORE_GEN_INCLUDES_PATH)/uk/bits/store_libs.h: $(LIBUKSTORE_BASE)/gen_libs.h.awk $(LIBUKSTORE_BUILD)/uk_libs.in
- $(call build_cmd,AWK,libukstore,$(notdir $@), \
- $(AWK) -F '-' -f $(LIBUKSTORE_BASE)/gen_libs.h.awk \
- $(LIBUKSTORE_BUILD)/uk_libs.in > $@)
-
-$(LIBUKSTORE_BUILD)/store_libs.lds.S: $(LIBUKSTORE_BASE)/gen_libs.ld.awk $(LIBUKSTORE_BUILD)/uk_libs.in
- $(call build_cmd,AWK,libukstore,$(notdir $@), \
- $(AWK) -F '-' -f $(LIBUKSTORE_BASE)/gen_libs.ld.awk \
- $(LIBUKSTORE_BUILD)/uk_libs.in > $@)
-
-$(LIBUKSTORE_GEN_INCLUDES_PATH)/uk/bits/store_array.h: $(LIBUKSTORE_BASE)/gen_array.h.awk $(LIBUKSTORE_BUILD)/uk_libs.in
- $(call build_cmd,AWK,libukstore,$(notdir $@), \
- $(AWK) -F '-' -f $(LIBUKSTORE_BASE)/gen_array.h.awk \
- $(LIBUKSTORE_BUILD)/uk_libs.in > $@)
-
+CXXINCLUDES-$(CONFIG_LIBUKSTORE) += -I$(LIBUKSTORE_BUILD)/include
+
+# Cross-reference libraries catalog generated by lib/uklibid
+# NOTE: Normally, we do not consider such cross-referencing a good practice,
+# since libraries.in is in a way internal to lib/uklibid.
+# On the other hand, it somehow doesn't make sense to create the same file
+# again for this library, so we opt for deduplication here.
+LIBUKSTORE_LIBRARIES_IN = $(call sub_build_dir,libuklibid)/libraries.in
+
+LIBUKSTORE_SRCS-y += $(LIBUKSTORE_BASE)/store_libs.awk>.h
+LIBUKSTORE_STORE_LIBS_SUBBUILD = include/uk/bits
+LIBUKSTORE_STORE_LIBS_AWKINCLUDES-y += $(LIBUKSTORE_LIBRARIES_IN)
+LIBUKSTORE_SRCS-y += $(LIBUKSTORE_BASE)/store_array.awk>.h
+LIBUKSTORE_STORE_ARRAY_SUBBUILD = include/uk/bits
+LIBUKSTORE_STORE_ARRAY_AWKINCLUDES-y += $(LIBUKSTORE_LIBRARIES_IN)
+LIBUKSTORE_SRCS-y += $(LIBUKSTORE_BASE)/store_ld.awk>.lds.S
+LIBUKSTORE_STORE_LD_AWKINCLUDES-y += $(LIBUKSTORE_LIBRARIES_IN)
LIBUKSTORE_SRCS-y += $(LIBUKSTORE_BASE)/store.c
-LIBUKSTORE_SRCS-y += $(LIBUKSTORE_BUILD)/store_libs.lds.S
-
-LIBUKSTORE_CLEAN = $(LIBUKSTORE_PHONY_SRC) $(LIBUKSTORE_PHONY_SRC_NEW)