101 lines
1.8 KiB
Makefile
101 lines
1.8 KiB
Makefile
frameskip := 4
|
|
loop := 1
|
|
RLE := 1
|
|
name = badapple
|
|
|
|
DEFINES += -DFRAMESKIP=$(frameskip)
|
|
|
|
ifneq ($(loop),1)
|
|
else
|
|
DEFINES += -DLOOP=$(loop)
|
|
endif
|
|
|
|
ifneq ($(RLE),1)
|
|
input_type = diff
|
|
else
|
|
DEFINES += -DRLE
|
|
input_type = rle
|
|
endif
|
|
|
|
|
|
LDFLAGS =
|
|
CFLAGS = -Wl,--gc-sections -nostartfiles -s -static -nostdlib -Os -ffunction-sections -fdata-sections
|
|
|
|
|
|
# if pocketstation
|
|
ifeq ($(target),pocketstation)
|
|
POCKETSTATION = 1
|
|
CC = arm-none-eabi-gcc
|
|
LD = arm-none-eabi-ld
|
|
OBJCOPY = arm-none-eabi-objcopy
|
|
AS = arm-none-eabi-as
|
|
|
|
LDFLAGS += -Tldscript
|
|
CFLAGS += -march=armv4 -mtune=arm7tdmi
|
|
COPYFLAGS = -I binary -O elf32-littlearm
|
|
|
|
DEFINES += -D__POCKETSTATION__
|
|
extra_objects = head.o
|
|
|
|
else ifeq ($(target),)
|
|
CC = gcc
|
|
LD = gcc
|
|
OBJCOPY = objcopy
|
|
AS = as
|
|
|
|
COPYFLAGS = -B i386 -I binary -O elf64-x86-64
|
|
DEFINES += -D__LINUX__
|
|
else
|
|
$(error "unknown target")
|
|
endif
|
|
|
|
|
|
all: $(name)
|
|
|
|
ifdef POCKETSTATION
|
|
all: $(name).mcs
|
|
|
|
$(name).mcs: $(name).bin tools
|
|
../tools/bin2mcs BESCEDP-00000BADAPPLE0 $< $@
|
|
|
|
$(name).bin: $(name) tools
|
|
$(OBJCOPY) -O binary $< $@
|
|
../tools/mcpad $@
|
|
|
|
head.o: head.s data/title.txt data/icon.bin
|
|
endif
|
|
|
|
$(name): player.o badapple_$(input_type).o $(extra_objects)
|
|
$(LD) $(LDFLAGS) $^ -o $@
|
|
|
|
player.o: player.c
|
|
$(CC) -c $(CFLAGS) $(DEFINES) player.c -o player.o
|
|
|
|
|
|
badapple_$(input_type).o: out_$(input_type).bin
|
|
cp $< badapple_$(input_type).bin
|
|
$(OBJCOPY) $(COPYFLAGS) badapple_$(input_type).bin $@
|
|
rm badapple_$(input_type).bin
|
|
|
|
out_$(input_type).bin:
|
|
cd ../encoder && python3 encode.py $(frameskip)
|
|
cp ../encoder/out_$(input_type).bin .
|
|
|
|
|
|
tools:
|
|
cd ../tools && make
|
|
|
|
|
|
data/title.txt: tools
|
|
../tools/ascii2sjis $(name) $@
|
|
|
|
data/icon.bin: ../icon.BMP tools
|
|
../tools/bmp_to_1bit.py $< icon1bit.bmp
|
|
../tools/bmp2ps1b b icon1bit.bmp
|
|
rm icon1bit.bmp
|
|
mv icon1bit.bin $@
|
|
|
|
clean:
|
|
rm -f *.o $(name) $(name).bin $(name).mcs out_*.bin data/icon.bin data/title.txt
|
|
cd ../tools && make clean
|