fx2/firmware/Makefile

34 lines
1.2 KiB
Makefile
Raw Normal View History

FW_DIRS = $(wildcard fw_*)
COMMON_DIRS = lib
PROJECT_DEFAULT = atlys
PROJECT_NAME ?= $(PROJECT_DEFAULT)
PROJECT_DIR = fw_$(PROJECT_NAME)
DIRS = $(COMMON_DIRS) $(PROJECT_DIR)
2013-10-02 10:43:54 +02:00
##### PRINT ###################################
PW=\033[1m\033[0m
GR=\E[40;32m
WH=\E[40;37m
B=\033[1m
pr_info = "$(B) $(GR)[$(1)]\t $(WH)$(2)$(PW)"
2013-10-02 10:43:54 +02:00
##### BUILD RULES #############################
.PHONY: help build clean build_all distclean
help:
@echo -e "$$ make PROJECT_NAME=<top-file> <rule>"
@echo -e "\tprojects (*=default) .. : $(shell echo $(FW_DIRS) | sed 's/fw_//g' | sed 's/$(PROJECT_DEFAULT)/\*$(PROJECT_DEFAULT)/')"
@echo -e "\trule .................. : help build clean build_all distclean"
build: $(DIRS)
@$(foreach dir,$^, echo -e $(call pr_info,MK,Building $(dir)); $(MAKE) -C $(dir) || exit 1;)
clean: $(DIRS)
@$(foreach dir,$^, echo -e $(call pr_info,MK,Cleaning $(dir)); $(MAKE) -C $(dir) clean || exit 1;)
build_all: $(COMMON_DIRS) $(FW_DIRS)
@$(foreach dir,$^, echo -e $(call pr_info,MK,Building $(dir)); $(MAKE) -C $(dir) || exit 1;)
distclean: $(COMMON_DIRS) $(FW_DIRS)
@$(foreach dir,$^, echo -e $(call pr_info,MK,Cleaning $(dir)); $(MAKE) -C $(dir) clean || exit 1;)