2019-08-28 15:29:06 +02:00
|
|
|
# fxengine makefile
|
|
|
|
# fxengine needs gint (@Lephenixnoir)
|
|
|
|
|
2019-08-31 13:58:33 +02:00
|
|
|
target ?= sh3eb-elf
|
2019-08-29 15:22:38 +02:00
|
|
|
|
2019-08-31 13:58:33 +02:00
|
|
|
cflags := -m3 -mb -D FX9860G -ffreestanding -nostdlib -fstrict-volatile-bitfields -Wall \
|
|
|
|
-Wextra -Os -Iinclude -I .
|
2019-08-28 15:29:06 +02:00
|
|
|
|
|
|
|
lib := libfxengine.a
|
|
|
|
header := include/
|
|
|
|
|
2019-08-31 13:58:33 +02:00
|
|
|
prefix := $(shell $(target)-gcc -print-search-dirs | grep install \
|
|
|
|
| sed 's/install: //')
|
2019-08-28 15:29:06 +02:00
|
|
|
|
|
|
|
ifeq "$(prefix)" ""
|
2019-08-31 13:58:33 +02:00
|
|
|
$(error "Can't find install directory")
|
2019-08-28 15:29:06 +02:00
|
|
|
endif
|
|
|
|
|
2019-08-31 13:58:33 +02:00
|
|
|
src := $(shell find src -name '*.c')
|
|
|
|
|
|
|
|
obj := $(src:%=build/%.o)
|
2019-08-28 15:29:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
all: $(lib)
|
|
|
|
|
|
|
|
$(lib): $(obj)
|
2019-08-31 13:58:33 +02:00
|
|
|
$(target)-ar rcs $@ $^
|
2019-08-28 15:29:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
build/%.c.o: %.c
|
|
|
|
@ mkdir -p $(dir $@)
|
2019-08-31 13:58:33 +02:00
|
|
|
$(target)-gcc -c $< -o $@ $(cflags)
|
2019-08-28 15:29:06 +02:00
|
|
|
|
2019-08-31 13:58:33 +02:00
|
|
|
clear:
|
2019-08-28 15:29:06 +02:00
|
|
|
@ rm -rf build
|
|
|
|
@ rm -f $(lib)
|
|
|
|
|
|
|
|
%/:
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
|
|
|
|
install:
|
|
|
|
sh3eb-elf-ar -t $(lib)
|
|
|
|
cp $(lib) $(prefix)
|
2019-08-29 14:07:02 +02:00
|
|
|
cp -r $(header) $(prefix)/include/fxengine
|
2019-08-29 15:22:38 +02:00
|
|
|
|