Makefile 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. APP=libstrips
  2. VERSION=1.00
  3. RELEASE=1
  4. SONAME=${APP}.so.0
  5. LIBNAME=${APP}-${VERSION}.so.0.0.${RELEASE}
  6. ARCH_TYPE=`uname -m`
  7. PREFIX?=/usr/local
  8. LIBDIR=lib
  9. ARCH_BUILD_DIR=${HOME}/abs/${APP}
  10. CURR_DIR=$(shell pwd)
  11. SELF_DIR=$(shell basename $(CURR_DIR))
  12. SOURCEFILE?=strips.c
  13. DATE_FMT = %Y-%m-%d
  14. ifdef SOURCE_DATE_EPOCH
  15. BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)")
  16. else
  17. BUILD_DATE ?= $(shell date "+$(DATE_FMT)")
  18. endif
  19. ifeq ($(shell if [ -d /usr/lib64 ]; then echo "found"; fi;), "found")
  20. LIBDIR = lib64
  21. endif
  22. all:
  23. rm -f src/flycheck*
  24. gcc -shared -Wl,-soname,${SONAME} -std=c99 -pedantic -fPIC -O3 -o ${LIBNAME} src/*.c -Isrc -lm -fopenmp
  25. debug:
  26. rm -f src/flycheck*
  27. gcc -shared -Wl,-soname,${SONAME} -std=c99 -pedantic -fPIC -g -o ${LIBNAME} src/*.c -Isrc -lm -fopenmp
  28. debugstack:
  29. rm -f src/flycheck*
  30. gcc -shared -Wl,-soname,${SONAME} -std=c99 -pedantic -fsanitize=address -fPIC -g -o ${LIBNAME} src/*.c -Isrc -lm -fopenmp
  31. graph:
  32. rm -f src/flycheck*
  33. gcc -shared -Wl,-soname,${SONAME} -std=c99 -pedantic -fPIC -g -o ${LIBNAME} src/*.c -Isrc -lm -fopenmp -fdump-rtl-expand
  34. egypt ${SOURCEFILE}.*.expand | xdot -
  35. rm *.expand
  36. source:
  37. tar -cvf ../${APP}_${VERSION}.orig.tar --exclude-vcs ../$(SELF_DIR)
  38. gzip -f9n ../${APP}_${VERSION}.orig.tar
  39. arch:
  40. rm -f ${APP} *.xz *.sig
  41. @if [ ! -d ${ARCH_BUILD_DIR} ]; then\
  42. mkdir -p ${ARCH_BUILD_DIR};\
  43. fi
  44. rm -rf ${ARCH_BUILD_DIR}/*
  45. tar cvf ${ARCH_BUILD_DIR}/${APP}-${VERSION}.tar --exclude-vcs .
  46. gzip -f9n ${ARCH_BUILD_DIR}/${APP}-${VERSION}.tar
  47. cp PKGBUILD ${ARCH_BUILD_DIR}
  48. gpg -ba ${ARCH_BUILD_DIR}/${APP}-${VERSION}.tar.gz
  49. sed -i "s|arch=()|arch=('${ARCH_TYPE}')|g" ${ARCH_BUILD_DIR}/PKGBUILD
  50. cd ${ARCH_BUILD_DIR}; updpkgsums; makepkg -f -c -s; makepkg --printsrcinfo > .SRCINFO
  51. unxz ${ARCH_BUILD_DIR}/${APP}-${VERSION}-${RELEASE}-${ARCH_TYPE}.pkg.tar.xz
  52. tar vf ${ARCH_BUILD_DIR}/${APP}-${VERSION}-${RELEASE}-${ARCH_TYPE}.pkg.tar --delete .BUILDINFO
  53. xz ${ARCH_BUILD_DIR}/${APP}-${VERSION}-${RELEASE}-${ARCH_TYPE}.pkg.tar
  54. gpg -ba ${ARCH_BUILD_DIR}/${APP}-${VERSION}-${RELEASE}-${ARCH_TYPE}.pkg.tar.xz
  55. install:
  56. mkdir -p ${DESTDIR}/usr
  57. mkdir -p ${DESTDIR}${PREFIX}/${LIBDIR}/${APP}
  58. mkdir -p ${DESTDIR}${PREFIX}/include/${APP}
  59. cp src/*.h ${DESTDIR}${PREFIX}/include/${APP}
  60. install -m 755 ${LIBNAME} ${DESTDIR}${PREFIX}/${LIBDIR}
  61. ln -sf ${DESTDIR}${PREFIX}/${LIBDIR}/${LIBNAME} ${DESTDIR}${PREFIX}/${LIBDIR}/${SONAME}
  62. ln -sf ${DESTDIR}${PREFIX}/${LIBDIR}/${LIBNAME} ${DESTDIR}/${LIBDIR}/${SONAME}
  63. ln -sf ${DESTDIR}${PREFIX}/${LIBDIR}/${LIBNAME} ${DESTDIR}${PREFIX}/${LIBDIR}/${APP}.so
  64. ldconfig
  65. mkdir -m 755 -p ${DESTDIR}${PREFIX}/share/man/man1
  66. install -m 644 man/${APP}.1.gz ${DESTDIR}${PREFIX}/share/man/man1
  67. uninstall:
  68. rm -f ${PREFIX}/share/man/man1/${APP}.1.gz
  69. rm -f ${PREFIX}/${LIBDIR}/${LIBNAME}
  70. rm -f ${PREFIX}/${LIBDIR}/${APP}.so
  71. rm -f ${PREFIX}/${LIBDIR}/${SONAME}
  72. rm -f /${LIBDIR}/${SONAME}
  73. rm -rf ${PREFIX}/include/${APP}
  74. ldconfig
  75. instlib:
  76. mkdir -p ${DESTDIR}/usr
  77. mkdir -p ${DESTDIR}${PREFIX}/${LIBDIR}/${APP}
  78. mkdir -p ${DESTDIR}${PREFIX}/include/${APP}
  79. cp src/*.h ${DESTDIR}${PREFIX}/include/${APP}
  80. install -m 755 ${LIBNAME} ${DESTDIR}${PREFIX}/${LIBDIR}
  81. mkdir -m 755 -p ${DESTDIR}${PREFIX}/share/man/man1
  82. install -m 644 man/${APP}.1.gz ${DESTDIR}${PREFIX}/share/man/man1
  83. clean:
  84. rm -f ${LIBNAME} \#* \.#* gnuplot* *.png src/*.plist *.expand
  85. rm -f unittests/*.plist unittests/tests