Makefile.am 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. #
  2. # /*
  3. # * Copyright 2021
  4. # *
  5. # * This program is free software: you can redistribute it and/or modify
  6. # * it under the terms of the GNU General Public License as published by
  7. # * the Free Software Foundation, either version 3 of the License, or
  8. # * (at your option) any later version.
  9. # *
  10. # * This program is distributed in the hope that it will be useful,
  11. # * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # * GNU General Public License for more details.
  14. # *
  15. # * You should have received a copy of the GNU General Public License
  16. # * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. # *
  18. # * SPDX-License-Identifier: GPL-3.0+
  19. # * License-Filename: LICENSE
  20. # *
  21. # */
  22. #
  23. # clng llvm control flow graph:
  24. # clang -emit-llvm hello.c -c -o main.bc
  25. # opt -dot-cfg-only main.bc
  26. bin_PROGRAMS=gml4gtk
  27. gml4gtk_SOURCES = \
  28. gml_parser.c \
  29. gml_scanner.c \
  30. main.c \
  31. bubbling.c \
  32. sugi2.c \
  33. sugi3.c \
  34. sugi4.c \
  35. sugi5.c \
  36. pos.c \
  37. pos2.c \
  38. pos3.c \
  39. pos4.c \
  40. pos5.c \
  41. posz.c \
  42. hier.c \
  43. splay-tree.c \
  44. skip-list.c \
  45. uniqstr.c \
  46. uniqnode.c \
  47. uniqgraph.c \
  48. dpif.c \
  49. dot.tab.c \
  50. dp.c \
  51. dpcolor.c \
  52. dpmisc.c \
  53. dpun.c \
  54. dpus.c \
  55. dpn.c \
  56. dpe.c \
  57. dpg.c \
  58. lex.yy.c \
  59. rhp.c \
  60. vcg.flex.c \
  61. vcg.c \
  62. vcgus.c \
  63. vcgun.c \
  64. lex.hl.c \
  65. dphlparser.c \
  66. dphl.c \
  67. dpmem.c \
  68. json.c \
  69. jgf.c \
  70. bgv.c \
  71. bgvparser.c
  72. #
  73. gml4gtk_CFLAGS = \
  74. @CFLAGS@ @PACKAGE_CFLAGS@ @WARNING_CFLAGS@ @GTK_CFLAGS@
  75. # added zlib
  76. gml4gtk_tolink = @GTK_LIBS@ -lz
  77. # compile with airbus gcc settings
  78. abgcc: $(gml4gtk_SOURCES)
  79. rm -v -f ./gml4gtk
  80. rm -v -f ./O1 ./O2
  81. $(CC) $(AIRBUS_GCC_COMPILER_WARNING) $(GTK_CFLAGS) $(gml4gtk_SOURCES) -I. -I.. $(gml4gtk_tolink) -lm -o gml4gtk 1>O1 2>O2
  82. $(CC) --version
  83. # compile with airbus gcc settings
  84. abclang: $(gml4gtk_SOURCES)
  85. rm -f ./gml4gtk
  86. clang-11 $(AIRBUS_CLANG_COMPILER_WARNING) $(GTK_CFLAGS) $(gml4gtk_SOURCES) -I. -I.. $(gml4gtk_tolink) -lm -o gml4gtk
  87. clang-11 --version
  88. #
  89. gml4gtk$(EXEEXT): $(gml4gtk_SOURCES)
  90. rm -f ./gml4gtk
  91. $(CC) $(gml4gtk_CFLAGS) $(gml4gtk_SOURCES) -I. -I.. $(gml4gtk_tolink) -lm -o gml4gtk
  92. $(CC) --version
  93. # how to re-generate the parsercode
  94. parsers:
  95. echo "run and see the mklp.sh shell script"
  96. # make callgraph based on assembly output.
  97. # uses edges.sh script
  98. callgraph:
  99. make clean
  100. rm -v -f gml4gtk-callgraph.gv
  101. rm -v -f gml4gtk-out.gv
  102. $(CC) -g -S -I. -I.. -O0 $(GTK_CFLAGS) $(gml4gtk_SOURCES)
  103. echo "digraph callgraph {" >gml4gtk-out.gv
  104. cat *.s |./mkedges.sh >>gml4gtk-out.gv
  105. echo "}" >>gml4gtk-out.gv
  106. echo "/* the gtk library calls:" >gml4gtk-callgraph.gv
  107. grep -E '\bgtk_' gml4gtk-out.gv >>gml4gtk-callgraph.gv
  108. grep -E '\bpango_' gml4gtk-out.gv >>gml4gtk-callgraph.gv
  109. grep -E '\bg_' gml4gtk-out.gv >>gml4gtk-callgraph.gv
  110. echo "*/" >>gml4gtk-callgraph.gv
  111. cat gml4gtk-out.gv >>gml4gtk-callgraph.gv
  112. rm -v -f gml4gtk-out.gv
  113. # make callgraph using llvm clang ir bytecode ll file
  114. llvmcallgraph:
  115. make clean
  116. clang -c -I. -I.. -S -O0 -emit-llvm $(GTK_CFLAGS) $(gml4gtk_SOURCES)
  117. python overcg.py -i splay-tree.ll -o splay-tree.ll.callgraph.gv
  118. # using calltree program
  119. # calls to cairo, pango, gtk are not included this way
  120. # using -x option the external routines are there
  121. # the -x graph is big for gml4gtk
  122. # pkg-config --cflags-only-I gtk+-2.0
  123. # -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0
  124. cg:
  125. make clean
  126. calltree -dot -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I. -I.. $(gml4gtk_SOURCES) >gml4gtk-cg.gv
  127. calltree -dot -x -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I. -I.. $(gml4gtk_SOURCES) >gml4gtk-externals-cg.gv
  128. # check json jgf
  129. # or: $(CC) -O0 -g -fdump-ipa-all-graph jsonlint.c json.c -o jsonlint
  130. jsonlint:
  131. rm -f jsonlint
  132. $(CC) -O0 -g jsonlint.c json.c -o jsonlint
  133. #
  134. indent:
  135. ./lindent.sh $(gml4gtk_SOURCES) main.h gml_parser.h gml_scanner.h bubbling.h sugi.h pos.h pos2.h pos3.h hier.h splay-tree.h uniqstr.h uniqnode.h uniqgraph.h vcg.h vcgus.h vcg.yy.h vcg.tab.h vcgun.h json.h jgf.h skip-list.h sfg.c sfg.h
  136. # clang -emit-llvm hello.c -c -o main.bc
  137. # opt -dot-cfg-only main.bc
  138. bc:
  139. clang -emit-llvm -c @CFLAGS@ @PACKAGE_CFLAGS@ @GTK_CFLAGS@ -I. -I.. sugi2.c -o sugi2.bc
  140. opt-7 -dot-cfg-only sugi2.bc
  141. opt-7 -dot-cfg sugi2.bc
  142. opt-7 -dot-dom sugi2.bc
  143. opt-7 -dot-postdom sugi2.bc
  144. opt-7 -dot-callgraph sugi2.bc
  145. # windows version
  146. # the G_OS_WIN32 flag is used to change settings in glib-2/gio/ gcredentials.h and uid_t
  147. # the _WIN32 is used by libxml2
  148. gml4gtk_exeCFLAGS = \
  149. -mms-bitfields \
  150. -DWIN32 \
  151. -D_WIN32
  152. # also need zlib.h
  153. gml4gtk_exeincludes = \
  154. -I../w64/include/gtk-3.0 \
  155. -I../w64/include/glib-2.0 \
  156. -I../w64/lib/glib-2.0/include \
  157. -I../w64/include/pango-1.0 \
  158. -I../w64/include/cairo \
  159. -I../w64/include/gdk-pixbuf-2.0 \
  160. -I../w64/include/atk-1.0 \
  161. -I../w64/include/
  162. # static link with the dll.a files
  163. gml4gtk_exedlla = \
  164. ../w64/lib/libgobject-2.0.dll.a \
  165. ../w64/lib/libgtk-3.dll.a \
  166. ../w64/lib/libatk-1.0.dll.a \
  167. ../w64/lib/libcairo.dll.a \
  168. ../w64/lib/libcairo-gobject.dll.a \
  169. ../w64/lib/libcairo-script-interpreter.dll.a \
  170. ../w64/lib/libcroco-0.6.dll.a \
  171. ../w64/lib/libffi.dll.a \
  172. ../w64/lib/libfontconfig.dll.a \
  173. ../w64/lib/libfreetype.dll.a \
  174. ../w64/lib/libgailutil-3.dll.a \
  175. ../w64/lib/libgdk-3.dll.a \
  176. ../w64/lib/libgdk_pixbuf-2.0.dll.a \
  177. ../w64/lib/libgio-2.0.dll.a \
  178. ../w64/lib/libglib-2.0.dll.a \
  179. ../w64/lib/libgmodule-2.0.dll.a \
  180. ../w64/lib/libgthread-2.0.dll.a \
  181. ../w64/lib/libjasper.dll.a \
  182. ../w64/lib/libjpeg.dll.a \
  183. ../w64/lib/liblzma.dll.a \
  184. ../w64/lib/libpango-1.0.dll.a \
  185. ../w64/lib/libpangocairo-1.0.dll.a \
  186. ../w64/lib/libpangoft2-1.0.dll.a \
  187. ../w64/lib/libpangowin32-1.0.dll.a \
  188. ../w64/lib/libpixman-1.dll.a \
  189. ../w64/lib/libpng15.dll.a \
  190. ../w64/lib/libpng.dll.a \
  191. ../w64/lib/librsvg-2.dll.a \
  192. ../w64/lib/libtiff.dll.a \
  193. ../w64/lib/libtiffxx.dll.a \
  194. ../w64/lib/libxml2.dll.a \
  195. ../w64/lib/libz.dll.a
  196. gml4gtk_exedlla2 = \
  197. -llibgobject-2.0.dll.a \
  198. -llibgtk-3.dll.a \
  199. -llibatk-1.0.dll.a \
  200. -llibcairo.dll.a \
  201. -llibcairo-gobject.dll.a \
  202. -llibcairo-script-interpreter.dll.a \
  203. -llibcroco-0.6.dll.a \
  204. -llibffi.dll.a \
  205. -llibfontconfig.dll.a \
  206. -llibfreetype.dll.a \
  207. -llibgailutil-3.dll.a \
  208. -llibgdk-3.dll.a \
  209. -llibgdk_pixbuf-2.0.dll.a \
  210. -llibgio-2.0.dll.a \
  211. -llibglib-2.0.dll.a \
  212. -llibgmodule-2.0.dll.a \
  213. -llibgthread-2.0.dll.a \
  214. -llibjasper.dll.a \
  215. -llibjpeg.dll.a \
  216. -lliblzma.dll.a \
  217. -llibpango-1.0.dll.a \
  218. -llibpangocairo-1.0.dll.a \
  219. -llibpangoft2-1.0.dll.a \
  220. -llibpangowin32-1.0.dll.a \
  221. -llibpixman-1.dll.a \
  222. -llibpng15.dll.a \
  223. -llibpng.dll.a \
  224. -llibrsvg-2.dll.a \
  225. -llibtiff.dll.a \
  226. -llibtiffxx.dll.a \
  227. -llibxml2.dll.a \
  228. -llibz.dll.a
  229. # cross compiling windows 64bit exe on linux
  230. # static linking should be theoretically possible
  231. # but any usable docs are missing
  232. gml4gtkexe: main.c
  233. x86_64-w64-mingw32-windres gml4gtk.rc demo-gml4gtk.o
  234. x86_64-w64-mingw32-gcc -c $(gml4gtk_exeCFLAGS) -I. -I.. $(gml4gtk_exeincludes) $(gml4gtk_SOURCES)
  235. x86_64-w64-mingw32-gcc -v *.o -Wl,-Bstatic $(gml4gtk_exedlla) -Wl,-Bdynamic -o gml4gtk.exe
  236. # this does not worl
  237. # x86_64-w64-mingw32-gcc -v -L. *.o -Wl,-Bstatic -l $(gml4gtk_exedlla) -Wl,-Bdynamic -o gml4gtk.exe
  238. # this does not work
  239. # x86_64-w64-mingw32-gcc *.o -L../w64/lib/ $(gml4gtk_exedlla2) -o gml4gtk64.exe
  240. # 32 bits compiling does not work on debian or fedora
  241. # x86_64-w64-mingw32-windres --target=pe-i386 gml4gtk.rc demo-gml4gtk.o
  242. # i686-w64-mingw32-gcc -m32 -c $(gml4gtk_exeCFLAGS) -I. -I.. $(gml4gtk_exeincludes) $(gml4gtk_SOURCES)
  243. # cp 0gtk.bin 0gtk.a
  244. # i686-w64-mingw32-gcc -v -Wl,-bpe-i386 -m32 *.o 0gtk.a -o 0big.o
  245. # result: the gtk binary compiled code cannot be used because it is compiled with gcc compiler older then version 10
  246. # this generate a 32bit windos exe which still needs dll's
  247. # but installed the fedora mingw static gtk-2
  248. # this does not work yet
  249. pe:
  250. i686-w64-mingw32-windres gml4gtk.rc demo-gml4gtk.o
  251. i686-w64-mingw32-gcc -I. -I.. $(gml4gtk_SOURCES) `i686-w64-mingw32-pkg-config --cflags gtk+-win32-2.0` `i686-w64-mingw32-pkg-config --libs gtk+-win32-2.0` -lz -o 0o.exe
  252. # splay tree tester n- this may try to nuse more memory then ram and disk swap space on your GNU/Linux computer
  253. # maybe safer to first doing a sync before running ./spt
  254. spt:
  255. rm -v -f ./spt
  256. $(CC) $(AIRBUS_GCC_COMPILER_WARNING) -g spt.c -o spt
  257. ./lindent.sh spt.c
  258. sync
  259. #
  260. clean-generic:
  261. rm -v -f *.bc
  262. rm -v -f ./massif.out.*
  263. rm -v -f ./*.rhp.txt
  264. rm -v -f ./a.out
  265. rm -v -f *~
  266. rm -v -f ./*.so.1
  267. rm -v -f ./*.o
  268. rm -v -f ./*.a
  269. rm -v -f ./*.i
  270. rm -v -f ./*.s
  271. rm -v -f ./O
  272. rm -v -f ./OO
  273. rm -v -f ./O1
  274. rm -v -f ./O2
  275. rm -v -f ./O3
  276. rm -v -f ./ID
  277. rm -v -f ./dsmake.output
  278. rm -v -f ./dsmake.warnings
  279. rm -v -f ./dsmake.errors
  280. rm -v -f *.dot
  281. rm -v -f *.ll
  282. rm -v -f *.*r.*
  283. rm -v -f *.*t.*
  284. rm -v -f *.bc
  285. rm -v -f *.plist
  286. rm -v -f *.ps
  287. rm -v -f ./*.exe
  288. rm -v -f jsonlint
  289. rm -v -f ./*.gk*
  290. rm -v -f ./*.out
  291. rm -v -f ./*.res
  292. rm -v -f ./gml4gtk-cg.gv
  293. rm -v -f *.scallgraph.gv
  294. rm -v -f -r .deps
  295. rm -v -f *graph-info.gv
  296. rm -v -f *graph-info.svg
  297. rm -v -f *graph-info.ci
  298. rm -v -f *.ci
  299. rm -v -f gml4gtk-*
  300. rm -v -f ./spt
  301. # /* end */