Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #
  2. # make file for sfgdemo and sfg graph library
  3. #
  4. sfgdemo: sfg.c sfgdemo.c
  5. catchsegv $(CC) -fplugin=/home/gold/scallgraph_plugin.so.0.0.0 -g -Wall -Wextra sfgdemo.c sfg.c -o sfgdemo
  6. sfga:
  7. rm -v -f *.o *.a
  8. gcc -S -fverbose-asm -g -c sfg.c
  9. gcc -g -c sfg.c
  10. ar -cvq libsfg.a sfg.o
  11. sfgso:
  12. rm -v -f *.o *.so.1.0 *.so.1 *.so
  13. gcc -g -c -fPIC sfg.c
  14. gcc -g -shared -Wl,-soname,libsfg.so.1 -o libsfg.so.1.0 sfg.o
  15. ln -sf libsfg.so.1.0 libsfg.so.1
  16. ln -sf libsfg.so.1.0 libsfg.so
  17. # using emscripten for the javascript version
  18. emcc:
  19. emcc -O0 -s WASM=0 sfg.c
  20. # swig python wrapper
  21. # specify the include directory with <Python.h> here
  22. swigpython:
  23. rm -v -f ./sfg.py
  24. rm -v -f ./sfg.pyc
  25. rm -v -f ./*.o
  26. rm -v -f ./sfg_wrap.c
  27. swig -python sfg.i
  28. gcc -fPIC -c sfg.c sfg_wrap.c -I/usr/include/python2.7
  29. ld -shared sfg.o sfg_wrap.o -o _sfg.so
  30. # swig perl wrapper
  31. # perl -V:ccflags
  32. # specify the location of directory CORE
  33. swigperl:
  34. rm -v -f ./sfg.pm
  35. rm -v -f ./sfg_wrap.c
  36. swig -perl5 sfg.i
  37. gcc -c -I/usr/lib/x86_64-linux-gnu/perl/5.28.1/CORE sfg.c sfg_wrap.c
  38. ld -G sfg.o sfg_wrap.o -o sfg.so
  39. # swig tcl wrapper
  40. # specify the location of <tcl.h>
  41. swigtcl:
  42. rm -v -f ./sfg_wrap.c
  43. rm -v -f ./*.o
  44. rm -v -f ./*.so
  45. swig -tcl sfg.i
  46. gcc -c -fpic sfg.c sfg_wrap.c -I/usr/include/tcl8.6
  47. gcc -shared sfg.o sfg_wrap.o -o sfg.so
  48. # swig c++ wrapper
  49. swigcplus:
  50. rm -v -f ./sfg_wrap.cxx
  51. swig -c++ -tcl sfg.i
  52. g++ -c -fpic sfg_wrap.cxx -I/usr/include/tcl8.6
  53. # swig go
  54. swiggo:
  55. rm -v -f ./sfg_wrap.c
  56. rm -v -f ./sfg_gc.c
  57. rm -v -f ./sfg.go
  58. swig -go -intgosize 64 sfg.i
  59. # swig java
  60. # see the swig docs
  61. swigjava:
  62. rm -v -f ./*.java
  63. rm -v -f ./sfg_wrap.c
  64. swig -java sfg.i
  65. # generate callgraph using llvm
  66. bc:
  67. clang -emit-llvm -c sfg.c -o sfg.bc
  68. opt-7 -dot-callgraph sfg.bc
  69. # show the complexity of the c source
  70. comp:
  71. complexity -c sfg.c
  72. clean:
  73. rm -v -f ./sfg.bc
  74. rm -v -f ./*.java
  75. rm -v -f ./sfg_gc.c
  76. rm -v -f ./sfg.go
  77. rm -v -f ./sfg.pm
  78. rm -v -f ./sfg.py
  79. rm -v -f ./sfg.pyc
  80. rm -v -f ./sfg_wrap.c
  81. rm -v -f ./sfg_wrap.cxx
  82. rm -v -f ./a.out*
  83. rm -v -f ./O
  84. rm -v -f ./O1
  85. rm -v -f ./O2
  86. rm -v -f ./OO
  87. rm -v -f ./sfgdemo
  88. rm -v -f ./*~
  89. rm -v -f ./dsmake.errors
  90. rm -v -f ./dsmake.warnings
  91. rm -v -f ./dsmake.output
  92. rm -v -f ./*.o
  93. rm -v -f ./*.a
  94. rm -v -f ./*.so.1
  95. rm -v -f ./*.so
  96. rm -v -f ./*.so.1.0
  97. indent:
  98. ./Lindent sfg.h sfg.c sfgdemo.c
  99. valgrind:
  100. valgrind --leak-check=full --show-reachable=yes ./sfgdemo 1>O1 2>O2
  101. # end