home *** CD-ROM | disk | FTP | other *** search
/ Netscape Plug-Ins Developer's Kit / Netscape_Plug-Ins_Developers_Kit.iso / SOFTWARE / lsoft / unix / common.tz / common / Makefile < prev    next >
Encoding:
Makefile  |  1996-02-02  |  9.4 KB  |  335 lines

  1. # -- Which C compiler to use to compile the incoming mail interface?
  2. CC=cc
  3. # -- Compiler options?
  4. CFLAGS=-O
  5. # -- Where should the LISTSERV mail and command line interfaces be installed?
  6. BINDIR=/usr/local/bin
  7. # -- Where should the server code and data files LISTSERV needs be placed?
  8. # >> If upgrading from 1.8a to 1.8b, please note that the default value
  9. # >> for this variable has changed. You do not need to relocate your
  10. # >> production directories, the previous default was just changed because
  11. # >> it was too confusing ('lsv' directory vs 'lsv' executable)
  12. LSVROOT=/home/listserv
  13. # -- Where should incoming mail messages be stored?
  14. LSVSPOOL=$(LSVROOT)/spool
  15. # -- The username of the listserv server.
  16. LSVNAME=listserv
  17. # -- Where is the sendmail "aliases" file?
  18. ALIASES=/etc/aliases
  19. # -- Set LSVAMIN_TYPE depending on how target userids are to be
  20. # -- passed to lsv_amin.  Use "links" to symbolic links to "lsv_amin"
  21. # -- for each LISTSERV e-mail address.  ZMAILER users must choose this
  22. # -- option since programs run from ZMAILER "aliases" files can't have
  23. # -- arguments.  Choose "flags" to have the target userid passed to
  24. # -- "lsv_amin" with the "-t user" flag.
  25. LSVAMIN_TYPE=flags
  26. #
  27. WHOAMI=whoami
  28. #WHOAMI=/usr/ucb/whoami        # Uncomment for Solaris
  29. #
  30. # - - - - You probably don't want to change any of the other macros - - - -
  31. # -- Directories used by LISTSERV.
  32. LSVDIRS=$(LSVROOT) $(LSVROOT)/home $(LSVROOT)/tmp
  33. #
  34. SHELL=/bin/sh
  35. #
  36. WHICH=$(NAME)$(name)
  37. #
  38. CFLAGS_Solaris=-lsocket -lnsl
  39. CFLAGS_INTERACTIVE=-linet -lcposix
  40. CFLAGS_OSF1=-taso -lots
  41. CFLAGS_AIX=
  42. CFLAGS_SunOS=
  43. CFLAGS_SCO_SV=-lsocket
  44. #
  45. IS_SOLARIS=`uname` = 'SunOS' -a \
  46.     `uname -r | awk '{ if(\$$1<5) printf("0"); else printf("1") }'` = 1 
  47.  
  48. help:
  49.     @echo " ";\
  50.     echo "Before you build either the LISTSERV server or the mail"\
  51.         "interface";\
  52.     echo "check the BINDIR, LSVROOT and LSVSPOOL macros in this"\
  53.         "Makefile.";\
  54.     echo " ";\
  55.     echo "To make the LISTSERV server enter,  make listserv";\
  56.     echo "To make the LISTSERV mail interface enter,  make mailer";\
  57.     echo "To make the command line interface enter,  make lcmd";\
  58.     echo "To make the job viewer utility enter,  make jobview";\
  59.     echo "To install/update just the mailer enter,  make install_mailer";\
  60.     echo "To install/update just the server enter,  make install_server";\
  61.     echo "To install/update just 'lcmd' enter,  make install_lcmd";\
  62.     echo "To install/update just 'jobview' enter,  make install_jobview";\
  63.     echo "Once you're sure everything built successfully,"\
  64.         "  make install";\
  65.     echo "To refresh programs/files on an existing system,  make update";\
  66.     echo "To add entries to the sendmail aliases file for LISTSERV,"\
  67.         "  make aliases";\
  68.     echo "To add aliases file entries for a new mailing list,"\
  69.         "  make list name=XXX";\
  70.     echo "(where XXX is the name of the list).";\
  71.     echo " ";\
  72.     echo "Please refer to the installation guide for more detailed"\
  73.         "information."
  74.  
  75. # -- creating the executables
  76. #
  77. # -- The ")" test is to catch systems with make's that can't handle
  78. # --   $(AA$(BB)) type macros.
  79. lsv_prog:
  80.     if [ "$(CFLAGS_$(UNAME))" = ")" ]; then \
  81.         $(CC) -o lsv lsv.o; \
  82.     else \
  83.         $(CC) -o lsv lsv.o `echo "$(CFLAGS_$(UNAME))"`; \
  84.     fi
  85.  
  86. lsv: lsv.o
  87.     if [ $(IS_SOLARIS) ]; then \
  88.         make lsv_prog UNAME=Solaris; \
  89.     else \
  90.         make lsv_prog UNAME=`uname`; \
  91.     fi
  92.  
  93. lsv_util:
  94.     if [ "$(CFLAGS_$(UNAME))" = ")" ]; then \
  95.       $(CC) -o $(PROG) $(PROG).c $(CFLAGS) $(XOPT); \
  96.     else \
  97.       $(CC) -o $(PROG) $(PROG).c `echo "$(CFLAGS_$(UNAME))"` $(CFLAGS) \
  98.         $(XOPT); \
  99.     fi
  100.     if [ `$(WHOAMI)` != "$(LSVNAME)" ]; \
  101.     then chown $(LSVNAME) $(PROG); \
  102.     else true; \
  103.     fi
  104.     if [ ".$(UMOD)" != "." ]; then chmod 4755 $(PROG); fi
  105.  
  106. lsv_amin: lsv_amin.c lsv_amin.h
  107.     if [ $(IS_SOLARIS) ]; then \
  108.         make lsv_util UNAME=Solaris PROG=$@ UMOD=4755 \
  109.             XOPT='-DSPOOL_DIR=\"$(LSVSPOOL)\"'; \
  110.     else \
  111.         make lsv_util UNAME=`uname` PROG=$@ UMOD=4755 \
  112.             XOPT='-DSPOOL_DIR=\"$(LSVSPOOL)\"'; \
  113.     fi
  114.  
  115. lcmd: lcmd.c
  116.     if [ $(IS_SOLARIS) ]; then \
  117.         make lsv_util UNAME=Solaris PROG=$@ UMOD=4755 \
  118.             XOPT='-DSPOOL_DIR=\"$(LSVSPOOL)\"'; \
  119.     else \
  120.         make lsv_util UNAME=`uname` PROG=$@ UMOD=4755 \
  121.             XOPT='-DSPOOL_DIR=\"$(LSVSPOOL)\"'; \
  122.     fi
  123.  
  124. jobview: jobview.c
  125.     if [ $(IS_SOLARIS) ]; then \
  126.         make lsv_util UNAME=Solaris PROG=$@; \
  127.     else \
  128.         make lsv_util UNAME=`uname` PROG=$@; \
  129.     fi
  130.  
  131. # -- installing the executables and data files needed to run LISTSERV
  132. $(LSVDIRS) $(LSVSPOOL):
  133.     if [ `$(WHOAMI)` = $(LSVNAME) ]; \
  134.     then umask 066;mkdir -p $@; \
  135.     else su $(LSVNAME) -c "umask 066;mkdir -p $@"; \
  136.     fi
  137.  
  138. directories: $(LSVDIRS) $(LSVSPOOL)
  139.  
  140. # -- Generic entries for files in the LSV-root and LSV-root/home directories
  141. $(LSVROOT)/$(RFILE): $(RFILE)
  142.     cp $(RFILE) $@
  143.     if [ ".$(RMOD)" != "." ]; then chmod $(RMOD) $@; else true; fi
  144.  
  145. $(LSVROOT)/home/$(HFILE): home/$(HFILE)
  146.     cp home/$(HFILE) $@
  147.  
  148. # -- installed copies of programs
  149. $(BINDIR)/lcmd: lcmd
  150.     cp lcmd $@
  151.     if [ `$(WHOAMI)` != $(LSVNAME) ]; then chown $(LSVNAME) $@; else true; fi
  152.     chmod 4755 $@
  153.     if [ `pwd` != $(LSVROOT) ]; then \
  154.         if [ -s $(LSVROOT)/lcmd.c ]; then \
  155.             mv $(LSVROOT)/lcmd.c $(LSVROOT)/lcmd.c.OLD; \
  156.         else true; \
  157.         fi; \
  158.         cp lcmd.c $(LSVROOT)/lcmd.c; \
  159.     else true; \
  160.     fi
  161.  
  162. $(BINDIR)/lsv_amin: lsv_amin
  163.     cp lsv_amin $@
  164.     if [ `$(WHOAMI)` != $(LSVNAME) ]; then chown $(LSVNAME) $@; else true; fi
  165.     chmod 4755 $@
  166.     if [ `pwd` != $(LSVROOT) ]; then \
  167.         if [ -s $(LSVROOT)/lsv_amin.c ]; then \
  168.             mv $(LSVROOT)/lsv_amin.c $(LSVROOT)/lsv_amin.c.OLD; \
  169.         else true; \
  170.         fi; \
  171.         cp lsv_amin.c $(LSVROOT)/lsv_amin.c; \
  172.         if [ -s $(LSVROOT)/lsv_amin.h ]; then \
  173.             mv $(LSVROOT)/lsv_amin.h $(LSVROOT)/lsv_amin.h.OLD; \
  174.         else true; \
  175.         fi; \
  176.         cp lsv_amin.h $(LSVROOT)/lsv_amin.h; \
  177.     else true; \
  178.     fi
  179.  
  180. $(LSVSPOOL)/jobview: jobview
  181.     cp jobview $@
  182.     if [ `$(WHOAMI)` != $(LSVNAME) ]; then chown $(LSVNAME) $@; else true; fi
  183.     if [ `pwd` != $(LSVROOT) ]; then \
  184.         if [ -s $(LSVROOT)/jobview.c ]; then \
  185.             mv $(LSVROOT)/jobview.c $(LSVROOT)/jobview.c.OLD; \
  186.         else true; \
  187.         fi; \
  188.         cp jobview.c $(LSVROOT)/jobview.c; \
  189.     else true; \
  190.     fi
  191.  
  192. $(LSVROOT)/lsv: lsv
  193.     cp lsv $@
  194.     if [ `$(WHOAMI)` != $(LSVNAME) ]; then chown $(LSVNAME) $@; else true; fi
  195.  
  196. $(LSVROOT)/go.user: $(LSVROOT)
  197.     if [ ! -s $@ ]; then \
  198.         cp go.user.sample $@; \
  199.         chmod 750 $@; \
  200.         if [ `$(WHOAMI)` != $(LSVNAME) ]; then chown $(LSVNAME) $@; \
  201.         else true; \
  202.         fi; \
  203.     else true; \
  204.     fi
  205.  
  206. $(LSVROOT)/go.sys:
  207.     echo "#!/bin/sh" >go.sys.temp
  208.     echo "LSVROOT="$(LSVROOT) >>go.sys.temp
  209.     echo "LSVSPOOL="$(LSVSPOOL) >>go.sys.temp
  210.     cat go.sys >>go.sys.temp
  211.     cp go.sys.temp $@
  212.     chmod 750 $@
  213.     if [ `$(WHOAMI)` != $(LSVNAME) ]; then chown $(LSVNAME) $@; else true; fi
  214.     rm go.sys.temp
  215.  
  216. # -- aliases used to install specific pieces
  217. install_lcmd: $(BINDIR)/lcmd
  218.  
  219. install_jobview: $(LSVSPOOL)/jobview
  220.  
  221. install_mailer: $(BINDIR)/lsv_amin
  222.  
  223. install_server: $(LSVROOT)/lsv
  224.  
  225. install: $(LSVROOT)/go.user $(LSVDIRS) $(LSVSPOOL)
  226.     if [ -s lsv.o ]; then make install_server; else true; fi
  227.     if [ -s lsv_amin.c ]; then make install_mailer; else true; fi
  228.     if [ -s lcmd.c ]; then make install_lcmd; else true; fi
  229.     if [ -s jobview.c ]; then make install_jobview; else true; fi
  230.     if [ -s u-install.memo ]; then \
  231.         make $(LSVROOT)/u-install.memo RFILE=u-install.memo; \
  232.     else true; \
  233.     fi
  234.     if [ -s go.sys ]; then \
  235.         if [ -s $(LSVROOT)/go.sys ]; then \
  236.             mv $(LSVROOT)/go.sys $(LSVROOT)/go.sys.OLD; \
  237.         else true; \
  238.         fi; \
  239.         make $(LSVROOT)/go.sys; \
  240.     else true; \
  241.     fi
  242.     if [ -s go ]; then \
  243.         if [ -s $(LSVROOT)/go ]; then \
  244.             mv $(LSVROOT)/go $(LSVROOT)/go.OLD; \
  245.         else true; \
  246.         fi; \
  247.         cp go $(LSVROOT)/go; \
  248.         chmod 750 $(LSVROOT)/go; \
  249.     else true; \
  250.     fi
  251.     if [ -s Makefile ]; then \
  252.         if [ -s $(LSVROOT)/Makefile ]; then \
  253.             mv $(LSVROOT)/Makefile $(LSVROOT)/Makefile.OLD; \
  254.         else true; \
  255.         fi; \
  256.         cp Makefile $(LSVROOT)/Makefile; \
  257.     else true; \
  258.     fi
  259.     if [ -s license.merge ]; then \
  260.         cp license.merge $(LSVROOT)/home/license.merge; \
  261.     else true; \
  262.     fi
  263.     if [ -d home ]; then \
  264.         FLIST=`ls home`; \
  265.         set -e; \
  266.         for CHK in $$FLIST; do \
  267.             make $(LSVROOT)/home/$$CHK HFILE=$$CHK; \
  268.         done; \
  269.     else true; \
  270.     fi
  271.     if [ `$(WHOAMI)` != $(LSVNAME) ]; then \
  272.         cd $(LSVROOT); \
  273.         chown -R $(LSVNAME) $(LSVDIRS); \
  274.     else true; \
  275.     fi
  276.     @echo " "
  277.     @echo "-- All files have been successfully installed. Next please" \
  278.         "enter,"
  279.     @echo "--    cd $(LSVROOT)"
  280.     @echo "-- and edit 'go.user'. The environment variables defined in" \
  281.         "that file"
  282.     @echo "-- must be customized before you start LISTSERV."
  283.  
  284. LSV_aliases:
  285.     if [ ".$(LSVAMIN_TYPE)" = ".links" ]; then \
  286.       echo "$(NEW_A): \"|$(BINDIR)/$(NEW_A)\"" >>$(ALIASES); \
  287.       ln -s $(BINDIR)/lsv_amin $(BINDIR)/$(NEW_A); \
  288.     else \
  289.       echo "$(NEW_A): \"|$(BINDIR)/lsv_amin -t $(NEW_A)\"" >>$(ALIASES); \
  290.     fi
  291.  
  292. aliases:
  293.     echo "# -- Aliases for LISTSERV server" >>$(ALIASES)
  294.     make LSV_aliases NEW_A=listserv
  295.     make LSV_aliases NEW_A=owner-listserv
  296.     newaliases
  297.     if [ -s '/etc/sendmail.pid' ]; then \
  298.         kill -HUP `cat /etc/sendmail.pid`; \
  299.     else true; \
  300.     fi
  301.  
  302. list:
  303.     echo "# -- Aliases for '$(WHICH)' mailing list" >>$(ALIASES)
  304.     make LSV_aliases NEW_A=$(WHICH)
  305.     make LSV_aliases NEW_A=owner-$(WHICH)
  306.     make LSV_aliases NEW_A=$(WHICH)-request
  307.     make LSV_aliases NEW_A=$(WHICH)-search-request
  308.     make LSV_aliases NEW_A=$(WHICH)-server
  309.     newaliases
  310.     if [ -s '/etc/sendmail.pid' ]; then \
  311.         kill -HUP `cat /etc/sendmail.pid`; \
  312.     else true; \
  313.     fi
  314.  
  315. # -- aliases for other things (which are defined above)
  316. both: lsv_amin lsv
  317.  
  318. all world: lsv_amin lsv lcmd jobview
  319.  
  320. LISTSERV listserv server: lsv
  321.  
  322. mailer: lsv_amin
  323.  
  324. update_utils install_utils: install_lcmd install_jobview
  325.  
  326. update: install
  327.  
  328. update_mailer: install_mailer
  329.  
  330. update_lcmd: install_lcmd
  331.  
  332. update_jobview: install_jobview
  333.  
  334. update_server: install_server
  335.