makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #
  2. # project data
  3. #
  4. NAME=rue
  5. VERSION=v0.0.4
  6. #
  7. # directories - separate for native and android
  8. #
  9. DIRECTORY_NATIVE=build/native
  10. DIRECTORY_NATIVE_OBJ=${DIRECTORY_NATIVE}/objects
  11. DIRECTORY_NATIVE_ASSETS=${DIRECTORY_NATIVE}/output/assets
  12. DIRECTORY_NATIVE_OUT=${DIRECTORY_NATIVE}/output
  13. DIRECTORY_NATIVE_ALL=${DIRECTORY_NATIVE} ${DIRECTORY_NATIVE_OBJ} ${DIRECTORY_NATIVE_ASSETS} ${DIRECTORY_NATIVE_OUT}
  14. DIRECTORY_ANDROID=build/android
  15. DIRECTORY_ANDROID_OBJ=${DIRECTORY_ANDROID}/objects
  16. DIRECTORY_ANDROID_ALL=${DIRECTORY_ANDROID} ${DIRECTORY_ANDROID_OBJ}
  17. DIRECTORY_ALL=${DIRECTORY_NATIVE_ALL} ${DIRECTORY_ANDROID_ALL}
  18. #
  19. # source files
  20. #
  21. SRC=$(wildcard src/*.dd)
  22. HEADERS=$(wildcard include/*.ddh)
  23. PLY=$(wildcard assets/*.ply)
  24. BMP=$(wildcard assets/*.bmp)
  25. WAV=$(wildcard assets/*.wav)
  26. OGG=$(wildcard assets/*.ogg)
  27. #
  28. # native output files
  29. #
  30. NATIVE_OBJ=${SRC:src/%.dd=${DIRECTORY_NATIVE_OBJ}/%.o}
  31. NATIVE_OBJ_C=${NATIVE_OBJ:%.o=%.c}
  32. NATIVE_OUT=${DIRECTORY_NATIVE_OUT}/${NAME}-${VERSION}.x86_64
  33. NATIVE_ASSETS_OBJ=${PLY:assets/%.ply=build/native/output/assets/%.asset} ${BMP:assets/%.bmp=build/native/output/assets/%.asset} \
  34. ${WAV:assets/%.wav=build/native/output/assets/%.asset} ${OGG:assets/%.ogg=build/native/output/assets/%.asset}
  35. #
  36. # android output files
  37. #
  38. ANDROID_OBJ=${SRC:src/%.dd=${DIRECTORY_ANDROID_OBJ}/%.c}
  39. #
  40. # system data
  41. #
  42. prefix=/usr/local
  43. assetdir=${prefix}/share/rue/
  44. #
  45. # default build - native only
  46. #
  47. all: native
  48. #
  49. # how to make builds for native and android
  50. #
  51. native: ${DIRECTORY_NATIVE_ALL} ${NATIVE_OUT} ${NATIVE_ASSETS_OBJ}
  52. android: ${DIRECTORY_ANDROID_ALL} ${ANDROID_OBJ}
  53. #
  54. # native - compile files - assets - final executable
  55. #
  56. ${DIRECTORY_NATIVE_OBJ}/%.o: src/%.dd ${HEADERS}
  57. avdl -c $< -o $@ -I include/ --install-loc "${assetdir}"
  58. ${DIRECTORY_NATIVE_ASSETS}/%.asset: assets/%.ply
  59. avdl -c $< -o $@
  60. ${DIRECTORY_NATIVE_ASSETS}/%.asset: assets/%.bmp
  61. avdl -c $< -o $@
  62. ${DIRECTORY_NATIVE_ASSETS}/%.asset: assets/%.wav
  63. avdl -c $< -o $@
  64. ${DIRECTORY_NATIVE_ASSETS}/%.asset: assets/%.ogg
  65. avdl -c $< -o $@
  66. ${NATIVE_OUT}: ${NATIVE_OBJ}
  67. avdl $^ -o $@
  68. #
  69. # android - compile files
  70. #
  71. ${DIRECTORY_ANDROID_OBJ}/%.c: src/%.dd ${HEADERS}
  72. avdl --android -t $< -o $@ -I include/
  73. #
  74. # make any directory needed
  75. #
  76. ${DIRECTORY_ALL}:
  77. mkdir -p $@
  78. install:
  79. mkdir -p ${DESTDIR}${prefix}/bin
  80. install ${NATIVE_OUT} ${DESTDIR}${prefix}/bin/rue
  81. mkdir -p ${DESTDIR}${prefix}/share/rue/assets
  82. install ${NATIVE_ASSETS_OBJ} ${DESTDIR}${prefix}/share/rue/assets
  83. #
  84. # clean project
  85. #
  86. clean:
  87. rm -f ${NATIVE_OBJ} ${NATIVE_OUT} ${NATIVE_ASSETS_OBJ} ${NATIVE_OBJ_C}
  88. #
  89. # phony targets
  90. #
  91. .PHONY: clean native android