94 lines
2.2 KiB
Makefile
94 lines
2.2 KiB
Makefile
#! /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 -Wa,--dsp
|
|
cflags += $(VXSDK_CFLAGS_INCLUDE) -Iinclude
|
|
|
|
# debug vars
|
|
VERBOSE ?= true
|
|
|
|
#
|
|
# build rules
|
|
#
|
|
|
|
GravityDuck: $(obj)
|
|
@ printf "$(blue)Create $(red)$@$(nocolor)\n"
|
|
sh-elf-vhex-gcc \
|
|
-T $(VXSDK_PREFIX_LIB)/fxcg50.ld \
|
|
-Wl,-q -Wl,-Map=$(VXSDK_PREFIX_BUILD)/map \
|
|
$(VXSDK_CFLAGS_LINK) \
|
|
-o $@ $^ \
|
|
-Wl,--whole-archive -lvhex-fxcg50 \
|
|
-Wl,--no-whole-archive -lc -lgcc
|
|
#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:
|
|
ifneq ($(VERBOSE),false)
|
|
@ 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)/%
|
|
ifneq ($(VERBOSE),false)
|
|
@ 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
|