home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / elm / elm2.4 / utils / Makefile.SH < prev    next >
Encoding:
Makefile  |  1993-05-31  |  11.7 KB  |  466 lines

  1. case $CONFIG in
  2. '')
  3.     if test ! -f config.sh; then
  4.     ln ../config.sh . || \
  5.     ln ../../config.sh . || \
  6.     ln ../../../config.sh . || \
  7.     (echo "Can't find config.sh."; exit 1)
  8.     fi
  9.     . ./config.sh
  10.     ;;
  11. esac
  12. case "$0" in
  13. */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  14. esac
  15.  
  16. echo "Extracting utils/Makefile (with variable substitutions)"
  17. cat >Makefile <<!GROK!THIS!
  18.  
  19. # @(#)$Id: Makefile.SH,v 5.5 1993/05/31 19:17:28 syd Exp $
  20. #
  21. #  Makefile for the Elm system utilities
  22. #
  23. #         (C) Copyright 1986,1987, by Dave Taylor
  24. #         (C) Copyright 1988-1992, USENET Community Trust
  25. #
  26. # Bug reports, patches, comments, suggestions should be sent to:
  27. #
  28. #    Syd Weinstein - elm@DSI.COM
  29. #            dsinc!elm
  30. #
  31. # $Log: Makefile.SH,v $
  32. # Revision 5.5  1993/05/31  19:17:28  syd
  33. # In the Makefile listalias was given only a+x permission
  34. # though it should have been a+rx.
  35. # From: Jukka Ukkonen <ukkonen@csc.fi>
  36. #
  37. # Revision 5.4  1993/04/16  05:07:10  syd
  38. # add elmalias
  39. #
  40. # Revision 5.3  1993/04/12  02:14:15  syd
  41. # Fix comments
  42. #
  43. # Revision 5.2  1993/04/12  02:11:05  syd
  44. # Added new utilities "elmalias" and "prlong".  Modified "checkalias"
  45. # and "listalias" to use them.
  46. # From: chip@chinacat.unicom.com (Chip Rosenthal)
  47. #
  48. # Revision 5.1  1992/10/04  00:46:45  syd
  49. # Initial checkin as of 2.4 Release at PL0
  50. #
  51. #
  52. # Variables
  53. #    Variables established by Configure
  54. CC        =    $cc
  55. CCFLAGS        =    $ccflags $xencf
  56. CHMOD        =    $chmod
  57. CP        =    $cp
  58. DEST        =    $bin
  59. ECHO        =    $echo
  60. LFLAGS        =    $ldflags $xenlf
  61. LIB        =    $lib
  62. LIB2        =     $libs
  63. LIBS        =    $termlib $dbm
  64. LINT        =    $lint
  65. LN        =    $ln
  66. MAKE        =    $make
  67. MV        =    $mv
  68. OPTIMIZE    =    $optimize
  69. RM        =     $rm -f
  70. TOUCH        =    $touch
  71. !GROK!THIS!
  72.  
  73. cat >>Makefile <<'!NO!SUBS!'
  74. #    Variables you may want to manually edit
  75. #        If you want debug logging then you'll
  76. #        want to uncomment the following.
  77. #DEBUG        =    -DDEBUG
  78.  
  79. #    Other general variables
  80. BIN        =    ../bin
  81. CFLAGS        =    $(CCFLAGS) $(OPTIMIZE) -I$(INCLDIR) $(DEBUG) $(DACSNET) 
  82. INCLDIR        =    ../hdrs
  83. LINTFLAGS    =    -I$(INCLDIR)
  84. SHELL        =    /bin/sh
  85.  
  86. #    Lists
  87. #        List of installed programs - excludes wnewmail and nfrm,
  88. #        which are handled separately
  89. INSTALL_LIST    =    $(DEST)/answer        \
  90.             $(DEST)/arepdaemon    \
  91.             $(DEST)/autoreply    \
  92.             $(DEST)/checkalias    \
  93.             $(DEST)/elmalias    \
  94.             $(DEST)/fastmail    \
  95.             $(DEST)/frm        \
  96.             $(DEST)/listalias    \
  97.             $(DEST)/messages    \
  98.             $(DEST)/newalias    \
  99.             $(DEST)/newmail        \
  100.             $(DEST)/printmail    \
  101.             $(DEST)/readmsg        \
  102.             $(LIB)/prlong
  103.  
  104. #        List of remotely install programs
  105. REMOTE_LIST    =    $(REMOTE)$(DEST)/answer        \
  106.             $(REMOTE)$(DEST)/arepdaemon    \
  107.             $(REMOTE)$(DEST)/autoreply    \
  108.             $(REMOTE)$(DEST)/checkalias    \
  109.             $(REMOTE)$(DEST)/elmalias    \
  110.             $(REMOTE)$(DEST)/fastmail    \
  111.             $(REMOTE)$(DEST)/frm        \
  112.             $(REMOTE)$(DEST)/listalias    \
  113.             $(REMOTE)$(DEST)/messages    \
  114.             $(REMOTE)$(DEST)/newalias    \
  115.             $(REMOTE)$(DEST)/newmail    \
  116.             $(REMOTE)$(DEST)/printmail    \
  117.             $(REMOTE)$(DEST)/readmsg
  118.  
  119. #        List of programs in bin directory
  120. BINARY_LIST    =    $(BIN)/answer        \
  121.             $(BIN)/arepdaemon    \
  122.             $(BIN)/autoreply    \
  123.             $(BIN)/checkalias    \
  124.             $(BIN)/elmalias        \
  125.             $(BIN)/fastmail        \
  126.             $(BIN)/frm        \
  127.             $(BIN)/listalias    \
  128.             $(BIN)/messages        \
  129.             $(BIN)/newalias        \
  130.             $(BIN)/newmail        \
  131.             $(BIN)/printmail    \
  132.             $(BIN)/readmsg        \
  133.             $(BIN)/prlong
  134.  
  135. #        List of programs to $(LINT) - only C programs
  136. LINT_LIST    =    answer_lint    \
  137.             arepdaemon_lint    \
  138.             autoreply_lint    \
  139.             elmalias_lint    \
  140.             fastmail_lint    \
  141.             frm_lint    \
  142.             newalias_lint    \
  143.             newmail_lint    \
  144.             readmsg_lint    \
  145.             prlong_lint
  146.  
  147. #    List of all object files in all util programs (used in parallel makes)
  148. UTIL_OBJ    =    answer.o        \
  149.             arepdaem.o         \
  150.             autoreply.o        \
  151.             elmalias.o        \
  152.             fastmail.o        \
  153.             from.o            \
  154.             newalias.o        \
  155.             newmail.o        \
  156.             readmsg.o        \
  157.             prlong.o
  158.  
  159. #    Lists of source and object files for each C program
  160. ANSWER_SRC    =    answer.c
  161. ANSWER_OBJ    =    answer.o
  162. AREPDAEMON_SRC    =    arepdaem.c
  163. AREPDAEMON_OBJ    =    arepdaem.o
  164. AUTOREPLY_SRC    =    autoreply.c
  165. AUTOREPLY_OBJ    =    autoreply.o
  166. ELMALIAS_SRC    =    elmalias.c
  167. ELMALIAS_OBJ    =    elmalias.o
  168. FASTMAIL_SRC    =    fastmail.c
  169. FASTMAIL_OBJ    =    fastmail.o
  170. FRM_SRC        =    from.c
  171. FRM_OBJ        =    from.o
  172. NEWALIAS_SRC    =    newalias.c
  173. NEWALIAS_OBJ    =    newalias.o
  174. NEWMAIL_SRC    =    newmail.c
  175. NEWMAIL_OBJ    =    newmail.o
  176. PRLONG_SRC    =    prlong.c
  177. PRLONG_OBJ    =    prlong.o
  178. READMSG_SRC    =    readmsg.c
  179. READMSG_OBJ    =    readmsg.o
  180.  
  181. # Standard targets
  182. all:            objects $(BINARY_LIST)
  183.  
  184. #    This unusual target enables highly efficial compilation of object files
  185. #    on systems that have the parallel make feature.
  186. objects:        $& $(UTIL_OBJ)
  187.  
  188. install:        $(INSTALL_LIST) $(DEST)/wnewmail $(DEST)/nfrm
  189.  
  190. uninstall:        
  191.             $(RM) $(INSTALL_LIST) $(DEST)/wnewmail $(DEST)/nfrm
  192.  
  193. #    This is the only target that gets installed even if not out-of-date
  194. #    with respect the files from which it is installed.
  195. rmt-install:        rmt-defined
  196.             -$(MV) $(DEST)/answer $(DEST)/answer.old
  197.             -$(MV) $(DEST)/arepdaemon $(DEST)/arepdaemon.old
  198.             -$(MV) $(DEST)/autoreply $(DEST)/autoreply.old
  199.             -$(MV) $(DEST)/checkalias $(DEST)/checkalias.old
  200.             -$(MV) $(DEST)/elmalias $(DEST)/elmalias.old
  201.             -$(MV) $(DEST)/fastmail $(DEST)/fastmail.old
  202.             -$(MV) $(DEST)/frm $(DEST)/frm.old
  203.             -$(MV) $(DEST)/nfrm $(DEST)/nfrm.old
  204.             -$(MV) $(DEST)/listalias $(DEST)/listalias.old
  205.             -$(MV) $(DEST)/messages $(DEST)/messages.old
  206.             -$(MV) $(DEST)/newalias $(DEST)/newalias.old
  207.             -$(MV) $(DEST)/newmail $(DEST)/newmail.old
  208.             -$(MV) $(DEST)/printmail $(DEST)/printmail.old
  209.             -$(MV) $(DEST)/readmsg $(DEST)/readmsg.old
  210.             -$(MV) $(DEST)/wnewmail $(DEST)/wnewmail.old
  211.             -$(RM) $(DEST)/answer.old
  212.             -$(RM) $(DEST)/arepdaemon.old
  213.             -$(RM) $(DEST)/autoreply.old
  214.             -$(RM) $(DEST)/checkalias.old
  215.             -$(RM) $(DEST)/elmalias.old
  216.             -$(RM) $(DEST)/fastmail.old
  217.             -$(RM) $(DEST)/frm.old
  218.             -$(RM) $(DEST)/nfrm.old
  219.             -$(RM) $(DEST)/listalias.old
  220.             -$(RM) $(DEST)/messages.old
  221.             -$(RM) $(DEST)/newalias.old
  222.             -$(RM) $(DEST)/newmail.old
  223.             -$(RM) $(DEST)/printmail.old
  224.             -$(RM) $(DEST)/readmsg.old
  225.             -$(RM) $(DEST)/wnewmail.old
  226.             $(CP) $(REMOTE_LIST) $(DEST)
  227.             $(LN) $(DEST)/frm $(DEST)/nfrm
  228.             $(LN) $(DEST)/newmail $(DEST)/wnewmail
  229.             -$(MV) $(LIB)/prlong $(DEST)/prlong.old
  230.             -$(RM) $(LIB)/prlong.old
  231.             $(CP) prlong $(LIB)
  232.             $(CHMOD) a+rx $(INSTALL_LIST)
  233.  
  234. rmt-defined:
  235.     @(if [ "$(REMOTE)" = "" ];\
  236.       then\
  237.         $(ECHO) "You need to define 'REMOTE' as the remote file system";\
  238.         $(ECHO) "for this particular command. The easiest way to do this";\
  239.         $(ECHO) "to type:";\
  240.         $(ECHO) "        make REMOTE=<remote file system> rmt-install";\
  241.         exit 1;\
  242.       fi);
  243.  
  244. #    This rule allows us to put lint output for each program on the
  245. #    same file, but make sure we start off fresh each time.
  246. lint:            
  247.             $(RM) LINT.OUT; $(MAKE) -$(MAKEFLAGS) $(LINT_LIST)
  248.  
  249. clean:            
  250.             $(RM) $(UTIL_OBJ) $(BINARY_LIST)
  251.  
  252. # Dependencies and rules
  253. #    Dependencies and rules for compiling and linting C programs
  254. .PRECIOUS:        $(INCLDIR)/defs.h $(INCLDIR)/elm.h \
  255.             $(INCLDIR)/headers.h ../lib/libutil.a
  256.  
  257. checkalias:        checkalias.SH    ; sh $?
  258. listalias:        listalias.SH    ; sh $?
  259. messages:        messages.SH    ; sh $?
  260. printmail:        printmail.SH    ; sh $?
  261.  
  262. $(BIN)/answer:        $(ANSWER_OBJ) ../lib/libutil.a
  263.             $(CC) $(LFLAGS) -o $@ $(ANSWER_OBJ) ../lib/libutil.a $(LIB2)
  264.  
  265. answer_lint:        $(ANSWER_SRC)
  266.             $(LINT) $(LINTFLAGS) $(ANSWER_SRC) >> LINT.OUT
  267.  
  268. $(BIN)/arepdaemon:    $(AREPDAEMON_OBJ) ../lib/libutil.a
  269.             $(CC) $(LFLAGS) -o $@ $(AREPDAEMON_OBJ) ../lib/libutil.a $(LIB2)
  270.  
  271. arepdaemon_lint:    $(AREPDAEMON_SRC)
  272.             $(LINT) $(LINTFLAGS) $(AREPDAEMON_SRC) >> LINT.OUT
  273.  
  274. $(BIN)/autoreply:    $(AUTOREPLY_OBJ) ../lib/libutil.a
  275.             $(CC) $(LFLAGS) -o $@ $(AUTOREPLY_OBJ) ../lib/libutil.a $(LIB2)
  276.  
  277. autoreply_lint:        $(AUTOREPLY_SRC)
  278.             $(LINT) $(LINTFLAGS) $(AUTOREPLY_SRC) >> LINT.OUT
  279.  
  280. $(BIN)/elmalias:    $(ELMALIAS_OBJ) ../lib/libutil.a
  281.             $(CC) $(LFLAGS) -o $@ $(ELMALIAS_OBJ) ../lib/libutil.a $(LIB2)
  282.  
  283. elmalias_lint:        $(ELMALIAS_SRC)
  284.             $(LINT) $(LINTFLAGS) $(ELMALIAS_SRC) >> LINT.OUT
  285.  
  286. $(BIN)/fastmail:    $(FASTMAIL_OBJ) ../lib/libutil.a
  287.             $(CC) $(LFLAGS) -o $@ $(FASTMAIL_OBJ) ../lib/libutil.a $(LIB2)
  288.  
  289. fastmail_lint:        $(FASTMAIL_SRC)
  290.             $(LINT) $(LINTFLAGS) $(FASTMAIL_SRC) >> LINT.OUT
  291.  
  292. $(BIN)/frm:        $(FRM_OBJ) ../lib/libutil.a
  293.             $(CC) $(LFLAGS) -o $@ $(FRM_OBJ) ../lib/libutil.a $(LIB2)
  294.  
  295. frm_lint:        $(FRM_SRC)
  296.             $(LINT) $(LINTFLAGS) $(FRM_SRC) >> LINT.OUT
  297.  
  298. $(BIN)/newalias:    $(NEWALIAS_OBJ) ../lib/libutil.a
  299.             $(CC) $(LFLAGS) -o $@ $(NEWALIAS_OBJ) ../lib/libutil.a $(LIB2)
  300.  
  301. newalias_lint:        $(NEWALIAS_SRC)
  302.             $(LINT) $(LINTFLAGS) $(NEWALIAS_SRC) >> LINT.OUT
  303.  
  304. $(BIN)/newmail:        $(NEWMAIL_OBJ) ../lib/libutil.a
  305.             $(CC) $(LFLAGS) -o $@ $(NEWMAIL_OBJ) ../lib/libutil.a $(LIB2)
  306.  
  307. newmail_lint:        $(NEWMAIL_SRC)
  308.             $(LINT) $(LINTFLAGS) $(NEWMAIL_SRC) >> LINT.OUT
  309.  
  310. $(BIN)/readmsg:        $(READMSG_OBJ) ../lib/libutil.a
  311.             $(CC) $(LFLAGS) -o $@ $(READMSG_OBJ) ../lib/libutil.a $(LIB2)
  312.  
  313. readmsg_lint:        $(READMSG_SRC)
  314.             $(LINT) $(LINTFLAGS) $(READMSG_SRC) >> LINT.OUT
  315.  
  316. $(BIN)/prlong:        $(PRLONG_OBJ) ../lib/libutil.a
  317.             $(CC) $(LFLAGS) -o $@ $(PRLONG_OBJ) ../lib/libutil.a $(LIB2)
  318.  
  319. prlong_lint:        $(PRLONG_SRC)
  320.             $(LINT) $(LINTFLAGS) $(PRLONG_SRC) >> LINT.OUT
  321.  
  322.  
  323. #    Rules to make shell scripts in bin directory
  324. $(BIN)/checkalias:    checkalias
  325.             $(CP) $? $@
  326.             $(CHMOD) u+w,a+rx $@
  327.  
  328. $(BIN)/listalias:    listalias
  329.             $(CP) $? $@
  330.             $(CHMOD) u+w,a+rx $@
  331.  
  332. $(BIN)/messages:    messages
  333.             $(CP) $? $@
  334.             $(CHMOD) u+w,a+rx $@
  335.  
  336. $(BIN)/printmail:    printmail
  337.             $(CP) $? $@
  338.             $(CHMOD) u+w,a+rx $@
  339.  
  340. #    Dependencies of header files upon other header files they include
  341. $(INCLDIR)/defs.h:    $(INCLDIR)/../config.h $(INCLDIR)/sysdefs.h
  342.             $(CHMOD) u+w $@
  343.             $(TOUCH) $@
  344.  
  345. $(INCLDIR)/elmutil.h:    $(INCLDIR)/curses.h $(INCLDIR)/defs.h
  346.             $(CHMOD) u+w $@
  347.             $(TOUCH) $@
  348.  
  349. $(INCLDIR)/headers.h:    $(INCLDIR)/curses.h $(INCLDIR)/defs.h
  350.             $(CHMOD) u+w $@
  351.             $(TOUCH) $@
  352.  
  353. #    Dependencies of C object files
  354. answer.o:    $(INCLDIR)/ndbz.h $(INCLDIR)/elmutil.h $(INCLDIR)/s_answer.h
  355. arepdaem.o:    $(INCLDIR)/elmutil.h
  356. autoreply.o:    $(INCLDIR)/elmutil.h
  357. elmalias.o:    $(INCLDIR)/elmutil.h $(INCLDIR)/s_elmalias.h
  358. fastmail.o:    $(INCLDIR)/patchlevel.h $(INCLDIR)/elmutil.h $(INCLDIR)/s_fastmail.h
  359. from.o:        $(INCLDIR)/elmutil.h $(INCLDIR)/s_from.h
  360. newalias.o:    $(INCLDIR)/elmutil.h $(INCLDIR)/sysdefs.h $(INCLDIR)/s_newalias.h
  361. newmail.o:    $(INCLDIR)/elmutil.h $(INCLDIR)/s_newmail.h
  362. readmsg.o:    $(INCLDIR)/elmutil.h $(INCLDIR)/s_readmsg.h
  363. prlong.o:    $(INCLDIR)/defs.h
  364.  
  365. #    Dependencies and rules for installing programs from bin directory
  366. $(DEST)/answer:        $(BIN)/answer
  367.             -$(MV) $@ $@.old
  368.             -$(RM) $@.old
  369.             $(CP) $? $@
  370.             $(CHMOD) a+x $@
  371.  
  372. $(DEST)/arepdaemon:    $(BIN)/arepdaemon
  373.             -$(MV) $@ $@.old
  374.             -$(RM) $@.old
  375.             $(CP) $? $@
  376.             $(CHMOD) a+x $@
  377.  
  378. $(DEST)/autoreply:    $(BIN)/autoreply
  379.             -$(MV) $@ $@.old
  380.             -$(RM) $@.old
  381.             $(CP) $? $@
  382.             $(CHMOD) a+x $@
  383.             $(CHMOD) u+s $@
  384.  
  385. $(DEST)/checkalias:    $(BIN)/checkalias
  386.             -$(MV) $@ $@.old
  387.             -$(RM) $@.old
  388.             $(CP) $? $@
  389.             $(CHMOD) a+rx $@
  390.  
  391. $(DEST)/elmalias:    $(BIN)/elmalias
  392.             -$(MV) $@ $@.old
  393.             -$(RM) $@.old
  394.             $(CP) $? $@
  395.             $(CHMOD) a+x $@
  396.  
  397. $(DEST)/fastmail:    $(BIN)/fastmail
  398.             -$(MV) $@ $@.old
  399.             -$(RM) $@.old
  400.             $(CP) $? $@
  401.             $(CHMOD) a+x $@
  402.  
  403. $(DEST)/frm:        $(BIN)/frm
  404.             -$(MV) $@ $@.old
  405.             -$(RM) $@.old
  406.             $(CP) $? $@
  407.             $(CHMOD) a+x $@
  408.  
  409. $(DEST)/nfrm:        $(DEST)/frm
  410.             -$(MV) $@ $@.old
  411.             -$(RM) $@.old
  412.             $(RM) $@
  413.             $(LN) $? $@
  414.  
  415. $(DEST)/listalias:    $(BIN)/listalias
  416.             -$(MV) $@ $@.old
  417.             -$(RM) $@.old
  418.             $(CP) $? $@
  419.             $(CHMOD) a+rx $@
  420.  
  421. $(DEST)/messages:    $(BIN)/messages
  422.             -$(MV) $@ $@.old
  423.             -$(RM) $@.old
  424.             $(CP) $? $@
  425.             $(CHMOD) a+rx $@
  426.  
  427. $(DEST)/newalias:    $(BIN)/newalias
  428.             -$(MV) $@ $@.old
  429.             -$(RM) $@.old
  430.             $(CP) $? $@
  431.             $(CHMOD) a+x $@
  432.  
  433. $(DEST)/newmail:    $(BIN)/newmail
  434.             -$(MV) $@ $@.old
  435.             -$(RM) $@.old
  436.             $(RM) $@
  437.             $(CP) $? $@
  438.             $(CHMOD) a+x $@
  439.  
  440. $(DEST)/printmail:    $(BIN)/printmail
  441.             -$(MV) $@ $@.old
  442.             -$(RM) $@.old
  443.             $(CP) $? $@
  444.             $(CHMOD) a+rx $@
  445.  
  446. $(DEST)/readmsg:    $(BIN)/readmsg
  447.             -$(MV) $@ $@.old
  448.             -$(RM) $@.old
  449.             $(CP) $? $@
  450.             $(CHMOD) a+x $@
  451.  
  452. $(DEST)/wnewmail:    $(DEST)/newmail
  453.             -$(MV) $@ $@.old
  454.             -$(RM) $@.old
  455.             $(RM) $@
  456.             $(LN) $? $@
  457.  
  458. $(LIB)/prlong:        $(BIN)/prlong
  459.             -$(MV) $@ $@.old
  460.             -$(RM) $@.old
  461.             $(CP) $? $@
  462.             $(CHMOD) a+x $@
  463.  
  464. !NO!SUBS!
  465.