summaryrefslogtreecommitdiff
path: root/packages/libndsfpc/examples/filesystem/libfat/access_file/Makefile.fpc
diff options
context:
space:
mode:
Diffstat (limited to 'packages/libndsfpc/examples/filesystem/libfat/access_file/Makefile.fpc')
-rw-r--r--packages/libndsfpc/examples/filesystem/libfat/access_file/Makefile.fpc103
1 files changed, 103 insertions, 0 deletions
diff --git a/packages/libndsfpc/examples/filesystem/libfat/access_file/Makefile.fpc b/packages/libndsfpc/examples/filesystem/libfat/access_file/Makefile.fpc
new file mode 100644
index 0000000000..0e151809e2
--- /dev/null
+++ b/packages/libndsfpc/examples/filesystem/libfat/access_file/Makefile.fpc
@@ -0,0 +1,103 @@
+#
+# Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
+#
+
+[target]
+loaders=
+programs=access_file
+
+[require]
+packages=libndsfpc
+tools=bin2s mmutil grit rmdir
+nortl=y
+
+[install]
+fpcpackage=y
+
+[default]
+cpu=arm
+target=nds
+fpcdir=../../../../../..
+
+[compiler]
+options=-g -Xm -O2
+#-d__THUMB__
+
+[clean]
+files=*.elf *.o *.s *.nds *.nef *.h *.bin *.map \
+ $(BUILD)/* \
+ $(INC)/*
+units=*
+
+[prerules]
+BUILD = build
+INC = inc
+AUDIO_FILES = $(foreach dir, $(notdir $(wildcard audio/*.*)), $(CURDIR)/audio/$(dir))
+GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
+BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*)))
+GBFS_FILES = $(foreach dir,GBFS,$(notdir $(wildcard $(dir)/*)))
+
+[rules]
+.NOTPARALLEL:
+clean: dir_delete fpc_clean fpc_cleanall
+all: dir_make $(BIN_FILES) $(GFX_FILES) fpc_all
+
+#
+# Delete temp directories
+#
+dir_delete:
+ @$(DELTREE) $(CURDIR)/$(BUILD)
+ @$(DELTREE) $(CURDIR)/$(INC)
+
+#
+# Create temp directories
+#
+dir_make:
+ifneq ($(BUILD), $(CURDIR))
+ @$(MKDIR) $(BUILD)
+endif
+ifneq ($(INC), $(CURDIR))
+ @$(MKDIR) $(INC)
+endif
+
+#
+# Audio files processing rule
+#
+soundbank.bin.o : $(AUDIO_FILES)
+ @$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
+ $(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
+ $(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
+
+#
+# Png files processing rule
+#
+$(GFX_FILES): $(wildcard %.png)
+ @echo 'Converting $(@) file to asm...'
+ $(GRIT) gfx/$(@) -fts -ff gfx/$(basename $(@)).grit -o$(BUILD)/$(@)
+ @echo 'Assembling $(@).s file...'
+ $(AS) -o $(BUILD)/$(basename $(@)).o $(BUILD)/$(basename $(@)).s
+ @echo 'Done!'
+
+#
+# Binary files processing rule
+#
+$(BIN_FILES): $(wildcard %.*)
+ @echo 'Converting $(@) file to asm...'
+ @$(BIN2S) data/$(@) > $(BUILD)/$(@).s
+ @echo 'Creating $(@).inc include file...'
+ @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
+ @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
+ @echo 'Assembling $(@).s file...'
+ @$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
+ @echo 'Done!'
+
+#
+# GBFS files processing rule
+#
+data.gbfs.o:
+ @cd GBFS && gbfs ../$(BUILD)/data.gbfs $(GBFS_FILES)
+ $(BIN2S) $(BUILD)/data.gbfs > $(BUILD)/data.gbfs.s
+ $(AS) -o $(BUILD)/data.gbfs.o $(BUILD)/data.gbfs.s
+