2023-10-22 22:28:46 +00:00
# adapted from https://git.sr.ht/~nytpu/fennel-playdate-template/tree/master/item/Makefile
2023-10-28 01:41:42 +00:00
rwildcard = $( foreach d,$( wildcard $( 1:= /*) ) ,$( call rwildcard,$d ,$2 ) $( shell for f in $( filter $( subst *,%,$2 ) ,$d ) ; do [ -d " $$ f " ] || printf "%s\n" " $$ f " ; done ) )
2023-10-22 22:28:46 +00:00
PDXNAME = Explosionface
EXCLUDESOURCES = src/macros.fnl
SOURCEFILES = $( filter-out $( EXCLUDESOURCES) ,$( call rwildcard, src, *.fnl) )
OUTFILES = $( subst src,source,$( SOURCEFILES:.fnl= .lua) $( filter-out $( SOURCEFILES) ,$( call rwildcard, src, *) ) )
all : $( PDXNAME ) .pdx
source : $( OUTFILES )
source/%.lua : src /%.fnl
2023-10-28 01:41:42 +00:00
mkdir -p $( dir $@ )
2023-10-22 22:28:46 +00:00
fennel -c $< > $@
source/% : src /%
2023-10-28 01:41:42 +00:00
mkdir -p $( dir $@ )
2023-10-22 22:28:46 +00:00
cp $< $@
$(PDXNAME).pdx : source
pdc source $@
clean :
rm -r $( PDXNAME) .pdx
rm -r source
run : $( PDXNAME ) .pdx
PlaydateSimulator $<
.PHONY : all source clean