Makefile.fpc 2.0 KB

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