Advertisement
cheako

Documenting shortcomings in make.

Feb 17th, 2018
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. # Makefile for cheako-vulkan
  2.  
  3. .SUFFIXES: .h.in .h # Add .h.in and .h as suffixes
  4.  
  5. M4 = m4
  6. M4FLAGS =
  7. M4SCRIPT =
  8.  
  9. %.h: %.h.in
  10. ${M4} ${M4FLAGS} ${M4SCRIPT} $< > $*.h
  11.  
  12. %.so: %.c
  13. $(COMPILE.c) -shared $(OUTPUT_OPTION) $<
  14.  
  15. LDFLAGS = -Wl,-rpath,\$$ORIGIN -L.
  16. LDLIBS = -lhand_data
  17.  
  18. # Include debug symbols and warn on all
  19. CFLAGS = -g -Wall
  20.  
  21. # Our single executable
  22. OBJS = libhand_data.so vulkan_test
  23.  
  24. all: $(OBJS)
  25.  
  26. vulkan_test: spv.h $(shell pkg-config --libs glfw3) -lvulkan
  27.  
  28. spv.h: vert.spv frag.spv
  29.  
  30. vert.spv: tri.vert
  31. glslangValidator -V $<
  32.  
  33. frag.spv: tri.frag
  34. glslangValidator -V $<
  35.  
  36. clean:
  37. rm -f $(OBJS) spv.h vert.spv frag.spv
  38.  
  39. # valgrind discovers bugs, google it.
  40. test: clean all
  41. valgrind ./vulkan_test
  42.  
  43. .PHONY: all clean test
  44.  
  45. ###########
  46. # RESULTS #
  47. ###########
  48. cheako@debian:~/src/github/cheako-vulkan$ make clean
  49. rm -f libhand_data.so vulkan_test spv.h vert.spv frag.spv
  50. cheako@debian:~/src/github/cheako-vulkan$ make
  51. cc -g -Wall -c -shared -o libhand_data.so libhand_data.c
  52. glslangValidator -V tri.vert
  53. tri.vert
  54. glslangValidator -V tri.frag
  55. tri.frag
  56. m4 spv.h.in > spv.h
  57. cc -g -Wall -Wl,-rpath,\$ORIGIN -L. vulkan_test.c spv.h /usr/lib/i386-linux-gnu/libglfw.so /usr/lib/i386-linux-gnu/libvulkan.so -lhand_data -o vulkan_test
  58. cheako@debian:~/src/github/cheako-vulkan$ ldd ./vulkan_test | grep hand
  59. cheako@debian:~/src/github/cheako-vulkan$ nm ./vulkan_test | grep hand_
  60. 00007140 D hand_data_model
  61. 000071c0 D hand_data_model_count
  62.  
  63. ############
  64. # Expected #
  65. ############
  66. hand_data_model should be undefined, "U".
  67. libhand_data.so should be listed as an shared object dependency.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement