1. # makefile for Lua hierarchy
  2. # see INSTALL for installation instructions
  3. # see config for customization instructions
  4. LUA= .
  5. include $(LUA)/config
  6. # primary targets ("co" and "klean" are used for making the distribution)
  7. all clean co klean: dirs
  8. cd include; $(MAKE) $@
  9. cd src; $(MAKE) $@
  10. cd src/lib; $(MAKE) $@
  11. # in case they were not created during unpacking
  12. dirs: lib
  13. lib:
  14. mkdir -p $@
  15. # simple test to see Lua working
  16. test: all
  17. bin/lua test/hello.lua
  18. # remove debug information from binaries
  19. strip:
  20. $(STRIP) bin/*
  21. # official installation
  22. install: all strip
  23. mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN)
  24. $(INSTALL_EXEC) bin/* $(INSTALL_BIN)
  25. $(INSTALL_DATA) include/*.h $(INSTALL_INC)
  26. $(INSTALL_DATA) lib/*.a $(INSTALL_LIB)
  27. $(INSTALL_DATA) doc/*.1 $(INSTALL_MAN)
  28. # shared libraries (for Linux)
  29. so:
  30. ld -o lib/liblua.so.$V -shared src/*.o
  31. ld -o lib/liblualib.so.$V -shared src/lib/*.o
  32. cd lib; ln -fs liblua.so.$V liblua.so; ln -fs liblualib.so.$V liblualib.so
  33. # binaries using shared libraries
  34. sobin:
  35. rm -f bin/*
  36. cd src/lua; $(MAKE)
  37. cd src/luac; $(MAKE)
  38. # install shared libraries
  39. soinstall:
  40. $(INSTALL_EXEC) lib/*.so.* $(INSTALL_LIB)
  41. cd $(INSTALL_LIB); ln -fs liblua.so.$V liblua.so; ln -fs liblualib.so.$V liblualib.so
  42. # clean shared libraries
  43. soclean:
  44. rm -f lib/*.so* bin/*
  45. # echo config parameters
  46. echo:
  47. @echo ""
  48. @echo "These are the parameters currently set in $(LUA)/config to build Lua $V:"
  49. @echo ""
  50. @echo "LOADLIB = $(LOADLIB)"
  51. @echo "DLLIB = $(DLLIB)"
  52. @echo "NUMBER = $(NUMBER)"
  53. @echo "POPEN = $(POPEN)"
  54. @echo "TMPNAM = $(TMPNAM)"
  55. @echo "DEGREES = $(DEGREES)"
  56. @echo "USERCONF = $(USERCONF)"
  57. @echo "CC = $(CC)"
  58. @echo "WARN = $(WARN)"
  59. @echo "MYCFLAGS = $(MYCFLAGS)"
  60. @echo "MYLDFLAGS = $(MYLDFLAGS)"
  61. @echo "EXTRA_LIBS = $(EXTRA_LIBS)"
  62. @echo "AR = $(AR)"
  63. @echo "RANLIB = $(RANLIB)"
  64. @echo "STRIP = $(STRIP)"
  65. @echo "INSTALL_ROOT = $(INSTALL_ROOT)"
  66. @echo "INSTALL_BIN = $(INSTALL_BIN)"
  67. @echo "INSTALL_INC = $(INSTALL_INC)"
  68. @echo "INSTALL_LIB = $(INSTALL_LIB)"
  69. @echo "INSTALL_MAN = $(INSTALL_MAN)"
  70. @echo "INSTALL_EXEC = $(INSTALL_EXEC)"
  71. @echo "INSTALL_DATA = $(INSTALL_DATA)"
  72. @echo ""
  73. @echo "Edit $(LUA)/config if needed to suit your platform and then run make."
  74. @echo ""
  75. # turn config into Lua code
  76. # uncomment the last sed expression if you want nil instead of empty strings
  77. lecho:
  78. @echo "-- $(LUA)/config for Lua $V"
  79. @echo "VERSION = '$(V)'"
  80. @make echo | grep = | sed -e 's/= /= "/' -e 's/$$/"/' #-e 's/""/nil/'
  81. @echo "-- EOF"
  82. # (end of Makefile)