Merge branch 'topic/shoens-2000'
[s-mailx.git] / makefile
bloba504d4f74ffd0cf9be834da8e2746eab79ce292e
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: all install uninstall clean distclean config build test
7 _not_all_: build
8 all: config
9 @LC_ALL=C $(MAKE) -f ./mk.mk all
10 install: all
11 @LC_ALL=C $(MAKE) -f ./mk.mk install
12 uninstall:
13 @$(_prestop) && LC_ALL=C $(MAKE) -f ./mk.mk uninstall
14 clean:
15 @$(_prestop) && LC_ALL=C $(MAKE) -f ./mk.mk clean
16 distclean:
17 @$(_prestop) && LC_ALL=C $(MAKE) -f ./mk.mk distclean
19 config:
20 @$(_prego)
21 build:
22 @$(_prestop) && LC_ALL=C $(MAKE) -f ./mk.mk all
23 test:
24 @$(_prestop) && LC_ALL=C $(MAKE) -f ./mk.mk test
25 doinstall packager-install:
26 @$(_prestop) && LC_ALL=C $(MAKE) -f ./mk.mk DESTDIR="$(DESTDIR)" install
28 devel:
29 @CONFIG=DEVEL; export CONFIG;\
30 $(_prego) && LC_ALL=C $(MAKE) -f ./mk.mk _update-version &&\
31 LC_ALL=C $(MAKE) -f ./mk.mk all
32 odevel:
33 @CONFIG=ODEVEL; export CONFIG;\
34 $(_prego) && LC_ALL=C $(MAKE) -f ./mk.mk _update-version &&\
35 LC_ALL=C $(MAKE) -f ./mk.mk all
37 _prego = SHELL="$(SHELL)" MAKE="$(MAKE)" \
38 CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
39 $(SHELL) ./mk-conf.sh
40 _prestop = if [ -f ./mk.mk ]; then :; else \
41 echo 'Program not configured, nothing to do';\
42 echo 'The following targets will work: config, [all], install';\
43 exit 1;\
46 # Corresponds to same thing in mk-mk.in! (Except it is sed not $(sed))
47 _version_from_header = VERSION="`< version.h sed \
48 -e '/ VERSION /b X' -e d -e ':X' \
49 -e 's/[^\"]*\"v\([^\"]\{1,\}\)\"/\1/'`"
51 # This is pretty specific
52 _update-release:
53 @ORIG_LC_ALL=${LC_ALL};\
54 LC_ALL=C; export LC_ALL;\
55 : $${UAGENT:=s-nail};\
56 : $${UUAGENT:=S-nail};\
57 : $${UPLOAD:=steffen@sdaoden.eu:/var/www/localhost/downloads};\
58 : $${ACCOUNT:=ich};\
59 DATE_MAN="`date -u +'%b %d, %Y'`";\
60 DATE_ISO="`date -u +%Y-%m-%d`";\
61 if [ "`git rev-parse --verify HEAD`" != \
62 "`git rev-parse --verify master`" ]; then \
63 echo >&2 'Not on the [master] branch';\
64 exit 1;\
65 fi;\
66 if [ "`git status --porcelain --ignored |\
67 awk 'BEGIN{no=0}{++no}END{print no}'`" -ne 0 ]; then\
68 echo >&2 'Directory not clean, see git status --ignored';\
69 exit 2;\
70 fi;\
71 echo 'Name of release tag:';\
72 read REL;\
73 echo "Is $${UAGENT} <v$${REL}> correct? ENTER continues";\
74 read i;\
76 git show announce > "$${TMPDIR}/$${UAGENT}-$${REL}.ann.mail" &&\
78 grep=grep sed=sed cmp=cmp mv=mv \
79 VERSION="$${REL}" $(MAKE) -f mk-mk.in _update-version &&\
80 $(_version_from_header);\
81 REL="$${VERSION}";\
83 < nail.1 > nail.1x awk '\
84 BEGIN { written = 0 }\
85 /\.\\"--MKREL-START--/, /\.\\"--MKREL-END--/ {\
86 if (written++ != 0)\
87 next;\
88 print ".\\\"--MKREL-START--";\
89 print ".\\\" '"$${UUAGENT}"'(1): v'"$${REL}"'" \
90 " / '"$${DATE_ISO}"'";\
91 print ".Dd '"$${DATE_MAN}"'";\
92 print ".ds VV \\\\%v'"$${REL}"'";\
93 print ".\\\"--MKREL-END--";\
94 next\
96 {print}\
97 ' &&\
98 mv -f nail.1x nail.1 &&\
100 < nail.rc > nail.rcx awk '\
101 BEGIN { written = 0 }\
102 /^#--MKREL-START--/, /^#--MKREL-END--/ {\
103 if (written++ != 0)\
104 next;\
105 print "#--MKREL-START--";\
106 print \
107 "# '"$${UUAGENT}"'(1): v'"$${REL}"' / '"$${DATE_ISO}"'";\
108 print "#--MKREL-END--";\
109 next\
111 {print}\
112 ' && \
113 mv -f nail.rcx nail.rc &&\
115 git add version.h nail.1 nail.rc &&\
116 LC_ALL=${ORIG_LC_ALL} git commit -S -m "Bump $${UUAGENT} v$${REL}" &&\
117 LC_ALL=${ORIG_LC_ALL} git tag -s -f "v$${REL}" &&\
119 git update-ref refs/heads/next master &&\
121 git checkout timeline &&\
122 git rm -rf '*' &&\
123 git archive --format=tar "v$${REL}" | tar -x -f - &&\
126 rm -f .gitignore .mailmap TODO &&\
127 sed -E -e '/^\.\\"--MKREL-(START|END)--/d' \
128 -e '/--BEGINSTRIP--/,$$ {' \
129 -e '/^\.[[:space:]]*$$/d' -e '/^\.[[:space:]]*\\"/d' \
130 -e '}' \
131 -e '/^\.$$/d' < nail.1 > nail.1x &&\
132 mv -f nail.1x nail.1 &&\
133 if command -v mdocmx.sh >/dev/null 2>&1; then \
134 mdocmx.sh < nail.1 > nail.1x &&\
135 mv -f nail.1x nail.1;\
136 fi; \
137 sed -Ee '/^#--MKREL-(START|END)--/d' \
138 < nail.rc > nail.rcx &&\
139 mv -f nail.rcx nail.rc \
140 ) &&\
142 git add --all &&\
143 LC_ALL=${ORIG_LC_ALL} \
144 git commit -S -m "$${UUAGENT} v$${REL}, $${DATE_ISO}" &&\
145 LC_ALL=${ORIG_LC_ALL} git tag -s -f "v$${REL}.ar" &&\
147 git checkout master &&\
148 git log --no-walk --decorate --oneline --branches --remotes &&\
149 git branch &&\
150 echo "Push git(1) repo? ENTER continues";\
151 read i;\
152 git push &&\
154 git archive --format=tar --prefix="$${UAGENT}-$${REL}/" "v$${REL}.ar" |\
155 ( cd "$${TMPDIR}" && tar -x -f - ) &&\
156 cd "$${TMPDIR}" &&\
157 tar -c -f "$${UAGENT}-$${REL}.tar" "$${UAGENT}-$${REL}" &&\
159 openssl md5 "$${UAGENT}-$${REL}.tar" > \
160 "$${UAGENT}-$${REL}.cksum" 2>&1 &&\
161 openssl sha1 "$${UAGENT}-$${REL}.tar" >> \
162 "$${UAGENT}-$${REL}.cksum" 2>&1 &&\
163 openssl sha256 "$${UAGENT}-$${REL}.tar" >> \
164 "$${UAGENT}-$${REL}.cksum" 2>&1 &&\
165 gpg --detach-sign --armor "$${UAGENT}-$${REL}.tar" 2>&1 &&\
166 cat "$${UAGENT}-$${REL}.tar.asc" >> \
167 "$${UAGENT}-$${REL}.cksum" 2>&1 &&\
169 < "$${UAGENT}-$${REL}.tar" gzip > "$${UAGENT}-$${REL}.tar.gz" &&\
170 < "$${UAGENT}-$${REL}.tar" xz -e -C sha256 > \
171 "$${UAGENT}-$${REL}.tar.xz" &&\
173 rm -f "$${UAGENT}-$${REL}.tar" &&\
176 echo "-put $${UAGENT}-$${REL}.tar.gz";\
177 echo "-rm $${UAGENT}-latest.tar.gz";\
178 echo "-ln $${UAGENT}-$${REL}.tar.gz $${UAGENT}-latest.tar.gz";\
179 echo "-put $${UAGENT}-$${REL}.tar.xz";\
180 echo "-rm $${UAGENT}-latest.tar.xz";\
181 echo "-ln $${UAGENT}-$${REL}.tar.xz $${UAGENT}-latest.tar.xz";\
182 echo "-put $${UAGENT}-$${REL}.tar.asc";\
183 echo "-rm $${UAGENT}-latest.tar.asc";\
184 echo "-ln $${UAGENT}-$${REL}.tar.asc $${UAGENT}-latest.tar.asc";\
185 echo "-chmod 0644 $${UAGENT}-$${REL}.tar.*";\
186 ) | \
187 sftp -b - $${UPLOAD} &&\
188 echo 'All seems fine';\
190 echo 'Really send announcement mail? ENTER continues';\
191 read i;\
192 cd "$${UAGENT}-$${REL}" &&\
193 make CONFIG=MAXIMAL all &&\
194 LC_ALL=${ORIG_LC_ALL} ./$${UAGENT} -A $${ACCOUNT} \
195 -s "[ANNOUNCE] of $${UUAGENT} v$${REL}" \
196 -q "$${TMPDIR}/$${UAGENT}-$${REL}.ann.mail" \
197 -b mailx-announce-bcc mailx-announce &&\
198 echo 'Uff.'
200 # s-mk-mode