#! /usr/bin/make -f # # variable definition # # color definition, for swagg :D red := \033[1;31m green := \033[1;32m blue := \033[1;34m white := \033[1;37m nocolor := \033[1;0m src := $(foreach path,\ $(shell find src -not -path "*/\.*" -type d), \ $(wildcard $(path)/*.c) \ $(wildcard $(path)/*.S) \ $(wildcard $(path)/*.s)) obj := $(patsubst src_%,$(VXSDK_PREFIX_BUILD)/%.o,$(subst /,_,$(src))) obj += $(patsubst \ $(VXSDK_ASSETS_SRC)/%,\ $(VXSDK_ASSETS_BUILD)/%.o,\ $(wildcard $(VXSDK_ASSETS_SRC)/*.c) \ ) cflags := -ffreestanding -nostdlib -m4-nofpu -fPIE -O1 cflags += -mb -fstrict-volatile-bitfields cflags += $(VXSDK_CFLAGS_INCLUDE) -I.. -Iinclude # debug vars VERBOSE ?= false # # build rules # vxaddin: $(obj) @ printf "$(blue)Create $(red)$@$(nocolor)\n" sh-elf-vhex-gcc \ -T $(VXSDK_PREFIX_LIB)/fxcg50-dynamic.ld -Wl,-q -Wl,-M \ $(VXSDK_CFLAGS_LINK) \ -o $@ $^ \ -lvhex-fxcg50 -lc -lgcc \ > $(VXSDK_PREFIX_BUILD)/map.txt vxsdk conv addin -b $@ -n vxaddin -o /tmp/vxaddin version: @echo "$(VXSDK_PKG_VERSION)" help: @ echo 'Rules listing:' @ echo '... all the default, if no target is provided' @ echo '... clean remove build object' @ echo '... fclean remove all generated object' @ echo '... re same as `make fclean all`' @ echo '... version display version' @ echo '... install install the library' @ echo '... uninstall uninstall the library' .PHONY: help version # # Object rules # $(VXSDK_PREFIX_BUILD)%.o: ifeq ($(VERBOSE),true) @ mkdir -p $(dir $@) sh-elf-vhex-gcc \ $(cflags) -D FXCG50 \ -o $@ \ -c $(addprefix src/,$(subst _,/,$(notdir $(basename $@)))) else @ mkdir -p $(dir $@) @ printf "$(green)>$(nocolor) $(white)$@$(nocolor)\n" @ sh-elf-vhex-gcc \ $(cflags) -D FXCG50 \ -o $@ \ -c $(addprefix src/,$(subst _,/,$(notdir $(basename $@)))) endif $(VXSDK_ASSETS_BUILD)%.o: $(VXSDK_ASSETS_SRC)/% ifeq ($(VERBOSE),true) @ mkdir -p $(dir $@) sh-elf-vhex-gcc $(cflags) -D FXCG50 -o $@ -c $< else @ mkdir -p $(dir $@) @ printf "$(green)>$(nocolor) $(white)$@$(nocolor)\n" @ sh-elf-vhex-gcc $(cflags) -D FXCG50 -o $@ -c $< endif