repeat83

makefile.mingw for TomeNet 4.6.0

Jul 21st, 2015
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.47 KB | None | 0 0
  1. # $Id$
  2. # File: Makefile
  3.  
  4. # This is not a very "nice" Makefile, but it usually works.
  5.  
  6. #
  7. # Note that you may have to make modifications below according
  8. # to your machine, available libraries, compilation options,
  9. # and your "visual module" of choice. This Makefile is intended
  10. # for use with Unix machines running X11, Curses, Ncurses, or Vt100,
  11. # or possibly for "Atari" or "Amiga" computers with "Curses" ports,
  12. # see below for more information.
  13. #
  14. # Note that "main-mac.c", the visual module for the Macintosh,
  15. # must be compiled in a special way, see elsewhere.
  16. #
  17. # Note that "main-win.c", the visual module for Windows,
  18. # must be compiled in a special way, see elsewhere.
  19. #
  20. # Note that "main-ibm.c", "main-emx.c", and "main-286.c",
  21. # the visual modules for various types of IBM-PC computers,
  22. # must be compiled with special Makefiles, see elsewhere.
  23. #
  24. # Note that "main-lsl.c", the visual module for ???,
  25. # must be compiled with "Makefile.lsl", see elsewhere.
  26. #
  27. # Note that "main-acn.c", the visual module for Risc Acorn,
  28. # must be compiled with "Makefile.acn", see elsewhere.
  29. #
  30. # Note that "Makefile.w31" and "Makefile.wat" are slight variations
  31. # on "Makefile.win" and "Makefile.ibm", respectively, which allow
  32. # the use of the "main-win.c" and "main-ibm.c" files, respectively,
  33. # with special compilers.
  34. #
  35. # If you are able to construct "main-xxx.c" and\or "Makefile.xxx"
  36. # files for a currently unsupported system, please send them to me
  37. # ([email protected]) for inclusion in future versions.
  38. #
  39. # This Makefile comes with "default" dependancies that may be obsolete.
  40. #
  41. # You may want to run "make depend" if you are planning on changing
  42. # anything.
  43. #
  44.  
  45.  
  46. #
  47. # The "source" and "object" files.
  48. #
  49.  
  50. SERV_SRCS = \
  51. common\z-util.c common\z-virt.c common\z-form.c common\z-rand.c \
  52. common\net-win.c common\sockbuf.c common\common.c \
  53. server\variable.c server\control.c server\hooks.c \
  54. server\party.c server\tables.c server\util.c server\cave.c \
  55. server\object1.c server\object2.c server\monster2.c \
  56. server\xtra1.c server\xtra2.c server\spells1.c server\spells2.c \
  57. server\melee1.c server\melee2.c server\save.c server\files.c \
  58. server\cmd1.c server\cmd2.c server\cmd3.c server\cmd4.c server\cmd5.c \
  59. server\cmd6.c server\store.c server\birth.c server\load2.c server\randart.c \
  60. server\sched-win.c server\generate.c server\wild.c server\dungeon.c \
  61. server\init1.c server\init2.c server\nserver.c server\printout.c \
  62. server\main.c server\traps.c server\csfunc.c server\skills.c server\bldg.c \
  63. common\files.c common\w_z_pack.c server\world.c server\slash.c \
  64. server\runecraft.c server\auction.c server\quests.c common\SFMT.c \
  65. server\go.c server\metaclient.c common\tables.c
  66.  
  67. SERV_OBJS = \
  68. common\z-util.o common\z-virt.o common\z-form.o common\z-rand.o \
  69. common\net-win.o common\sockbuf.o common\common.o \
  70. server\variable.o server\control.o server\hooks.o \
  71. server\party.o server\tables.o server\util.o server\cave.o \
  72. server\object1.o server\object2.o server\monster2.o \
  73. server\xtra1.o server\xtra2.o server\spells1.o server\spells2.o \
  74. server\melee1.o server\melee2.o server\save.o server\files.o \
  75. server\cmd1.o server\cmd2.o server\cmd3.o server\cmd4.o server\cmd5.o \
  76. server\cmd6.o server\store.o server\birth.o server\load2.o server\randart.o \
  77. server\sched-win.o server\generate.o server\wild.o server\dungeon.o \
  78. server\init1.o server\init2.o server\nserver.o server\printout.o \
  79. server\main.o server\traps.o server\csfunc.o server\skills.o server\bldg.o \
  80. common\files.o common\w_z_pack.o server\world.o server\slash.o \
  81. server\runecraft.o server\auction.o server\quests.o common\SFMT.o \
  82. server\go.o server\metaclient.o common\tables.o
  83.  
  84.  
  85. CLI_SRCS = \
  86. common\z-util.c common\z-virt.c common\z-form.c common\z-rand.c \
  87. common\net-win.c common\sockbuf.c common\net-ibm.c common\common.c \
  88. client\z-term.c client\c-util.c client\c-cmd.c client\c-inven.c \
  89. client\c-files.c client\c-tables.c client\c-store.c client\c-init.c \
  90. client\variable.c client\readdib.c client\main-win.c client\nclient.c \
  91. client\c-birth.c client\c-xtra1.c client\c-xtra2.c client\c-spell.c \
  92. client\skills.c common\files.c common\SFMT.c client\snd-sdl.c \
  93. common\tables.c client\manifest.res
  94. # client\main-ibm.c client\main-cap.c client\main-gcu.c client\main-x11.c client\main-xaw.c
  95. # client\client.c
  96.  
  97. CLI_OBJS = \
  98. common\z-util.o common\z-virt.o common\z-form.o common\z-rand.o \
  99. common\net-win.o common\sockbuf.o common\net-ibm.o common\common.o \
  100. client\z-term.o client\c-util.o client\c-cmd.o client\c-inven.o \
  101. client\c-files.o client\c-tables.o client\c-store.o client\c-init.o \
  102. client\variable.o client\readdib.o client\main-win.o client\nclient.o \
  103. client\c-birth.o client\c-xtra1.o client\c-xtra2.o client\c-spell.o \
  104. client\skills.o common\files.o common\SFMT.o client\snd-sdl.o \
  105. common\tables.o client\icon.o client\manifest.o
  106. # client\main-ibm.o client\main-cap.o client\main-gcu.o client\main-x11.o client\main-xaw.o
  107. # client\client.o
  108.  
  109. CONS_SRCS = \
  110. common\z-util.c common\z-virt.c common\z-form.c common\net-unix.c \
  111. common\sockbuf.c common\net-ibm.c common\common.c \
  112. client\z-term.c \
  113. client\main-ibm.c client\main-cap.c client\main-gcu.c \
  114. client\main-x11.c client\main-xaw.c \
  115. console\variable.c console\c-util.c console\console.c console\c-init.c
  116.  
  117. CONS_OBJS = \
  118. common\z-util.o common\z-virt.o common\z-form.o common\net-unix.o \
  119. common\sockbuf.o common\net-ibm.o common\common.o \
  120. client\z-term.o \
  121. client\main-ibm.o client\main-cap.o client\main-gcu.o \
  122. client\main-x11.o client\main-xaw.o \
  123. console\variable.o console\c-util.o console\console.o console\c-init.o
  124.  
  125.  
  126. LUASRCS = \
  127. server\script.c server\lua_bind.c \
  128. server\w_util.c server\w_play.c server\w_spells.c
  129.  
  130. # TODO: lua directory should be under common\ and not server\
  131. TOLUASRCS = \
  132. server\lua\lapi.c server\lua\lcode.c server\lua\ldebug.c server\lua\ldo.c server\lua\lfunc.c server\lua\lgc.c \
  133. server\lua\llex.c server\lua\lmem.c server\lua\lobject.c server\lua\lparser.c server\lua\lstate.c server\lua\lstring.c \
  134. server\lua\ltable.c server\lua\ltests.c server\lua\ltm.c server\lua\lundump.c server\lua\lvm.c server\lua\lzio.c \
  135. server\lua\lauxlib.c server\lua\lbaselib.c server\lua\ldblib.c server\lua\liolib.c server\lua\lstrlib.c \
  136. server\lua\tolua_lb.c server\lua\tolua_rg.c server\lua\tolua_tt.c server\lua\tolua_tm.c server\lua\tolua_gp.c \
  137. server\lua\tolua_eh.c server\lua\tolua_bd.c server\lua\lmathlib.c
  138.  
  139. LUAOBJS = \
  140. server\script.o server\lua_bind.o \
  141. server\w_util.o server\w_play.o server\w_spells.o
  142.  
  143. TOLUAOBJS = \
  144. server\lua\lapi.o server\lua\lcode.o server\lua\ldebug.o server\lua\ldo.o server\lua\lfunc.o server\lua\lgc.o \
  145. server\lua\llex.o server\lua\lmem.o server\lua\lobject.o server\lua\lparser.o server\lua\lstate.o server\lua\lstring.o \
  146. server\lua\ltable.o server\lua\ltests.o server\lua\ltm.o server\lua\lundump.o server\lua\lvm.o server\lua\lzio.o \
  147. server\lua\lauxlib.o server\lua\lbaselib.o server\lua\ldblib.o server\lua\liolib.o server\lua\lstrlib.o \
  148. server\lua\tolua_lb.o server\lua\tolua_rg.o server\lua\tolua_tt.o server\lua\tolua_tm.o server\lua\tolua_gp.o \
  149. server\lua\tolua_eh.o server\lua\tolua_bd.o server\lua\lmathlib.o
  150.  
  151. CLI_LUASRCS = \
  152. client\c-script.c client\lua_bind.c \
  153. client\w_play.c client\w_util.c client\w_spells.c
  154.  
  155. # server\lua_bind.c \
  156. # server\w_util.c server\w_play.c
  157.  
  158. CLI_LUAOBJS = \
  159. client\c-script.o client\lua_bind.o \
  160. client\w_play.o client\w_util.o client\w_spells.o
  161.  
  162.  
  163. ##
  164. ## Following are some "system" definitions
  165. ##
  166. ## No changes are needed to compile a version that will run on both
  167. ## X11 and Curses, in debugging mode, with maximal warnings, on many
  168. ## normal Unix machines of the Sun OS variety (non-solaris).
  169. ##
  170. ## To use an "alternative" definition, simply "modify" (or "replace")
  171. ## the definition below with one that you like. For example, you can
  172. ## change the compiler to "cc", or remove the "debugging" options, or
  173. ## remove the X11 or Curses support, etc, as desired.
  174. ##
  175. ## See also "config.h" and "h-config.h" for important information.
  176. ##
  177. ## Some "examples" are given below, they can be used by simply
  178. ## removing the FIRST column of "#" signs from the "block" of lines
  179. ## you wish to use, and commenting out "standard" block below.
  180. ##
  181. ## This is not intended to be a "good" Makefile, just a "simple" one.
  182. ##
  183.  
  184.  
  185. #
  186. # This is my compiler of choice, it seems to work most everywhere
  187. #
  188. #CC = gcc
  189.  
  190. # For allowing #if..#else..#endif constructs in LUA files - C. Blue
  191. # Note: The flags must contain
  192. # 1) the option that turns off elimination of comment lines (ie cpp
  193. # must just copy comments 1:1). Usually this is '-C'.
  194. # 2) the option that turns off generation of a preprocessor header
  195. # (lines starting on '# '). Usually this is '-P'.
  196. # Also, if your system doesnt have a dedicated cpp command, you might
  197. # need to use the gcc invocation below instead.
  198. #
  199. # cpp variant:
  200. #CPP = cpp
  201. #CPPFLAGS = -C -P
  202. # gcc variant:
  203. #CPP = gcc
  204. #CPPFLAGS = -x c -E -Wp,-C,-P
  205.  
  206.  
  207.  
  208. #
  209. # Standard version (see main-x11.c and main-gcu.c)
  210. #
  211. # This version supports both "X11" and "curses" in a single executable.
  212. #
  213. # You may have to add various X11 include\library directories to the
  214. # "CFLAGS", if your machine places files in a weird location.
  215. #
  216. # You may be able to remove "-ltermcap" on some machines (ex: Solaris).
  217. #
  218. # You may have to replace "-lcurses" with "-lncurses" to use the
  219. # "new curses" library instead of the "old curses" library, and
  220. # you may have to add "-l\usr\include\ncurses" to the "CFLAGS".
  221. #
  222. # See "main-gcu.c" and "config.h" for some optional "curses" defines,
  223. # including "USE_GETCH" and "USE_CURS_SET". Note that "config.h" will
  224. # attempt to "guess" at many of these flags based on your system.
  225. #
  226. #CFLAGS = -Wall -g -pipe -DUSE_X11 -DUSE_GCU
  227. #LIBS = -L\usr\X11R6\lib -lX11 -lcurses
  228.  
  229. #
  230. # Path to sdl-config
  231. #
  232. # You may need to replace \usr\mingw32 by whatever prefix your
  233. # cross-compiling tools use.
  234. #
  235. SDL_CONFIG = \usr\mingw32\bin\sdl-config
  236.  
  237. ##
  238. ## Variation -- MinGW on Linux
  239. ##
  240. ## With SDL, using 'sdl-config':
  241. #CFLAGS = -g -Wall -D__USE_W32_SOCKETS -DWIN32 -DDUMB_WIN -DMINGW -DMEXP=19937 -DSOUND_SDL `$(SDL_CONFIG) --cflags` -DWINVER=0x0501 -Wno-unused-but-set-variable
  242. #LIBS = -lkernel32 -luser32 -lwsock32 -lgdi32 -lcomdlg32 -lwinmm -lSDL -lSDL_mixer `$(SDL_CONFIG) --libs`
  243. ##
  244. ## With SDL, without using 'sdl-config', entered SDL's include\lib folders manually (as located on my system - C. Blue):
  245. CFLAGS = -g -Wall -D__USE_W32_SOCKETS -DWIN32 -DDUMB_WIN -DMINGW -DMEXP=19937 -DSOUND_SDL -I\usr\i486-mingw32\include\SDL -Iinclude\SDL -DWINVER=0x0501 -Wno-unused-but-set-variable -DACC32
  246. LIBS = -lkernel32 -luser32 -lwsock32 -lgdi32 -lcomdlg32 -lwinmm -lSDL -lSDL_mixer -L\usr\i486-mingw32\lib -Llib
  247. ##
  248. ## Without SDL:
  249. #CFLAGS = -g -Wall -D__USE_W32_SOCKETS -DWIN32 -DDUMB_WIN -DMINGW -DMEXP=19937
  250. #LIBS = -lkernel32 -luser32 -lwsock32 -lgdi32 -lcomdlg32 -lwinmm
  251.  
  252. # Added the according preprocessor for 'preproc' - C. Blue
  253. # If your system doesnt have a dedicated cpp command, you might
  254. # need to use the gcc invocation below instead.
  255. #
  256. # cpp variant:
  257. #CPP = mingw32-cpp
  258. #CPPFLAGS = -C -P
  259. # gcc variant:
  260. CPP = mingw32-gcc
  261. CPPFLAGS = -x c -E -Wp,-C,-P
  262. WINDRES = windres
  263.  
  264. # Use these on Ubuntu
  265. #CC = i586-mingw32msvc-gcc
  266. #WINDRES = i586-mingw32msvc-windres
  267. #CPP = i586-mingw32msvc-cpp
  268. #CPPFLAGS = -C -P
  269.  
  270. # Use these on other Linux systems, possibly
  271. #CC = i386-mingw32msvc-gcc
  272. #WINDRES = i386-mingw32msvc-windres
  273. #CPP = i386-mingw32msvc-cpp
  274. #CPPFLAGS = -C -P
  275.  
  276. # MinGW compiler and linker on my system - mikaelh
  277. #CC = mingw32-gcc
  278. #WINDRES = mingw32-windres
  279.  
  280. # MinGW compiler, linker and preprocessor on mine - C. Blue
  281. #CC = i486-mingw32-gcc
  282. #WINDRES = i486-mingw32-windres
  283. #CPP = i486-mingw32-gcc
  284. #CPPFLAGS = -x c -E -Wp,-C,-P
  285.  
  286.  
  287. # Native Linux gcc for compiling preproc.
  288. # Todo actually: Fix this to allow preproc-win.c -> preproc.exe compilation and use,
  289. # currently preproc.exe couldn't access the CPP from within wine environment.
  290. NCC = gcc
  291.  
  292.  
  293. # Compile a client with 'test client' version\tag
  294. tomenet.test.exe: CFLAGS += -DTEST_CLIENT -O0
  295.  
  296. # Normal release build
  297. tomenet.exe: CFLAGS += -O2
  298.  
  299.  
  300. # Lua
  301. SRCS += $(LUASRCS)
  302. SRCS += $(CLI_LUASRCS)
  303. SERV_OBJS += $(LUAOBJS)
  304. SERV_SRCS += $(TOLUASRCS)
  305. SERV_OBJS += $(TOLUAOBJS)
  306. CLI_OBJS += $(CLI_LUAOBJS)
  307. CLI_SRCS += $(TOLUASRCS)
  308. CLI_OBJS += $(TOLUAOBJS)
  309. CFLAGS += $(LUAFLAGS) -Iserver -Iserver\lua
  310.  
  311. TOLUA = server\tolua.exe
  312.  
  313. #
  314. # Hack -- "install" as the base target
  315. #
  316. # If you want to build a server, remove the two hashes from the lines
  317. # below.
  318. #
  319.  
  320. install: date tomenet.exe tomenet.server.exe
  321. copy /b tomenet.exe ..
  322. copy /b tomenet.server.exe ..
  323.  
  324. mini_install: install
  325.  
  326. date:
  327. # touch common\common.c
  328. cd common & copy /b common.c +,, & cd ..
  329.  
  330. #
  331. # Build the TomeNET server
  332. #
  333.  
  334. tomenet.server.exe: $(SERV_OBJS) $(TOLUA)
  335. $(CC) $(CFLAGS) $(LDFLAGS) -o tomenet.server.exe $(SERV_OBJS) $(LIBS)
  336.  
  337.  
  338. #
  339. # Build the TomeNET client
  340. #
  341.  
  342. tomenet.exe: $(CLI_OBJS) $(TOLUA)
  343. $(CC) $(CFLAGS) $(LDFLAGS) -mwindows -o tomenet.exe $(CLI_OBJS) $(LIBS)
  344.  
  345. tomenet.test.exe: $(CLI_OBJS) $(TOLUA)
  346. $(CC) $(CFLAGS) $(LDFLAGS) -mwindows -o tomenet.exe $(CLI_OBJS) $(LIBS)
  347.  
  348.  
  349. #
  350. # Build the TomeNET remote console
  351. #
  352.  
  353. tomenet.console.exe: $(CONS_OBJS)
  354. $(CC) $(CFLAGS) $(LDFLAGS) -o tomenet.console.exe $(CONS_OBJS) $(LIBS)
  355.  
  356.  
  357. $(TOLUA): $(TOLUAOBJS) server\lua\tolua.c server\lua\tolualua.c
  358. $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TOLUAOBJS) server\lua\tolua.c server\lua\tolualua.c $(LIBS)
  359.  
  360.  
  361. #
  362. # Build the custom LUA preprocessor
  363. #
  364.  
  365. preproc\preproc.o: preproc\preproc.c
  366. $(NCC) -o preproc\preproc.o -c preproc\preproc.c
  367. preproc\preproc: preproc\preproc.o
  368. $(NCC) -o preproc\preproc preproc\preproc.o
  369.  
  370. preproc\preproc-win.o: preproc\preproc-win.c
  371. $(CC) -o preproc\preproc-win.o -c $(CFLAGS) $(LDFLAGS) preproc\preproc-win.c
  372. preproc\preproc.exe: preproc\preproc-win.o
  373. $(CC) $(CFLAGS) $(LDFLAGS) -o preproc\preproc.exe preproc\preproc-win.o
  374.  
  375.  
  376. #
  377. # Rule for making a '.o'
  378. #
  379. .c.o:
  380. $(CC) $(CFLAGS) -o $*.o -c $*.c
  381.  
  382.  
  383. #
  384. # Clean up old junk
  385. #
  386.  
  387. clean:
  388. cd server\lua & rm -f *.o
  389. cd server & rm -f *.o w_play.c w_util.c w_spells.c *.pkg
  390. cd client & rm -f *.o w_play.c w_util.c w_spells.c *.pkg
  391. cd common & rm -f *.o w_z_pack.c
  392. cd console & rm -f *.o
  393. # del /Q
  394. rm -f account\accedit.o preproc\preproc.o
  395.  
  396. #
  397. # Lua library compilation rules
  398. #
  399.  
  400. server\util.pkg: server\util.pre preproc\preproc
  401. cd server & ..\preproc\preproc util.pre util.pkg $(CPP) $(CPPFLAGS) & cd ..
  402.  
  403. server\player.pkg: server\player.pre preproc\preproc
  404. cd server & ..\preproc\preproc player.pre player.pkg $(CPP) $(CPPFLAGS) & cd ..
  405.  
  406. server\spells.pkg: server\spells.pre preproc\preproc
  407. cd server & ..\preproc\preproc spells.pre spells.pkg $(CPP) $(CPPFLAGS) & cd ..
  408.  
  409. client\util.pkg: client\util.pre preproc\preproc
  410. cd client & ..\preproc\preproc util.pre util.pkg $(CPP) $(CPPFLAGS) & cd ..
  411.  
  412. client\player.pkg: client\player.pre preproc\preproc
  413. cd client & ..\preproc\preproc player.pre player.pkg $(CPP) $(CPPFLAGS) & cd ..
  414.  
  415. client\spells.pkg: client\spells.pre preproc\preproc
  416. cd client & ..\preproc\preproc spells.pre spells.pkg $(CPP) $(CPPFLAGS) & cd ..
  417.  
  418. server\w_util.c: server\util.pkg $(TOLUA)
  419. cd server & tolua.exe -n util -o w_util.c util.pkg & cd ..
  420.  
  421. server\w_play.c: server\player.pkg $(TOLUA)
  422. cd server & tolua.exe -n player -o w_play.c player.pkg & cd ..
  423.  
  424. server\w_spells.c: server\spells.pkg $(TOLUA)
  425. cd server & tolua.exe -n spells -o w_spells.c spells.pkg & cd ..
  426.  
  427. client\w_play.c: client\player.pkg $(TOLUA)
  428. cd client & ..\server\tolua.exe -n player -o w_play.c player.pkg & cd ..
  429.  
  430. client\w_util.c: client\util.pkg $(TOLUA)
  431. cd client & ..\server\tolua.exe -n util -o w_util.c util.pkg & cd ..
  432.  
  433. client\w_spells.c: client\spells.pkg $(TOLUA)
  434. cd client & ..\server\tolua.exe -n spells -o w_spells.c spells.pkg & cd ..
  435.  
  436.  
  437. common\w_z_pack.c: common\z_pack.pkg $(TOLUA)
  438. cd common & ..\server\tolua.exe -n z_pack -o w_z_pack.c z_pack.pkg & cd ..
  439.  
  440. #
  441. # Resources
  442. #
  443.  
  444. client\icon.o: client\icon.rc client\tomenet4.ico
  445. cd client & $(WINDRES) -o icon.o icon.rc & cd ..
  446. client\manifest.o: client\manifest.rc client\TomeNET.exe.manifest
  447. cd client & $(WINDRES) -o manifest.o manifest.rc & cd ..
  448.  
  449. #
  450. # Generate dependancies automatically
  451. #
  452.  
  453. depend:
  454. makedepend -- $(CFLAGS) -D__MAKEDEPEND__ -- $(SERV_SRCS) $(CLI_SRCS)
  455.  
  456.  
  457. # DO NOT ADD ANYTHING BELOW THIS LINE.
  458.  
  459. # DO NOT DELETE THIS LINE -- make depend depends on it.
Advertisement
Add Comment
Please, Sign In to add comment