-$(TOOLCHAIN_STAMP_DIR):
- mkdir -p $@
-
-$(STAGING_DIR):
- @mkdir -p $@/lib
- @mkdir -p $@/include
- @mkdir -p $@/$(REAL_GNU_TARGET_NAME)
- @ln -sf ../lib $@/$(REAL_GNU_TARGET_NAME)/lib
-
-$(TOOL_BUILD_DIR):
- @mkdir -p $@
-
-%-download: FORCE
- $(MAKE) -C $(patsubst %-download,%,$@) download
-
-%-prepare: $(TOOLCHAIN_STAMP_DIR) $(STAGING_DIR) $(TOOL_BUILD_DIR) FORCE
- @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
- $(MAKE) -C $(patsubst %-prepare,%,$@) prepare; \
- }
- @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
+ifneq ($(ARCH),)
+ $(TOOLCHAIN_DIR)/info.mk: .config
+ @for dir in $(TOOLCHAIN_DIR); do ( \
+ set -x; \
+ mkdir -p "$$dir"; \
+ cd "$$dir"; \
+ mkdir -p bin lib include stamp; \
+ ); done
+ @grep GCC_VERSION $@ >/dev/null 2>&1 || $(INSTALL_DATA) $(TOPDIR)/toolchain/info.mk $@
+ @touch $@
+endif