Makefile.fpc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #
  2. # Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
  3. #
  4. [target]
  5. loaders=
  6. programs=touchTest
  7. [require]
  8. packages=libndsfpc
  9. tools=bin2s mmutil grit rmdir
  10. nortl=y
  11. [install]
  12. fpcpackage=y
  13. [compiler]
  14. options=-g -Xm -d__THUMB__
  15. [default]
  16. cpu=arm
  17. target=nds
  18. fpcdir=../../../../../..
  19. [clean]
  20. files=*.elf *.o *.s *.nds *.nef *.h *.bin \
  21. $(BUILD)/* \
  22. $(INC)/*
  23. units=*
  24. [prerules]
  25. BUILD = build
  26. INC = inc
  27. AUDIO_FILES = $(foreach dir, $(notdir $(wildcard audio/*.*)), $(CURDIR)/audio/$(dir))
  28. GFX_FILES = $(foreach dir,gfx,$(notdir $(wildcard $(dir)/*.png)))
  29. BIN_FILES = $(foreach dir,data,$(notdir $(wildcard $(dir)/*.bin)))
  30. [rules]
  31. .NOTPARALLEL:
  32. clean: dir_delete fpc_clean fpc_cleanall
  33. all: dir_make $(BIN_FILES) $(GFX_FILES) fpc_all
  34. #
  35. # Delete temp directories
  36. #
  37. dir_delete:
  38. $(DELTREE) $(CURDIR)/$(BUILD)
  39. $(DELTREE) $(CURDIR)/$(INC)
  40. #
  41. # Create temp directories
  42. #
  43. dir_make:
  44. ifneq ($(BUILD), $(CURDIR))
  45. $(MKDIR) $(BUILD)
  46. endif
  47. ifneq ($(INC), $(CURDIR))
  48. $(MKDIR) $(INC)
  49. endif
  50. #
  51. # Audio files processing rule
  52. #
  53. soundbank.bin.o : $(AUDIO_FILES)
  54. @$(MMUTIL) $^ -d -o$(BUILD)/soundbank.bin -h$(BUILD)/soundbank.h
  55. $(BIN2S) $(BUILD)/soundbank.bin > $(BUILD)/soundbank.bin.s
  56. $(AS) -o $(BUILD)/soundbank.bin.o $(BUILD)/soundbank.bin.s
  57. #
  58. # Png files processing rule
  59. #
  60. $(GFX_FILES): $(wildcard %.png)
  61. $(GRIT) gfx/$(@) -fts -ff gfx/$(basename $(@)).grit -o$(BUILD)/$(@)
  62. $(AS) -o $(BUILD)/$(basename $(@)).o $(BUILD)/$(basename $(@)).s
  63. #
  64. # Binary files processing rule
  65. #
  66. $(BIN_FILES): $(wildcard %.bin)
  67. @echo 'Converting $(@) file to asm...'
  68. @$(BIN2S) data/$(@) > $(BUILD)/$(@).s
  69. @echo 'Creating $(@).inc include file...'
  70. @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
  71. @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
  72. @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
  73. @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
  74. @echo 'Assembling $(@).s file...'
  75. @$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
  76. @echo 'Done!'