makefile 3.2 KB

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