Sound4Calc/Makefile

49 lines
1.1 KiB
Makefile

.PHONY: all mrproper send
PREFIX = sh3eb-elf-
AS = $(PREFIX)as
CC = $(PREFIX)gcc
CXX = $(PREFIX)g++
OBJCOPY = $(PREFIX)objcopy
WRAPPER = g1a-wrapper
SEND = UsbConnector
FLAGS = -m3 -mb -Os -nostdlib
CFLAGS = -W -Wall -Wno-main -pedantic -std=c11
INCLUDE = -I. -Iinclude -isystem stdinc
LIBS = -Llib -lgcc -lfx
NAME = sound
OBJ = build/Sound4Calc.o build/crt0.o build/syscall.o
ICON = icon.bmp
all: build/$(NAME).bin
@ $(WRAPPER) build/$(NAME).bin -o bin/$(NAME).g1a
@ echo "Build finished."
@ stat -c "Output size is %s bytes." bin/$(NAME).g1a
build/$(NAME).bin: build/$(NAME).elf
@ $(OBJCOPY) -R .comment -R .bss -O binary build/$(NAME).elf build/$(NAME).bin
build/$(NAME).elf: bin/addin.ld $(OBJ)
@ $(CC) $(FLAGS) $(OBJ) -T"bin/addin.ld" -o build/$(NAME).elf $(LIBS)
build/%.o: %.c
@ $(CC) $(FLAGS) -c $^ -o $@ $(INCLUDE) $(CFLAGS)
build/%.o: %.s
@ $(AS) -c $^ -o $@
send:
@ cp bin/$(NAME).g1a $(NAME).g1a
@ $(SEND) SEND $(NAME).g1a $(NAME).g1a fls0
@ rm -f $(NAME).g1a
mrproper:
rm -f build/*.o
rm -f build/$(NAME).elf
rm -f build/$(NAME).bin