Makefile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. SRC = \
  2. main.c \
  3. d4dag.c
  4. # gcc -m32 should compile 32bits version and that does not work on debian linux
  5. all:
  6. make clean
  7. make indent
  8. gcc -Wall -Wextra -pedantic -Wnull-dereference -O0 main.c d4dag.c -o main
  9. cp main mainc
  10. rm -v -f *.o main
  11. g++ -Wall -Wextra -pedantic -O0 main.c d4dag.c -o main++
  12. rm -v -f *~
  13. rm -v -f d4dag.bc
  14. clang-11 -O0 -emit-llvm d4dag.c -c -o d4dag.bc
  15. llvm-dis-11 d4dag.bc -o d4dag.ll
  16. python3 OverCG.py -i d4dag.ll -o d4dag.ll.callgraph.gv
  17. opt-11 -dot-cfg d4dag.bc -o d4dag.bc~
  18. opt-11 -dot-callgraph d4dag.bc -o d4dag.bc~
  19. rm -v -f d4dag.bc
  20. rm -v -f *~
  21. ./mkcallgraph.sh
  22. # smatch sourcecode checker at sourceforge.net using Linux kernel sparse tool
  23. smatch:
  24. smatch main.c d4dag.c
  25. # compile to llvm binary usinf sparse
  26. sparsellvm:
  27. sparse-llvm main.c d4dag.c >output.bc
  28. # compile with intel c compiler
  29. icc:
  30. ./icc.sh
  31. # format the source
  32. indent:
  33. ./lindent.sh $(SRC)
  34. # using the complexity program from debian show nesting depth of routines
  35. comp:
  36. complexity -c -H d4dag.c
  37. # using cunloop from cutils package 1.6 to create C with easier ast
  38. # this needs the cunloop.c with bug fixs
  39. # the resulting ast will only have if() and goto's and goto labels
  40. # the amount of code used in the compiler will be much smaller
  41. unloop:
  42. cunloop d4dag.c -od4dag-unloop.c -p d4dag__unloop_ d4dag.c
  43. indent d4dag-unloop.c
  44. simplec:
  45. rm -v -f lex.yy.c
  46. rm -v -f simplec
  47. flex simplec.l
  48. gcc lex.yy.c -o simplec
  49. ./simplec -od4dag-unloop.c -p d4dag__unloop_ d4dag.c
  50. indent d4dag-unloop.c
  51. # create some gcc graph data
  52. gccdata:
  53. gcc -c -fdump-rtl-expand-graph d4dag.c
  54. gcc -c -fdump-tree-ssa-graph d4dag.c
  55. gcc -c -fdump-ipa-whole-program-graph d4dag.c
  56. gcc -g -S -c -fverbose-asm -save-temps d4dag.c
  57. rm -v -f *.o
  58. rm -v -f *.i
  59. rm -v -f *.expand
  60. rm -v -f *.ssa
  61. rm -v -f *i.whole-program
  62. cp d4dag.s d4dag-gcc.s
  63. gcc -g -c -Wa,-adhnl=d4dag.s d4dag.c
  64. cp d4dag.s d4dag-gcc-wa.s
  65. clang-11 -S -g -c -fverbose-asm d4dag.c
  66. cp d4dag.s d4dag-clang.s
  67. ./icc.sh
  68. clean:
  69. rm -v -f main
  70. rm -v -f mainc
  71. rm -v -f main++
  72. rm -v -f *.o
  73. rm -v -f *.bc
  74. rm -v -f *.output
  75. rm -v -f *.errors
  76. rm -v -f *.warnings
  77. rm -v -f *~
  78. rm -v -f lex.yy.c
  79. rm -v -f simplec
  80. cleaner:
  81. make clean
  82. # end.