makefile 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #
  2. # project data
  3. #
  4. NAME=rue
  5. VERSION=v0.0.3
  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_OUT=${DIRECTORY_NATIVE_OUT}/${NAME}-${VERSION}.x86_64
  32. NATIVE_ASSETS_OBJ=${PLY:assets/%.ply=build/native/output/assets/%.asset} ${BMP:assets/%.bmp=build/native/output/assets/%.asset} \
  33. ${WAV:assets/%.wav=build/native/output/assets/%.asset} ${OGG:assets/%.ogg=build/native/output/assets/%.asset}
  34. #
  35. # android output files
  36. #
  37. ANDROID_OBJ=${SRC:src/%.dd=${DIRECTORY_ANDROID_OBJ}/%.c}
  38. #
  39. # system data
  40. #
  41. prefix=/usr/local
  42. assetdir=${prefix}/share/rue/
  43. #
  44. # default build - native only
  45. #
  46. all: native
  47. #
  48. # how to make builds for native and android
  49. #
  50. native: ${DIRECTORY_NATIVE_ALL} ${NATIVE_OUT} ${NATIVE_ASSETS_OBJ}
  51. android: ${DIRECTORY_ANDROID_ALL} ${ANDROID_OBJ}
  52. #
  53. # native - compile files - assets - final executable
  54. #
  55. ${DIRECTORY_NATIVE_OBJ}/%.o: src/%.dd ${HEADERS}
  56. avdl -c $< -o $@ -I include/ --install-loc "${assetdir}"
  57. ${DIRECTORY_NATIVE_ASSETS}/%.asset: assets/%.ply
  58. avdl -c $< -o $@
  59. ${DIRECTORY_NATIVE_ASSETS}/%.asset: assets/%.bmp
  60. avdl -c $< -o $@
  61. ${DIRECTORY_NATIVE_ASSETS}/%.asset: assets/%.wav
  62. avdl -c $< -o $@
  63. ${DIRECTORY_NATIVE_ASSETS}/%.asset: assets/%.ogg
  64. avdl -c $< -o $@
  65. ${NATIVE_OUT}: ${NATIVE_OBJ}
  66. avdl $^ -o $@
  67. #
  68. # android - compile files
  69. #
  70. ${DIRECTORY_ANDROID_OBJ}/%.c: src/%.dd ${HEADERS}
  71. avdl --android -t $< -o $@ -I include
  72. #
  73. # make any directory needed
  74. #
  75. ${DIRECTORY_ALL}:
  76. mkdir -p $@
  77. install:
  78. mkdir -p ${DESTDIR}${prefix}/bin
  79. install ${NATIVE_OUT} ${DESTDIR}${prefix}/bin/rue
  80. mkdir -p ${DESTDIR}${prefix}/share/rue/assets
  81. install ${NATIVE_ASSETS_OBJ} ${DESTDIR}${prefix}/share/rue/assets
  82. #
  83. # clean project
  84. #
  85. clean:
  86. rm -r build
  87. #
  88. # phony targets
  89. #
  90. .PHONY: clean native android