SEND_TODISP(_ALL)?: append newline if message does have no final one
[s-mailx.git] / makefile
blob45ae62c941fb825b15d9b141d11eb4f070eea927
1 #@ Makefile for S-nail.
2 #@ Adjustments have to be made in make.rc -- or on the command line.
3 #@ See the file INSTALL if you need help.
5 .PHONY: ohno tangerine all config build install uninstall clean distclean test \
6 devel odevel
8 ohno: build
9 tangerine: config build test install
10 all: config build
12 config:
13 @$(_prego)
14 build:
15 @$(_prestop); LC_ALL=C $${MAKE} -f ./mk.mk $(MAILJOBS) all
16 install packager-install: build
17 @$(_prestop); LC_ALL=C $${MAKE} -f ./mk.mk DESTDIR="$(DESTDIR)" install
18 uninstall:
19 @$(_prestop); LC_ALL=C $${MAKE} -f ./mk.mk uninstall
21 clean:
22 @$(_prestop); LC_ALL=C $${MAKE} -f ./mk.mk clean
23 distclean:
24 @$(_prestop); LC_ALL=C $${MAKE} -f ./mk.mk distclean
26 test:
27 @$(_prestop); LC_ALL=C $${MAKE} -f ./mk.mk test
29 devel:
30 @CONFIG=DEVEL; export CONFIG; $(_prego); $(_prestop);\
31 LC_ALL=C $${MAKE} -f ./mk.mk _update-version &&\
32 LC_ALL=C $${MAKE} -f ./mk.mk $(MAILJOBS) all
33 odevel:
34 @CONFIG=ODEVEL; export CONFIG; $(_prego); $(_prestop);\
35 LC_ALL=C $${MAKE} -f ./mk.mk _update-version &&\
36 LC_ALL=C $${MAKE} -f ./mk.mk $(MAILJOBS) all
37 d-b:
38 @$(_prestop); LC_ALL=C $${MAKE} -f ./mk.mk _update-version &&\
39 LC_ALL=C $${MAKE} -f ./mk.mk $(MAILJOBS) all
41 d-gettext:
42 LC_ALL=C xgettext --sort-by-file --strict --add-location \
43 --from-code=UTF-8 --keyword --keyword=_ --keyword=N_ \
44 --add-comments=I18N --foreign-user \
45 -o messages.pot *.c *.h
47 _prego = SHELL="$(SHELL)" MAKE="$(MAKE)" \
48 CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
49 $(SHELL) ./mk-conf.sh || exit 1
50 _prestop = if [ -f ./mk.mk ]; then :; else \
51 echo 'Program not configured, nothing to do';\
52 echo 'Use one of the targets: config, all, tangerine';\
53 exit 1;\
54 fi;\
55 < ./config.ev read __ev__; eval $${__ev__}; unset __ev__
57 # Corresponds to same thing in mk-mk.in! (Except it is sed not $(sed))
58 _version_from_header = VERSION="`< version.h sed \
59 -e '/ VERSION /b X' -e d -e ':X' \
60 -e 's/[^\"]*\"v\([^\"]\{1,\}\)\"/\1/'`"
62 # This is pretty specific
63 _update-release:
64 @ORIG_LC_ALL=${LC_ALL};\
65 LC_ALL=C; export LC_ALL;\
66 : $${UAGENT:=s-nail};\
67 : $${UUAGENT:=S-nail};\
68 : $${UPLOAD:=steffen@sdaoden.eu:/var/www/localhost/downloads};\
69 : $${ACCOUNT:=ich};\
70 DATE_MAN="`date -u +'%b %d, %Y'`";\
71 DATE_ISO="`date -u +%Y-%m-%d`";\
72 if [ "`git rev-parse --verify HEAD`" != \
73 "`git rev-parse --verify master`" ]; then \
74 echo >&2 'Not on the [master] branch';\
75 exit 1;\
76 fi;\
77 if [ "`git status --porcelain --ignored |\
78 awk 'BEGIN{no=0}{++no}END{print no}'`" -ne 0 ]; then\
79 echo >&2 'Directory not clean, see git status --ignored';\
80 exit 2;\
81 fi;\
82 echo 'Name of release tag:';\
83 read REL;\
84 echo "Is $${UAGENT} <v$${REL}> correct? ENTER continues";\
85 read i;\
87 git show announce > "$${TMPDIR}/$${UAGENT}-$${REL}.ann.mail" &&\
89 grep=grep sed=sed cmp=cmp mv=mv \
90 VERSION="$${REL}" $(MAKE) -f mk-mk.in _update-version &&\
91 $(_version_from_header);\
92 REL="$${VERSION}";\
94 < nail.1 > nail.1x awk '\
95 BEGIN { written = 0 }\
96 /\.\\"--MKREL-START--/, /\.\\"--MKREL-END--/ {\
97 if (written++ != 0)\
98 next;\
99 print ".\\\"--MKREL-START--";\
100 print ".\\\" '"$${UUAGENT}"'(1): v'"$${REL}"'" \
101 " / '"$${DATE_ISO}"'";\
102 print ".Dd '"$${DATE_MAN}"'";\
103 print ".ds VV \\\\%v'"$${REL}"'";\
104 print ".\\\"--MKREL-END--";\
105 next\
107 {print}\
108 ' &&\
109 mv -f nail.1x nail.1 &&\
111 < nail.rc > nail.rcx awk '\
112 BEGIN { written = 0 }\
113 /^#--MKREL-START--/, /^#--MKREL-END--/ {\
114 if (written++ != 0)\
115 next;\
116 print "#--MKREL-START--";\
117 print \
118 "# '"$${UUAGENT}"'(1): v'"$${REL}"' / '"$${DATE_ISO}"'";\
119 print "#--MKREL-END--";\
120 next\
122 {print}\
123 ' && \
124 mv -f nail.rcx nail.rc &&\
126 ./mk-okey-map.pl&&\
127 ./mk-tcap-map.pl&&\
129 git add version.h nail.1 nail.rc okeys.h tcaps.h&&\
130 LC_ALL=${ORIG_LC_ALL} git commit -S -m "Bump $${UUAGENT} v$${REL}" &&\
131 LC_ALL=${ORIG_LC_ALL} git tag -s -f "v$${REL}" &&\
133 git update-ref refs/heads/next master &&\
135 git checkout timeline &&\
136 git rm -rf '*' &&\
137 git archive --format=tar "v$${REL}" | tar -x -f - &&\
140 rm -f .gitignore .mailmap TODO &&\
141 sed -E -e '/^\.\\"--MKREL-(START|END)--/d' \
142 -e '/--BEGINSTRIP--/,$$ {' \
143 -e '/^\.[[:space:]]*$$/d' -e '/^\.[[:space:]]*\\"/d' \
144 -e '}' \
145 -e '/^\.$$/d' < nail.1 > nail.1x &&\
146 mv -f nail.1x nail.1 &&\
147 if command -v mdocmx.sh >/dev/null 2>&1; then \
148 mdocmx.sh < nail.1 > nail.1x &&\
149 mv -f nail.1x nail.1;\
150 fi; \
151 sed -Ee '/^#--MKREL-(START|END)--/d' \
152 < nail.rc > nail.rcx &&\
153 mv -f nail.rcx nail.rc \
154 ) &&\
156 ./mk-okey-map.pl noverbose &&\
157 ./mk-tcap-map.pl noverbose &&\
159 git add --all &&\
160 LC_ALL=${ORIG_LC_ALL} \
161 git commit -S -m "$${UUAGENT} v$${REL}, $${DATE_ISO}" &&\
162 LC_ALL=${ORIG_LC_ALL} git tag -s -f "v$${REL}.ar" &&\
164 git checkout master &&\
165 git log --no-walk --decorate --oneline --branches --remotes &&\
166 git branch &&\
167 echo "Push git(1) repo? ENTER continues";\
168 read i;\
169 git push &&\
171 git archive --format=tar --prefix="$${UAGENT}-$${REL}/" "v$${REL}.ar" |\
172 ( cd "$${TMPDIR}" && tar -x -f - ) &&\
173 cd "$${TMPDIR}" &&\
175 tar -c -f "$${UAGENT}-$${REL}.tar" "$${UAGENT}-$${REL}" &&\
176 openssl sha1 "$${UAGENT}-$${REL}.tar" >> \
177 "$${UAGENT}-$${REL}.cksum" 2>&1 &&\
178 openssl sha256 "$${UAGENT}-$${REL}.tar" >> \
179 "$${UAGENT}-$${REL}.cksum" 2>&1 &&\
180 openssl sha512 "$${UAGENT}-$${REL}.tar" >> \
181 "$${UAGENT}-$${REL}.cksum" 2>&1 &&\
182 gpg --detach-sign --armor "$${UAGENT}-$${REL}.tar" 2>&1 &&\
183 cat "$${UAGENT}-$${REL}.tar.asc" >> \
184 "$${UAGENT}-$${REL}.cksum" 2>&1 &&\
185 < "$${UAGENT}-$${REL}.tar" gzip > "$${UAGENT}-$${REL}.tar.gz" &&\
186 < "$${UAGENT}-$${REL}.tar" xz -e -C sha256 > \
187 "$${UAGENT}-$${REL}.tar.xz" &&\
190 echo "-put $${UAGENT}-$${REL}.tar";\
191 echo "-rm $${UAGENT}-latest.tar";\
192 echo "-ln $${UAGENT}-$${REL}.tar $${UAGENT}-latest.tar";\
193 echo "-put $${UAGENT}-$${REL}.tar.gz";\
194 echo "-rm $${UAGENT}-latest.tar.gz";\
195 echo "-ln $${UAGENT}-$${REL}.tar.gz $${UAGENT}-latest.tar.gz";\
196 echo "-put $${UAGENT}-$${REL}.tar.xz";\
197 echo "-rm $${UAGENT}-latest.tar.xz";\
198 echo "-ln $${UAGENT}-$${REL}.tar.xz $${UAGENT}-latest.tar.xz";\
199 echo "-put $${UAGENT}-$${REL}.tar.asc";\
200 echo "-rm $${UAGENT}-latest.tar.asc";\
201 echo "-ln $${UAGENT}-$${REL}.tar.asc $${UAGENT}-latest.tar.asc";\
202 echo "-chmod 0644 $${UAGENT}-$${REL}.tar*";\
203 ) | \
204 sftp -b - $${UPLOAD} &&\
205 echo 'All seems fine';\
207 echo 'Really send announcement mail? ENTER continues';\
208 read i;\
209 cd "$${UAGENT}-$${REL}" &&\
210 make CONFIG=MAXIMAL all &&\
211 < "$${TMPDIR}/$${UAGENT}-$${REL}.ann.mail" \
212 LC_ALL=${ORIG_LC_ALL} ./$${UAGENT} -A $${ACCOUNT} \
213 -Snofollowup-to \
214 -s "[ANN]ouncing $${UUAGENT} v$${REL}" \
215 -t &&\
216 echo 'Uff.'
218 # s-mk-mode