# $FreeWRT$
#-
# This file is part of the FreeWRT project. FreeWRT is copyrighted
# material, please see the LICENCE file in the top-level directory
# or at http://www.freewrt.org/license for details.

include $(TOPDIR)/rules.mk
include $(TOPDIR)/mk/targets.mk

all: install

$(BIN_DIR):
	mkdir -p $(BIN_DIR)

linux-compile: 
linux-install: $(BIN_DIR)

prepare: linux-prepare
compile: linux-compile
install: image_clean linux-install image_install
clean: linux-clean image_clean

image_clean:
	rm -f $(BIN_DIR)/freewrt-*

image_install:
	$(MAKE) -C image/$(BOARD) install-prepare
	$(MAKE) -C image/$(BOARD) install

%-clean:
	@$(TRACE) target/$(patsubst %-clean,%,$@)-clean
	$(MAKE) -C $(patsubst %-clean,%,$@) clean
%-prepare:
	@$(TRACE) target/$(patsubst %-prepare,%,$@)-prepare
	$(MAKE) -C $(patsubst %-prepare,%,$@) prepare
%-compile: %-prepare
	@$(TRACE) target/$(patsubst %-compile,%,$@)-compile
	$(MAKE) -C $(patsubst %-compile,%,$@) compile
%-rebuild: 
	@$(TRACE) target/$(patsubst %-rebuild,%,$@)-rebuild
	$(MAKE) -C $(patsubst %-rebuild,%,$@) rebuild
%-install: %-compile
	@$(TRACE) target/$(patsubst %-install,%,$@)-install
	$(MAKE) -C $(patsubst %-install,%,$@) install
