makefile.in 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #
  2. # project data
  3. #
  4. PROJECT_NAME=avdl
  5. PROJECT_VERSION=0.0.2
  6. #
  7. # compiler data
  8. #
  9. #COMPILER_FLAGS=-Wall -Werror -Wpedantic
  10. COMPILER_FLAGS=-Wall -Wpedantic -Wformat-security
  11. COMPILER_DEFINES=\
  12. -DPROJECT_NAME=\"${PROJECT_NAME}\"\
  13. -DPROJECT_VERSION=\"${PROJECT_VERSION}\"
  14. COMPILER_INCLUDES=-Iinclude -I${DIRECTORY_OBJ}
  15. #
  16. # directories
  17. #
  18. DIRECTORY_BUILD=build
  19. DIRECTORY_EXE=${DIRECTORY_BUILD}/bin
  20. DIRECTORY_OBJ=${DIRECTORY_BUILD}/objects
  21. DIRECTORY_ALL=${DIRECTORY_BUILD} ${DIRECTORY_EXE} ${DIRECTORY_OBJ}
  22. #
  23. # source files
  24. #
  25. SRC=$(wildcard src/*.c)
  26. OBJ=${SRC:src/%.c=${DIRECTORY_OBJ}/%.o}
  27. HEADERS=$(widcard include/*.h)
  28. #
  29. # executable
  30. #
  31. EXECUTABLE=${DIRECTORY_EXE}/${PROJECT_NAME}
  32. #
  33. # engine data
  34. #
  35. ENGINE_PATH=engines/cengine
  36. ENGINE_OUT=${ENGINE_PATH}/build/libavdl-cengine.a
  37. INSTALL_LOCATION=@INSTALL_LOCATION@
  38. # android
  39. DIRECTORIES=engines/android/app/src/main/cpp/engine/
  40. CENGINE_FILES_HEADER=$(wildcard engines/cengine/include/*.h)
  41. CENGINE_FILES_SRC=$(wildcard engines/cengine/src/*.c)
  42. CENGINE_FILES_ANDROID_HEADER=$(CENGINE_FILES_HEADER:engines/cengine/include/%.h=engines/android/app/src/main/cpp/engine/%.h)
  43. CENGINE_FILES_ANDROID_SRC=$(CENGINE_FILES_SRC:engines/cengine/src/%.c=engines/android/app/src/main/cpp/engine/%.c)
  44. CENGINE_FILES_LOCAL=$(CENGINE_FILES_SRC:engines/cengine/src/%.c=engine\/%.c)
  45. all: ${EXECUTABLE} ${ENGINE_OUT}
  46. # build the executable, depends on source, lex, yacc and all engines
  47. ${EXECUTABLE}: ${DIRECTORY_ALL} ${DIRECTORIES} ${OBJ} ${CENGINE_FILES_ANDROID_HEADER} ${CENGINE_FILES_ANDROID_SRC} engines/android/app/src/main/cpp/CMakeLists.txt
  48. $(CC) ${COMPILER_FLAGS} ${COMPILER_DEFINES} ${COMPILER_INCLUDES} ${OBJ} -o $@
  49. # how to build the c engine
  50. engine: ${ENGINE_OUT}
  51. ${ENGINE_OUT}: ${CENGINE_FILES_SRC}
  52. ${MAKE} -C ${ENGINE_PATH}
  53. install: ${EXECUTABLE} ${ENGINE_OUT}
  54. ${MAKE} -C ${ENGINE_PATH} PREFIX=${INSTALL_LOCATION} install
  55. mkdir -p ${INSTALL_LOCATION}/usr/bin
  56. install ${EXECUTABLE} ${INSTALL_LOCATION}/usr/bin/
  57. mkdir -p ${INSTALL_LOCATION}/usr/share/man/man1/
  58. install manual/avdl.1 ${INSTALL_LOCATION}/usr/share/man/man1/
  59. mkdir -p ${INSTALL_LOCATION}/usr/share/avdl/android
  60. cp -r engines/android/* ${INSTALL_LOCATION}/usr/share/avdl/android
  61. #mkdir -p ${INSTALL_LOCATION}/share/info/
  62. #install avdl.info.gz ${INSTALL_LOCATION}/share/info/
  63. # vim files
  64. #mkdir -p ${INSTALL_LOCATION}/share/vim/vimfiles/syntax/
  65. #install vim/syntax/avdl.vim ${INSTALL_LOCATION}/share/vim/vimfiles/syntax/
  66. #mkdir -p ${INSTALL_LOCATION}/share/vim/vimfiles/ftdetect/
  67. #install vim/ftdetect/avdl.vim ${INSTALL_LOCATION}/share/vim/vimfiles/ftdetect/
  68. tarball: ${PROJECT_NAME}.tar
  69. ${PROJECT_NAME}.tar:
  70. tar cf $@ src makefile engines include
  71. clean:
  72. ${MAKE} -C ${ENGINE_PATH} clean
  73. rm -f ${EXECUTABLE} ${OBJ}
  74. destclean: clean
  75. rm -f avdl.info.gz makefile
  76. # android files
  77. engines/android/app/src/main/cpp/engine/%.h: engines/cengine/include/%.h
  78. cp $< $@
  79. engines/android/app/src/main/cpp/engine/%.c: engines/cengine/src/%.c
  80. cp $< $@
  81. engines/android/app/src/main/cpp/CMakeLists.txt: engines/android/app/src/main/cpp/CMakeLists.txt.in
  82. sed 's/%AVDL_ENGINE_FILES%/${CENGINE_FILES_LOCAL}/' $< > $@
  83. ${DIRECTORIES} ${DIRECTORY_ALL}:
  84. mkdir -p $@
  85. ${DIRECTORY_OBJ}/%.o: src/%.c ${HEADERS}
  86. $(CC) ${COMPILER_FLAGS} ${COMPILER_DEFINES} ${COMPILER_INCLUDES} -c $< -o $@
  87. .PHONY: clean destclean install engine