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.top < prev    next >
Encoding:
Makefile  |  1993-01-24  |  4.8 KB  |  153 lines

  1. #    NetHack Makefile.
  2. #    SCCS Id: @(#)Makefile.top    3.1    92/01/05
  3.  
  4. # newer makes predefine $(MAKE) to 'make' and do smarter processing of
  5. # recursive make calls if $(MAKE) is used
  6. # these makes allow $(MAKE) to be overridden by the environment if someone
  7. # wants to (or has to) use something other than the standard make, so we do
  8. # not want to unconditionally set $(MAKE) here
  9. #
  10. # unfortunately, some older makes do not predefine $(MAKE); if you have one of
  11. # these, uncomment the following line
  12. # (you will know that you have one if you get complaints about unable to
  13. # execute things like 'data' and 'rumors')
  14. # MAKE = make
  15.  
  16. # make NetHack
  17. GAME     = nethack
  18. GAMEUID  = games
  19. GAMEGRP  = bin
  20.  
  21. # Permissions - some places use setgid instead of setuid, for instance
  22. # See also the option "SECURE" in include/config.h
  23. GAMEPERM = 04755
  24. FILEPERM = 0644
  25. EXEPERM  = 0755
  26. DIRPERM  = 0755
  27.  
  28. # GAMEDIR also appears in config.h as "HACKDIR".
  29. #
  30. # note that 'make install' believes in creating a nice tidy GAMEDIR for
  31. # installation, free of debris from previous NetHack versions --
  32. # therefore there should not be anything in GAMEDIR that you want to keep
  33. # (if there is, you'll have to do the installation by hand or modify the
  34. # instructions)
  35. GAMEDIR  = /usr/games/lib/$(GAME)dir
  36. SHELLDIR = /usr/games
  37.  
  38. DATHELP = help hh cmdhelp history opthelp wizhelp
  39. VARDAT = data oracles options quest.dat rumors
  40.  
  41. SPEC_LEVS = asmodeus.lev baalz.lev bigroom.lev castle.lev fakewiz?.lev \
  42.     juiblex.lev knox.lev medusa-?.lev mine_end.lev minefill.lev \
  43.     minetown.lev oracle.lev orcus.lev sanctum.lev tower?.lev valley.lev \
  44.     wizard?.lev astral.lev air.lev earth.lev fire.lev water.lev
  45. QUEST_LEVS = ?-goal.lev ?-fill?.lev ?-locate.lev ?-start.lev
  46.  
  47. SCRIPT = dungeon
  48. DAT = $(DATHELP) $(VARDAT) $(SPEC_LEVS) $(QUEST_LEVS) $(SCRIPT) license
  49.  
  50. $(GAME):
  51.     ( cd src ; $(MAKE) )
  52.  
  53. all:    $(GAME) Guidebook $(VARDAT) dungeon spec_levs
  54.     @echo "Done."
  55.  
  56. Guidebook:
  57.     ( cd doc ; $(MAKE) Guidebook )
  58.  
  59. manpages:
  60.     ( cd doc ; $(MAKE) manpages )
  61.  
  62. data:
  63.     ( cd dat ; $(MAKE) data )
  64.  
  65. rumors:
  66.     ( cd dat ; $(MAKE) rumors )
  67.  
  68. oracles:
  69.     ( cd dat ; $(MAKE) oracles )
  70.  
  71. #    Note: options should have already been made with make, but...
  72. options:
  73.     ( cd dat ; $(MAKE) options )
  74.  
  75. quest.dat:
  76.     ( cd dat ; $(MAKE) quest.dat )
  77.  
  78. spec_levs:
  79.     ( cd util ; $(MAKE) lev_comp )
  80.     ( cd dat ; $(MAKE) spec_levs )
  81.     ( cd dat ; $(MAKE) quest_levs )
  82.     
  83. dungeon:
  84.     ( cd util ; $(MAKE) dgn_comp )
  85.     ( cd dat ; $(MAKE) dungeon )
  86.     
  87. update: $(GAME) $(VARDAT) dungeon spec_levs
  88. #    (don't yank the old version out from under people who're playing it)
  89.     -mv $(GAMEDIR)/$(GAME) $(GAMEDIR)/$(GAME).old
  90. #    quest.dat is also kept open and has the same problems over NFS
  91.     -mv $(GAMEDIR)/quest.dat $(GAMEDIR)/quest.dat.old
  92. # copy over new versions of the game files
  93.     ( cd dat ; cp $(DAT) $(GAMEDIR) )
  94.     cp src/$(GAME) $(GAMEDIR)
  95.     -rm -f $(SHELLDIR)/$(GAME)
  96.     sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
  97.         -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
  98.         < sys/unix/nethack.sh \
  99.         > $(SHELLDIR)/$(GAME)
  100. # correct the permissions on the new versions
  101.     -( cd $(GAMEDIR) ; chown $(GAMEUID) $(DAT) $(GAME) ; \
  102.             chgrp $(GAMEGRP) $(DAT) $(GAME) ; \
  103.             chmod $(FILEPERM) $(DAT) )
  104.     -chown $(GAMEUID) $(SHELLDIR)/$(GAME)
  105.     chgrp $(GAMEGRP) $(SHELLDIR)/$(GAME)
  106.     chmod $(EXEPERM) $(SHELLDIR)/$(GAME)
  107.     chmod $(GAMEPERM) $(GAMEDIR)/$(GAME)
  108. # touch time-sensitive files
  109.     -touch -c $(GAMEDIR)/bones* $(GAMEDIR)/?lock* $(GAMEDIR)/wizard*
  110.     -touch -c $(GAMEDIR)/save/*
  111.     touch $(GAMEDIR)/perm $(GAMEDIR)/record
  112. # and a reminder
  113.     @echo You may also want to install the man pages via the doc Makefile.
  114.  
  115. install: $(GAME) $(VARDAT) dungeon spec_levs
  116. # set up the directories
  117.     -mkdir $(SHELLDIR)
  118.     -rm -rf $(GAMEDIR)
  119.     -mkdir $(GAMEDIR) $(GAMEDIR)/save
  120. # create some files
  121.     touch $(GAMEDIR)/perm $(GAMEDIR)/record $(GAMEDIR)/logfile
  122. # copy over the game files
  123.     ( cd dat ; cp $(DAT) $(GAMEDIR) )
  124.     cp src/$(GAME) $(GAMEDIR)
  125.     -rm -f $(SHELLDIR)/$(GAME)
  126.     sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
  127.         -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
  128.         < sys/unix/nethack.sh \
  129.         > $(SHELLDIR)/$(GAME)
  130. # set up the permissions
  131.     -( cd $(GAMEDIR) ; chown $(GAMEUID) . * $(SHELLDIR)/$(GAME) )
  132.     ( cd $(GAMEDIR) ; chgrp $(GAMEGRP) . * $(SHELLDIR)/$(GAME) )
  133.     chmod $(EXEPERM) $(SHELLDIR)/$(GAME)
  134.     chmod $(FILEPERM) $(GAMEDIR)/*
  135.     chmod $(DIRPERM) $(GAMEDIR) $(GAMEDIR)/save
  136.     chmod $(GAMEPERM) $(GAMEDIR)/$(GAME)
  137. # and a reminder
  138.     @echo You may also want to reinstall the man pages via the doc Makefile.
  139.  
  140. # 'make clean' removes all the .o files, but leaves around all the executables
  141. # and compiled data files
  142. clean:
  143.     ( cd src ; $(MAKE) clean )
  144.     ( cd util ; $(MAKE) clean )
  145.  
  146. # 'make spotless' returns the source tree to near-distribution condition.
  147. # it removes .o files, executables, and compiled data files
  148. spotless:
  149.     ( cd src ; $(MAKE) spotless )
  150.     ( cd util ; $(MAKE) spotless )
  151.     ( cd dat ; $(MAKE) spotless )
  152.     ( cd doc ; $(MAKE) spotless )
  153.