+TARGET_BUNDLES = $(abspath $(foreach bundle, $(BUNDLES),$(A2_OUTPUT)/$(shell dirname $(bundle))/$(A2_CATEGORY)/$(shell basename $(bundle)).$(major).$(minor).jar))
+TODOS = $(foreach bundle, $(BUNDLES),$(BUILD_BASE)/$(bundle)/to-build)
+# Native
+JNIDIRS=$(foreach package, $(NATIVE_PACKAGES), jni/$(package))
+
+# Needed in order to be able to expand $$ variables
+.SECONDEXPANSION:
+
+osgi: $(BUILD_BASE)/built $(MANIFESTS)
+
+# Actual build (compilation + bundle packaging)
+$(BUILD_BASE)/built : BUNDLES_TO_BUILD = $(strip $(subst $(abspath $(BUILD_BASE))/,, $(subst to-build,, $?)))
+$(BUILD_BASE)/built : $(TODOS)
+ @echo "| A2 category : $(A2_CATEGORY)"
+ @echo "| Bundles : $(BUNDLES_TO_BUILD)"
+ @echo "| Dependencies : $(DEP_CATEGORIES)"
+ @echo "| Compiler : $(notdir $(ECJ_JAR))"
+ @$(ARGEO_MAKE) \
+ all --a2-bases $(A2_BASE) --dep-categories $(DEP_CATEGORIES) \
+ --category $(A2_CATEGORY) --bundles $(BUNDLES_TO_BUILD)
+ @touch $(BUILD_BASE)/built
+
+$(A2_OUTPUT)/%.$(major).$(minor).jar : $(BUILD_BASE)/$$(subst $(A2_CATEGORY)/,,$$*)/to-build
+ $(ARGEO_MAKE) \
+ all --a2-bases $(A2_BASE) --dep-categories $(DEP_CATEGORIES) \
+ --category $(A2_CATEGORY) --bundles $(subst $(A2_CATEGORY)/,,$*)
+
+$(BUILD_BASE)/%/to-build : $$(shell find % -type f -not -path 'bin/*' -not -path '*/MANIFEST.MF' | sed 's/ /\\ /g')
+ @rm -rf $(dir $@)
+ @mkdir -p $(dir $@)
+ @touch $@
+
+## DISABLED
+# NO_MANIFEST_COPY generated MANIFESTs won't be copied to the source tree