home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / nethack-3.1 / sys / unix / Makefile.utl < prev    next >
Encoding:
Makefile  |  1993-01-25  |  6.7 KB  |  239 lines

  1. #    Makefile for NetHack's utility programs.
  2. #    SCCS Id: @(#)Makefile.utl    3.1    92/11/01
  3.  
  4. # if you are using gcc as your compiler,
  5. #    uncomment the CC definition below if it's not in your environment
  6. # CC = gcc
  7. #
  8. #    For Bull DPX/2 systems at B.O.S. 2.0 or higher use the following:
  9. #
  10. # CC = gcc -ansi -D_BULL_SOURCE -D_XOPEN_SOURCE -D_POSIX_SOURCE
  11. #    If you are using GCC 2.2.2 or higher on a DPX/2, just use:
  12. #
  13. # CC = gcc -ansi
  14. #
  15. # if your make doesn't define a default SHELL properly, you may need
  16. #    the line below (Atari users will need a bourne work-alike)
  17. # SHELL = /bin/sh
  18.  
  19. # flags may have to be changed as required
  20. # flags for 286 Xenix:
  21. # CFLAGS = -Ml2t16 -O -LARGE -I../include
  22. # LFLAGS = -Ml -F 4000 -SEG 512
  23.  
  24. # flags for 286 Microport SysV-AT
  25. # CFLAGS = -DDUMB -Ml -I../include
  26. # LFLAGS = -Ml
  27.  
  28. # flags for Atari GCC
  29. # CFLAGS = -O -I../include
  30. # LFLAGS = -s
  31.  
  32. # flags for Apollos using their native cc
  33. # (as long as it claims to be __STDC__ but isn't)
  34. # CFLAGS = -DAPOLLO -O -I../include
  35.  
  36. # flags for AIX 3.1 cc on IBM RS/6000 to define
  37. # a suitable subset of standard libraries
  38. # (note that there is more info regarding the "-qchars=signed"
  39. # switch in file Install.unx note 8)
  40. # CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -O -I../include -qchars=signed
  41.  
  42. # flags for A/UX 2.01 using native cc or c89
  43. # gcc predefines AUX so that's not needed there
  44. # CFLAGS = -ZS -D_POSIX_SOURCE -O -I../include -DAUX
  45.  
  46. # flags for debugging:
  47. # CFLAGS = -g -I../include
  48.  
  49. CFLAGS = -g -I../include
  50. LFLAGS =
  51.  
  52.  
  53. # yacc/lex programs to use to generate *_comp.h, *_lex.c, and *_yacc.c.
  54. # if, instead of yacc/lex you have bison/flex, comment/uncomment the following.
  55. YACC     = yacc
  56. LEX      = lex
  57. # YACC     = bison -y
  58. # LEX      = flex
  59.  
  60. # these are the names of the output files from YACC/LEX. Under MS-DOS
  61. # and similar systems, they may differ
  62. YTABC = y.tab.c
  63. YTABH = y.tab.h
  64. LEXYYC = lex.yy.c
  65. # YTABC = y_tab.c
  66. # YTABH = y_tab.h
  67. # LEXYYC = lexyy.c
  68.  
  69. # Nothing below this line should have to be changed.
  70.  
  71. # utility .c files
  72. MAKESRC = makedefs.c
  73. SPLEVSRC = lev_yacc.c lev_lex.c lev_main.c panic.c
  74. DGNCOMPSRC = dgn_yacc.c dgn_lex.c dgn_main.c
  75. UTILSRCS = $(MAKESRC) $(SPLEVSRC) $(DGNCOMPSRC)
  76.  
  77. # object files for makedefs
  78. MAKEOBJS = makedefs.o ../src/monst.o ../src/objects.o
  79.  
  80. # object files for special levels compiler
  81. SPLEVOBJS = lev_yacc.o lev_lex.o lev_main.o panic.o \
  82.     ../src/alloc.o ../src/drawing.o ../src/decl.o \
  83.     ../src/monst.o ../src/objects.o
  84.  
  85. # object files for dungeon compiler
  86. DGNCOMPOBJS = dgn_yacc.o dgn_lex.o dgn_main.o panic.o ../src/alloc.o
  87.  
  88. # object files for recovery utility
  89. RECOVOBJS = recover.o
  90.  
  91.  
  92. #    dependencies for makedefs
  93. #
  94. makedefs:    $(MAKEOBJS)
  95.     $(CC) $(LFLAGS) -o makedefs $(MAKEOBJS)
  96.  
  97. makedefs.o:  ../include/config.h ../include/permonst.h ../include/objclass.h \
  98.         ../include/monsym.h ../include/artilist.h ../include/qtext.h
  99.  
  100. ../include/onames.h: makedefs
  101.     ./makedefs -o
  102. ../include/pm.h: makedefs
  103.     ./makedefs -p
  104. ../src/monstr.c: makedefs
  105.     ./makedefs -m
  106. ../include/vis_tab.h: makedefs
  107.     ./makedefs -z
  108. ../src/vis_tab.c: makedefs
  109.     ./makedefs -z
  110.  
  111. lintdefs:
  112.     @lint -axbh -I../include -DLINT $(MAKESRC) ../src/monst.c ../src/objects.c | sed '/_flsbuf/d'
  113.  
  114.  
  115. # the src Makefile is responsible for knowing when to call this, since
  116. # it knows all about the main src and include files
  117. ../include/date.h::
  118.     ./makedefs -v
  119.  
  120.  
  121. #    dependencies for lev_comp
  122. #
  123. lev_comp:  $(SPLEVOBJS)
  124.     $(CC) $(LFLAGS) -o lev_comp $(SPLEVOBJS)
  125.  
  126. lev_yacc.o:  ../include/hack.h ../include/sp_lev.h
  127. lev_main.o:  ../include/hack.h ../include/sp_lev.h ../include/termcap.h
  128. panic.o:     ../include/config.h
  129.  
  130. # see lev_comp.l for WEIRD_LEX discussion
  131. # egrep returns failure if it doesn't find anything, so we have to go to
  132. # some trouble to check for $(CC) failures
  133. lev_lex.o:   ../include/hack.h ../include/lev_comp.h ../include/sp_lev.h
  134.     -@rm lev_lex.o 2>/dev/null
  135.     @echo $(CC) -c $(CFLAGS) lev_lex.c
  136.     -@$(CC) -c $(CFLAGS) -DWEIRD_LEX=`egrep -c _cplusplus lev_lex.c` lev_lex.c
  137.     @test -r lev_lex.o
  138.  
  139. ../include/lev_comp.h: lev_yacc.c
  140.  
  141. lev_yacc.c: lev_comp.y
  142.     $(YACC) -d lev_comp.y
  143.     mv $(YTABC) lev_yacc.c
  144.     mv $(YTABH) ../include/lev_comp.h
  145.  
  146. lev_lex.c: lev_comp.l
  147.     $(LEX) lev_comp.l
  148.     mv $(LEXYYC) lev_lex.c
  149.  
  150. # with all of extern.h's functions to complain about, we drown in
  151. # 'defined but not used' without -u
  152. lintlev:
  153.     @lint -axhu -I../include -DLINT $(SPLEVSRC) ../src/alloc.c ../src/monst.c ../src/objects.c | sed '/_flsbuf/d'
  154.  
  155.  
  156. #    dependencies for dgn_comp
  157. #
  158. dgn_comp:  $(DGNCOMPOBJS)
  159.     $(CC) $(LFLAGS) -o dgn_comp $(DGNCOMPOBJS)
  160.  
  161. dgn_yacc.o:  ../include/config.h ../include/dgn_file.h
  162. dgn_main.o:  ../include/config.h
  163.  
  164. # see dgn_comp.l for WEIRD_LEX discussion
  165. # egrep returns failure if it doesn't find anything, so we have to go to
  166. # some trouble to check for $(CC) failures
  167. dgn_lex.o:   ../include/config.h ../include/dgn_comp.h ../include/dgn_file.h
  168.     -@rm dgn_lex.o 2>/dev/null
  169.     @echo $(CC) -c $(CFLAGS) dgn_lex.c
  170.     -@$(CC) -c $(CFLAGS) -DWEIRD_LEX=`egrep -c _cplusplus dgn_lex.c` dgn_lex.c
  171.     @test -r dgn_lex.o
  172.  
  173.  
  174. ../include/dgn_comp.h: dgn_yacc.c
  175.  
  176. dgn_yacc.c: dgn_comp.y
  177.     $(YACC) -d dgn_comp.y
  178.     mv $(YTABC) dgn_yacc.c
  179.     mv $(YTABH) ../include/dgn_comp.h
  180.  
  181. dgn_lex.c: dgn_comp.l
  182.     $(LEX) dgn_comp.l
  183.     mv $(LEXYYC) dgn_lex.c
  184.  
  185. # with all of extern.h's functions to complain about, we drown in
  186. # 'defined but not used' without -u
  187. lintdgn:
  188.     @lint -axhu -I../include -DLINT $(DGNCOMPSRC) panic.c ../src/alloc.c | sed '/_flsbuf/d'
  189.  
  190.  
  191. #    dependencies for recover
  192. #
  193. recover: $(RECOVOBJS)
  194.     $(CC) $(LFLAGS) -o recover $(RECOVOBJS)
  195.  
  196. recover.o: ../include/config.h
  197.  
  198.  
  199.  
  200. # using dependencies like
  201. #    ../src/foo::
  202. #        @( cd ../src ; $(MAKE) foo )
  203. # would always force foo to be up-to-date according to the src Makefile
  204. # when it's needed here.  unfortunately, some makes believe this syntax
  205. # means foo always changes, instead of foo should always be checked.
  206. # therefore, approximate via config.h dependencies, and hope that anybody
  207. # changing anything other than basic configuration also knows when not
  208. # to improvise things not in the instructions, like 'make makedefs' here
  209. # in util...
  210.  
  211. # make sure object files from src are available when needed
  212. #
  213. ../src/alloc.o: ../src/alloc.c ../include/config.h
  214.     @( cd ../src ; $(MAKE) alloc.o )
  215. ../src/drawing.o: ../src/drawing.c ../include/config.h
  216.     @( cd ../src ; $(MAKE) drawing.o )
  217. ../src/decl.o: ../src/decl.c ../include/config.h
  218.     @( cd ../src ; $(MAKE) decl.o )
  219. ../src/monst.o: ../src/monst.c ../include/config.h
  220.     @( cd ../src ; $(MAKE) monst.o )
  221. ../src/objects.o: ../src/objects.c ../include/config.h
  222.     @( cd ../src ; $(MAKE) objects.o )
  223.  
  224. # make sure hack.h dependencies get transitive information
  225. ../include/hack.h: ../include/config.h
  226.     @( cd ../src ; $(MAKE) ../include/hack.h )
  227.  
  228. tags: $(UTILSRCS)
  229.     @ctags -tw $(UTILSRCS)
  230.  
  231. clean:
  232.     rm -f *.o
  233.  
  234. spotless: clean
  235.     rm -f lev_lex.c lev_yacc.c dgn_lex.c dgn_yacc.c
  236.     rm -f ../include/lev_comp.h ../include/dgn_comp.h
  237.     rm -f makedefs lev_comp dgn_comp recover
  238.