Makefile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # !/usr/bin/make -f
  2. default: all
  3. package?=trako
  4. srcs?=$(wildcard src/${package}/*.cpp)
  5. headers?=$(wildcard src/${package}/*.h)
  6. objs?=${srcs:.cpp=.o}
  7. lib?=lib${package}.a
  8. src_main?=src/main.cpp
  9. target?=${src_main:.cpp=}
  10. CXXFLAGS+=-Isrc/${package}
  11. CXXFLAGS+=-DCONFIG_WANT_LIBTRAKO=1
  12. install_header_dir?=${DESTDIR}/usr/include/${package}
  13. install_lib_dir?=${DESTDIR}/usr/lib/
  14. all: COPYING ${target}
  15. run:${target}
  16. ${exec} ${<D}/${<F} | tee ${<F}.log.txt ; echo status=$$?
  17. clean:force
  18. find . -type f -iname "*.o" -exec rm -f '{}' \;
  19. find . -type f -iname "*~" -exec rm -f '{}' \;
  20. distclean: clean
  21. rm -f ${target} *.a
  22. -rm -rf */CMakeCache.txt */CMakeFiles */*.cmake
  23. -rm -rf ./CMakeCache.txt ./CMakeFiles ./*.cmake
  24. -rm -rf */*.a */main */tmp main tmp MANIFEST src/Makefile
  25. test: distclean run clean
  26. force:
  27. help:
  28. echo "# srcs=${srcs}"
  29. lib${package}.a: ${objs}
  30. ${AR} cru $@ $^
  31. # nm --demangle $@
  32. ${target}: ${src_main:.cpp=.o} ${lib}
  33. ${CXX} ${CXXFLAGS} -o $@ $^
  34. install: ${headers}
  35. install -d ${install_header_dir}
  36. for f in ${^F}; do install ${<D}/$${f} ${install_header_dir}/$${f} ; done
  37. install -d ${install_lib_dir}
  38. install ${lib} ${install_lib_dir}/
  39. cmake:src/CMakeLists.txt distclean
  40. cd ${<D} && cmake .
  41. make -C ${<D} V=1 VERBOSE=1
  42. COPYING:/usr/share/common-licenses/LGPL-3
  43. cp $< $@
  44. -include ~/bin/mk-local.mk
  45. #eof