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