1 #@ `mk-mk.in' -- mk.mk template, completed by mk-conf.sh
2 #@ Please see `INSTALL' and `conf.rc' instead.
7 @if [ -z "$(VERBOSE)" ]; then echo ' CC $(<)';\
8 else echo ' $$ $(CC) $(CFLAGS) $(INCLUDES) -c $(<)';\
10 $(CC) $(CFLAGS) $(INCLUDES) -c $(<)
13 all: _all_echoes $(UAGENT)
16 if [ -z "$(VERBOSE)" ]; then \
18 echo '. CFLAGS : $(CFLAGS)';\
19 echo '. INCLUDES: $(INCLUDES)';\
20 [ -n "$(LDFLAGS)" ] && echo '. LDFLAGS : $(LDFLAGS)';\
21 echo '. LIBS : $(LIBS)';\
24 @if [ -z "$(VERBOSE)" ]; then echo ' LINK $(@)';\
25 else echo ' $$ $(CC) $(LDFLAGS) -o $(@) $(OBJ) $(LIBS)';\
27 $(CC) $(LDFLAGS) -o $(@) $(OBJ) $(LIBS)
29 $(OBJ): config.h nail.h extern.h $(OBJ_DEP)
30 config.o acmava.o: okeys.h
31 config.o imap.o: imap_gssapi.h
32 config.o lex.o: cmd_tab.h
33 config.o main.o: version.h
34 config.o md5.o imap.o smtp.o auxlily.o pop3.o: md5.h
35 config.o mime.o: mime_types.h
37 mime_types.h: mime.types
39 < ./mime.types > $(@) $(SED) -e '/^#/d; /^$$/d; s/^/ "/; s/$$/",/'
42 @echo 'Running test, please wait';\
43 $(SHELL) ./cc-test.sh --check-only ./$(UAGENT)
46 @[ -n "$(VERBOSE)" ] && echo ' GEN $(UAGENT) manual ($(@))';\
47 _VERSION=`< version.h \
48 $(SED) -e 's/^\#define VERSION "\\(.\\{1,\\}\\)"$$/\\1/'` \
49 _SYSCONFRC="$(SYSCONFRC)" _UAGENT="$(UAGENT)" \
50 < ./nail.1 > $(@) $(AWK) 'BEGIN {written = 0}\
51 /.\"--MKMAN-START--/, /.\"--MKMAN-END--/ {\
56 un = toupper(ENVIRON["_UAGENT"]);\
58 cn = toupper(substr(ln, 1, 1)) substr(ln, 2);\
59 print ".ds UU \\\\%", un;\
60 print ".ds UA \\\\%", cn;\
61 printf ".ds UV \\\\%%%s [%s]\n", cn, ENVIRON["_VERSION"];\
62 print ".ds ua \\\\%", ln;\
63 print ".ds UR \\\\%", ENVIRON["_SYSCONFRC"];\
70 mkrc.rc: nail.rc mk.mk
71 @[ -n "$(VERBOSE)" ] &&\
72 echo ' GEN $(UAGENT) default resource file ($(@))';\
73 _SYSCONFRC="$(SYSCONFRC)" _UAGENT="$(UAGENT)" \
74 < ./nail.rc > $(@) $(AWK) 'BEGIN {written = 0}\
75 /#--MKRC-START--/, /#--MKRC-END--/ {\
80 ln = tolower(ENVIRON["_UAGENT"]);\
81 cn = toupper(substr(ln, 1, 1)) substr(ln, 2);\
82 print "# ", ENVIRON["_SYSCONFRC"];\
83 print "# Configuration file for ", cn, "(1)";\
92 install: _install_echoes mk.mk mkman.1 mkrc.rc
95 if [ ! -d "$${_dir}" ]; then \
96 if [ -n "$(VERBOSE)" ]; then \
97 echo " \$$ $(MKDIR) -m 0755 -p '$${_dir}'";\
99 $(MKDIR) -m 0755 -p "$${_dir}";\
103 _mode=$${1} _src=$${2} _dst=$${3};\
104 if [ -n "$(VERBOSE)" ]; then \
105 echo " \$$ $(CP) -f '$${_src}' '$${_dst}'";\
106 echo " \$$ $(CHMOD) $${_mode} '$${_dst}'";\
108 $(CP) -f "$${_src}" "$${_dst}";\
109 $(CHMOD) $${_mode} "$${_dst}";\
113 if [ -n "$(HAVE_STRIP)" ]; then \
114 if [ -n "$(VERBOSE)" ]; then \
115 echo " \$$ $(STRIP) '$${_file}'";\
117 $(STRIP) "$${_file}";\
120 if [ -n "$(DESTDIR)" ]; then __mkdir "$(DESTDIR)"; fi;\
121 __mkdir "$(DESTDIR)$(BINDIR)";\
122 __copyfile 0755 "$(UAGENT)" "$(DESTDIR)$(BINDIR)/$(UAGENT)";\
123 __stripfile "$(DESTDIR)$(BINDIR)/$(UAGENT)";\
124 __mkdir "$(DESTDIR)$(MANDIR)/man1";\
125 __copyfile 0644 ./mkman.1 "$(DESTDIR)$(MANDIR)/man1/$(UAGENT).1";\
126 __mkdir "$(DESTDIR)$(SYSCONFDIR)";\
127 if [ ! -f "$(DESTDIR)$(SYSCONFRC)" ]; then \
128 __copyfile 0644 ./mkrc.rc "$(DESTDIR)$(SYSCONFRC)";\
132 @echo 'Uninstalling..';\
133 [ -n "$(VERBOSE)" ] &&\
134 echo ' $$ $(RM) -f "$(DESTDIR)$(BINDIR)/$(UAGENT)" \
135 "$(DESTDIR)$(MANDIR)/man1/$(UAGENT).1"';\
136 $(RM) -f "$(DESTDIR)$(BINDIR)/$(UAGENT)" \
137 "$(DESTDIR)$(MANDIR)/man1/$(UAGENT).1";\
138 [ -n "$(VERBOSE)" ] && [ -f "$(DESTDIR)$(SYSCONFRC)" ] &&\
139 echo ' NOTE: not removing "$(DESTDIR)$(SYSCONFRC)"!'
142 @echo 'Cleaning up..';\
143 [ -n "$(VERBOSE)" ] &&\
144 echo ' $$ $(RM) -f $(OBJ) $(UAGENT) ./mime_types.h ./mkman.1 \
146 $(RM) -f $(OBJ) $(UAGENT) ./mime_types.h ./mkman.1 ./mkrc.rc
149 @echo 'Deconfiguring..';\
150 [ -n "$(VERBOSE)" ] && echo ' $$ $(RM) -f ./config.* ./*.mk';\
151 $(RM) -f ./config.* ./*.mk
154 @if [ -z "$(VERSION)" ]; then \
155 eval VERSION="`(git describe --tags) 2>/dev/null`";\
156 if [ -z "$${VERSION}" ]; then \
157 VERSION="`$(SED) -e 's/[^\"]*\"\([^\"]\{1,\}\)\"/\1/' \
159 echo "$${VERSION}" | grep -q -F dirty ||\
160 VERSION="$${VERSION}-dirty";\
163 trap "$(RM) ./version.tmp" 0 1 2 15;\
164 printf > ./version.tmp "#define VERSION \"$${VERSION}\"\n";\
165 $(CMP) ./version.tmp ./version.h >/dev/null 2>&1 && exit;\
166 mv ./version.tmp ./version.h;\
170 if [ "`git rev-parse --verify HEAD`" != \
171 "`git rev-parse --verify master`" ]; then \
172 echo >&2 'Not on the [master] branch';\
175 echo 'Name of release tag:';\
177 echo "Is $(UAGENT) <v$${REL}> correct? ENTER continues";\
179 FREL=`echo $${REL} | $(SED) -e 's/\./_/g'` &&\
180 $(MAKE) -f ./mk.mk _update-version &&\
181 git add version.h &&\
182 git commit -m "Bump $(UAGENT) v$${REL}" &&\
183 git tag -f "v$${REL}" &&\
184 $(MAKE) -f ./mk.mk _update-version &&\
185 git add version.h && git commit --amend &&\
186 git tag -f "v$${REL}" &&\
187 git checkout -B crawl master &&\
188 git checkout -B next master &&\
189 git checkout master &&\
190 git log --no-walk --decorate --oneline --branches --remotes &&\
192 echo "Push git(1) repo? ENTER continues";\
194 git push && git gc --aggressive &&\
195 git archive --prefix="$(UAGENT)-$${REL}/" \
196 -o "$${TMPDIR}/$(UAGENT)-$${FREL}.tar.gz" HEAD &&\
198 tar -x -z -f "$(UAGENT)-$${FREL}.tar.gz" &&\
199 $(RM) -f "$(UAGENT)-$${FREL}.tar.gz" &&\
200 tar -c -f "$(UAGENT)-$${FREL}.tar" "$(UAGENT)-$${REL}" &&\
201 < "$(UAGENT)-$${FREL}.tar" gzip > "$(UAGENT)-$${FREL}.tar.gz" &&\
202 < "$(UAGENT)-$${FREL}.tar" xz > "$(UAGENT)-$${FREL}.tar.xz" &&\
203 $(RM) -f "$(UAGENT)-$${FREL}.tar" &&\
204 openssl md5 "$(UAGENT)-$${FREL}.tar.gz" > \
205 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
206 openssl sha1 "$(UAGENT)-$${FREL}.tar.gz" >> \
207 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
208 openssl sha256 "$(UAGENT)-$${FREL}.tar.gz" >> \
209 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
210 openssl md5 "$(UAGENT)-$${FREL}.tar.xz" > \
211 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
212 openssl sha1 "$(UAGENT)-$${FREL}.tar.xz" >> \
213 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
214 openssl sha256 "$(UAGENT)-$${FREL}.tar.xz" >> \
215 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
216 ( echo "-put $(UAGENT)-$${FREL}.tar.gz";\
217 echo "-put $(UAGENT)-$${FREL}.tar.xz" ) | \
218 sftp -b - sdaoden@frs.sourceforge.net:/home/frs/project/s-nail &&\
219 echo 'All seems fine';\
220 echo 'Really send announcement mail? ENTER continues';\
222 cd "$(UAGENT)-$${REL}" &&\
224 ./s-nail -A sdn_sf -s "[ANNOUNCE] of S-nail v$${REL}" nail-announce &&\
226 echo "Really remove $(UAGENT)-$${REL} build dir? ENTER continues";\
228 $(RM) -rf "$(UAGENT)-$${REL}" &&\
231 # vim:set fenc=utf-8 ft=make: