Fixed warnings from diff on first-time install of nmh. Also added 'echo's
[mmh] / etc / Makefile.in
1 #
2 # Makefile for etc subdirectory
3 #
4 # $Id$
5 #
6
7 SHELL = /bin/sh
8
9 top_srcdir = @top_srcdir@
10 srcdir     = @srcdir@
11 VPATH      = @srcdir@
12
13 prefix      = @prefix@
14 exec_prefix = @exec_prefix@
15 bindir      = @bindir@
16 libdir      = @libdir@
17 etcdir      = @sysconfdir@
18
19 MTS         = @MTS@
20 mailspool   = @mailspool@
21 masquerade  = @masquerade@
22 smtpservers = @smtpservers@
23
24 INSTALL         = @INSTALL@
25 INSTALL_PROGRAM = @INSTALL_PROGRAM@
26 INSTALL_DATA    = @INSTALL_DATA@
27
28 # Path to search for programs to handle MIME
29 # content.  Used to create mhn.defaults
30 MHNSEARCHPATH = "$(PATH):/usr/demo/SOUND"
31
32 # Program used to search path for various programs to
33 # handle MIME content.  Used to create mhn.defaults
34 MHNSEARCHPROG = $(srcdir)/mhn.find.sh
35
36 SED = sed
37
38 .SUFFIXES:
39
40 # static configuration, format, and components files
41 STATIC_FILES =  MailAliases components digestcomps distcomps forwcomps  \
42                 mhl.body mhl.digest mhl.format mhl.forward mhl.headers  \
43                 mhl.reply rcvdistcomps rcvdistcomps.outbox              \
44                 replcomps replgroupcomps scan.MMDDYY scan.YYYYMMDD      \
45                 scan.default scan.mailx scan.nomime scan.size scan.time \
46                 scan.timely scan.unseen
47
48 # templates and scripts from which non-static files are generated
49 GENERATED_FILE_SRCS = mhn.defaults.sh mhn.find.sh mts.conf.in sendfiles.in
50
51 # scripts generated using above GENERATED_FILE_SRCs
52 GENERATED_BIN_FILES = sendfiles
53
54 # non-scripts generated using above GENERATED_FILE_SRCs
55 GENERATED_ETC_FILES = mhn.defaults mts.conf
56
57 # scripts we need to install (in bin)
58 INSTALL_BIN_FILES = $(GENERATED_BIN_FILES)
59
60 # non-scripts we need to install (in etc)
61 INSTALL_ETC_FILES = $(STATIC_FILES) $(GENERATED_ETC_FILES)
62
63 # auxiliary files (included in distribution but not installed)
64 AUX = Makefile.in
65
66 # all non-generated files in this directory are included in the distribution
67 DIST = $(STATIC_FILES) $(GENERATED_FILE_SRCS) $(AUX)
68
69 # ========= DEPENDENCIES FOR BUILDING ==========
70
71 all: $(GENERATED_BIN_FILES) $(GENERATED_ETC_FILES)
72
73 mhn.defaults: $(srcdir)/mhn.defaults.sh $(MHNSEARCHPROG)
74         rm -f $@
75         $(srcdir)/mhn.defaults.sh $(MHNSEARCHPATH) $(MHNSEARCHPROG) > $@
76
77 mts.conf: $(srcdir)/mts.conf.in Makefile
78         rm -f $@
79         $(SED) -e 's,%mts%,$(MTS),' \
80                -e 's,%mailspool%,$(mailspool),' \
81                -e 's,%etcdir%,$(etcdir),' \
82                -e 's,%masquerade%,$(masquerade),' \
83                -e 's,%smtpservers%,$(smtpservers),' < $(srcdir)/mts.conf.in > $@
84
85 sendfiles: $(srcdir)/sendfiles.in Makefile
86         rm -f $@
87         $(SED) -e 's,%libdir%,$(libdir),' < $(srcdir)/sendfiles.in > $@
88
89 install: install-bin-files install-etc-files
90
91 install-bin-files:
92         $(top_srcdir)/mkinstalldirs $(bindir)
93         for script in $(INSTALL_BIN_FILES); do \
94           $(INSTALL_PROGRAM) $(srcdir)/$$script $(bindir)/$$script; \
95         done
96
97 install-etc-files:
98         $(top_srcdir)/mkinstalldirs $(etcdir)
99         for file in $(INSTALL_ETC_FILES); do \
100           echo "Installing $$file..."; \
101           if [ -f $(etcdir)/$$file ]; then \
102             mv $(etcdir)/$$file $(etcdir)/$$file.prev; \
103             $(INSTALL_DATA) $(srcdir)/$$file $(etcdir)/$$file; \
104             if diff $(etcdir)/$$file.prev $(etcdir)/$$file; then \
105               rm $(etcdir)/$$file.prev; \
106             else \
107               echo; \
108               echo "  Previous version of $$file saved as $$file.prev due\c";\
109               echo   " to diffs."; \
110               echo "  Please merge any local config changes into the new\c"; \
111               echo   " $$file."; \
112               echo; \
113             fi; \
114           else \
115             $(INSTALL_DATA) $(srcdir)/$$file $(etcdir)/$$file; \
116           fi; \
117         done
118
119 uninstall: uninstall-bin-files uninstall-etc-files
120
121 uninstall-bin-files:
122         for script in $(INSTALL_BIN_FILES); do \
123           rm -f $(bindir)/$$script; \
124         done
125
126 uninstall-etc-files:
127         for file in $(INSTALL_ETC_FILES); do \
128           rm -f $(etcdir)/$$file; \
129         done
130
131 # ========== DEPENDENCIES FOR CLEANUP ==========
132
133 mostlyclean:
134         rm -f *~
135
136 clean: mostlyclean
137         rm -f $(GENERATED_ETC_FILES) $(GENERATED_BIN_FILES)
138
139 distclean: clean
140         rm -f Makefile
141
142 realclean: distclean
143
144 superclean: realclean
145
146 # ========== DEPENDENCIES FOR MAINTENANCE ==========
147
148 subdir = etc
149
150 Makefile: Makefile.in ../config.status
151         cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
152  
153 distdir = ../`cat ../distname`/$(subdir)
154 nmhdist: $(DIST)
155         @echo "Copying distribution files in $(subdir)"
156         @for file in $(DIST); do \
157           cp -p $(srcdir)/$$file $(distdir); \
158         done
159