Source:NetHack 5.0.0/dat/luahelper

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to luahelper from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/dat/luahelper#line12]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1. # NetHack 5.0  luahelper    $NHDT-Date: $  $NHDT-Branch: NetHack-3.7 $
2. #
3. #  Makefile to assist developers in adding lines to various build
4. #  Makefiles, or project files, as lua files are added or removed.
5. #  NetHack may be freely redistributed.  See license for details.
6. #
7. #  Must be run while your current directory is the top of the
8. #  NetHack source tree.
9. #
10. #     make -f dat/luahelper [target]
11. #
12. #  Target examples:
13. #
14. #  Visual Studio nmake  : make -f dat/luahelper devhelp-nmake >file.txt
15. #
16. #  Visual Studio project: make -f dat/luahelper devhelp-vstudio >file.txt
17. #
18. #  MSYS2 GNUmakefile    : make -f dat/luahelper devhelp-msys2 >file.txt
19. #
20. #  Xcode project.pbxproj: make -f dat/luahelper devhelp-xcode >file.txt
21. #
22. #
23. 
24. MAKEFLAGS += --no-print-directory
25. AWK=awk
26. 
27. 
28. luanames = asmodeus baalz bigrm-* castle fakewiz? juiblex knox medusa-? \
29. 	minend-? minefill minetn-? oracle orcus sanctum soko?-? tower? \
30. 	valley wizard? nhcore nhlib themerms astral air earth fire water \
31. 	hellfill tut-? ???-goal ???-fil? ???-loca ???-strt \
32. 	dungeon quest
33. 
34. alllua = $(wildcard $(addsuffix .lua,$(addprefix dat/, $(luanames))))
35. 
36. #
37. # generates lines to insert into
38. # sys/windows/Makefile.nmake
39. # 
40. devhelp-nmake:
41. 	@echo "$(notdir $(alllua))" | \
42. 	    $(AWK) '{for (i=1; i<=NF; ++i)printf "%s%s%s%s", \
43. 	        i == 1? "LUA_FILES = " : "", \
44. 	        "$$(DAT)", \
45. 		$$i, \
46. 	        i % 3? " ": ((i == NF)? "\n" : " \\\n\t")} \
47. 	        i % 3{print ""}'
48. 	@echo ""
49. 
50. #
51. # generates lines to insert into
52. # sys/windows/GNUmakefile
53. #
54. devhelp-msys2:
55. 	@echo "$(basename $(notdir $(alllua)))" | \
56. 	    $(AWK) '{for (i=1; i<=NF; ++i)printf "%s%s%s", \
57. 	        i == 1? "LUALIST = " : "", \
58. 		$$i, \
59. 	        i % 5? " ": ((i == NF)? "\n" : " \\\n\t")} \
60. 	        i % 5{print ""}'
61. 	@echo ""
62. 
63. xcodeextra = bogusmon cmdhelp data engrave epitaph help hh \
64. 	    history keyhelp opthelp optmenu options oracles \
65. 	    rumors tribute wizhelp
66. #
67. # generates lines to insert into
68. # sys/unix/NetHack.xcodeproj/project.pbxproj
69. #
70. devhelp-xcode:
71. 	@echo "\t\t\tinputPaths = ("
72. 	@echo "$(xcodeextra) $(notdir $(alllua))" | \
73. 	    $(AWK) '{for (i=1; i<=NF; ++i)printf "%s%s%s%s%s", \
74. 	        i == 1? "\t" : "", \
75. 		"\t\t\t\042$$(NH_DAT_DIR)/", \
76. 		$$i, \
77. 		"\042", \
78. 		i % 1? " ": ((i == NF)? "\n" : ",\n\t")} \
79. 		i % 1{print ""}'
80. 	@echo "\t\t\t);"
81. #
82. # generates lines to insert into
83. # sys/windows/vs/files.props
84. #
85. devhelp-vstudio:
86. 	@echo "  <ItemGroup>"
87. 	@echo "$(notdir $(alllua))" | \
88. 	    $(AWK) '{for (i=1; i<=NF; ++i)printf "%s%s%s%s%s", \
89. 	        i == 1? "    " : "", \
90. 		"<Luafiles Include = \042", \
91. 		$$i, \
92. 		"\042/>", \
93. 		i % 1? " ": ((i == NF)? "\n" : "\n    ")} \
94. 		i % 1{print ""}'
95. 	@echo "  </ItemGroup>"
96. 
97. all:
98. 	make -f dat/luahelper devhelp-nmake >./luahelp-nmake.txt
99. 	make -f dat/luahelper devhelp-msys2 >./luahelp-msys2.txt
100. 	make -f dat/luahelper devhelp-xcode >./luahelp-xcode.txt
101. 	make -f dat/luahelper devhelp-vstudio >./luahelp-vstudio.txt
102. # end