Makefile.fpc 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #
  2. # Makefile.fpc for Free Pascal libndsfpc 2.x.y Examples
  3. #
  4. [target]
  5. loaders=
  6. programs=BoxTest
  7. [require]
  8. packages=libndsfpc
  9. tools=bin2s mmutil grit rmdir
  10. nortl=y
  11. [install]
  12. fpcpackage=y
  13. [default]
  14. cpu=arm
  15. target=nds
  16. fpcdir=../../../../../..
  17. [compiler]
  18. options=-g -Xm #-d__THUMB__
  19. [clean]
  20. files=*.elf *.o *.s *.nds *.nef *.h *.bin *.map \
  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)/*)))
  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. @echo 'Converting $(@) file to asm...'
  62. $(GRIT) gfx/$(@) -fts -ff gfx/$(basename $(@)).grit -o$(BUILD)/$(@)
  63. @echo 'Assembling $(@).s file...'
  64. $(AS) -o $(BUILD)/$(basename $(@)).o $(BUILD)/$(basename $(@)).s
  65. @echo 'Done!'
  66. #
  67. # Binary files processing rule
  68. #
  69. $(BIN_FILES): $(wildcard %.*)
  70. @echo 'Converting $(@) file to asm...'
  71. @$(BIN2S) data/$(@) > $(BUILD)/$(@).s
  72. @echo 'Creating $(@).inc include file...'
  73. @echo "var" > `(echo "inc/"$(@F) | tr . .)`.inc
  74. @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end: array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
  75. @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`": array [0..0] of cuint8; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
  76. @echo " " `(echo $(@F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size": cuint32; cvar; external;" >> `(echo "inc/"$(@F) | tr . .)`.inc
  77. @echo 'Assembling $(@).s file...'
  78. @$(AS) -o $(BUILD)/$(@).o $(BUILD)/$(@).s
  79. @echo 'Done!'