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 nailfuns.h $(OBJ_DEP)
30 config.o acmava.o: okeys.h
31 config.o auxlily.o imap.o pop3.o smtp.o: rfc1321.h
32 config.o imap.o: imap_gssapi.h
33 config.o lex.o: cmd_tab.h
34 config.o main.o: version.h
35 config.o mime.o: mime_types.h
36 config.o smtp.o: smtp_gssapi.h
38 mime_types.h: mime.types
40 < ./mime.types > $(@) $(SED) -e '/^#/d; /^$$/d; s/^/ "/; s/$$/",/'
43 @echo 'Running test, please wait';\
44 $(SHELL) ./cc-test.sh --check-only ./$(UAGENT)
47 @[ -n "$(VERBOSE)" ] && echo ' GEN $(UAGENT) manual ($(@))';\
48 _VERSION=`< version.h \
49 $(SED) -e 's/^\#define VERSION "\\(.\\{1,\\}\\)"$$/\\1/'` \
50 _SYSCONFRC="$(SYSCONFRC)" _UAGENT="$(UAGENT)" \
51 < ./nail.1 > $(@) $(AWK) 'BEGIN {written = 0}\
52 /.\"--MKMAN-START--/, /.\"--MKMAN-END--/ {\
57 un = toupper(ENVIRON["_UAGENT"]);\
59 cn = toupper(substr(ln, 1, 1)) substr(ln, 2);\
60 print ".ds UU \\\\%", un;\
61 print ".ds UA \\\\%", cn;\
62 printf ".ds UV \\\\%%%s [%s]\n", cn, ENVIRON["_VERSION"];\
63 print ".ds ua \\\\%", ln;\
64 print ".ds UR \\\\%", ENVIRON["_SYSCONFRC"];\
71 mkrc.rc: nail.rc mk.mk
72 @[ -n "$(VERBOSE)" ] &&\
73 echo ' GEN $(UAGENT) default resource file ($(@))';\
74 _SYSCONFRC="$(SYSCONFRC)" _UAGENT="$(UAGENT)" \
75 < ./nail.rc > $(@) $(AWK) 'BEGIN {written = 0}\
76 /#--MKRC-START--/, /#--MKRC-END--/ {\
81 ln = tolower(ENVIRON["_UAGENT"]);\
82 cn = toupper(substr(ln, 1, 1)) substr(ln, 2);\
83 print "# ", ENVIRON["_SYSCONFRC"];\
84 print "# Configuration file for ", cn, "(1)";\
93 install: _install_echoes mk.mk mkman.1 mkrc.rc
96 if [ ! -d "$${_dir}" ]; then \
97 if [ -n "$(VERBOSE)" ]; then \
98 echo " \$$ $(MKDIR) -m 0755 -p '$${_dir}'";\
100 $(MKDIR) -m 0755 -p "$${_dir}";\
104 _mode=$${1} _src=$${2} _dst=$${3};\
105 if [ -n "$(VERBOSE)" ]; then \
106 echo " \$$ $(CP) -f '$${_src}' '$${_dst}'";\
107 echo " \$$ $(CHMOD) $${_mode} '$${_dst}'";\
109 $(CP) -f "$${_src}" "$${_dst}";\
110 $(CHMOD) $${_mode} "$${_dst}";\
114 if [ "$(WANT_DEBUG)" != 0 ]; then \
115 if [ -n "$(VERBOSE)" ]; then \
116 echo " \$$ :WANT_DEBUG=1, not strip(1)ing";\
118 elif [ -n "$(HAVE_STRIP)" ]; then \
119 if [ -n "$(VERBOSE)" ]; then \
120 echo " \$$ $(STRIP) '$${_file}'";\
122 $(STRIP) "$${_file}";\
125 if [ -n "$(DESTDIR)" ]; then __mkdir "$(DESTDIR)"; fi;\
126 __mkdir "$(DESTDIR)$(BINDIR)";\
127 __copyfile 0755 "$(UAGENT)" "$(DESTDIR)$(BINDIR)/$(UAGENT)";\
128 __stripfile "$(DESTDIR)$(BINDIR)/$(UAGENT)";\
129 __mkdir "$(DESTDIR)$(MANDIR)/man1";\
130 __copyfile 0644 ./mkman.1 "$(DESTDIR)$(MANDIR)/man1/$(UAGENT).1";\
131 __mkdir "$(DESTDIR)$(SYSCONFDIR)";\
132 if [ ! -f "$(DESTDIR)$(SYSCONFRC)" ]; then \
133 __copyfile 0644 ./mkrc.rc "$(DESTDIR)$(SYSCONFRC)";\
137 @echo 'Uninstalling..';\
138 [ -n "$(VERBOSE)" ] &&\
139 echo ' $$ $(RM) -f "$(DESTDIR)$(BINDIR)/$(UAGENT)" \
140 "$(DESTDIR)$(MANDIR)/man1/$(UAGENT).1"';\
141 $(RM) -f "$(DESTDIR)$(BINDIR)/$(UAGENT)" \
142 "$(DESTDIR)$(MANDIR)/man1/$(UAGENT).1";\
143 [ -n "$(VERBOSE)" ] && [ -f "$(DESTDIR)$(SYSCONFRC)" ] &&\
144 echo ' NOTE: not removing "$(DESTDIR)$(SYSCONFRC)"!'
147 @echo 'Cleaning up..';\
148 [ -n "$(VERBOSE)" ] &&\
149 echo ' $$ $(RM) -f $(OBJ) $(UAGENT) ./mime_types.h ./mkman.1 \
151 $(RM) -f $(OBJ) $(UAGENT) ./mime_types.h ./mkman.1 ./mkrc.rc
154 @echo 'Deconfiguring..';\
155 [ -n "$(VERBOSE)" ] && echo ' $$ $(RM) -f ./config.* ./*.mk';\
156 $(RM) -f ./config.* ./*.mk
159 @if [ -z "$(VERSION)" ]; then \
160 eval VERSION="`(git describe --tags) 2>/dev/null`";\
161 if [ -z "$${VERSION}" ]; then \
162 VERSION="`$(SED) -e 's/[^\"]*\"\([^\"]\{1,\}\)\"/\1/' \
164 echo "$${VERSION}" | $(GREP) -q -F dirty ||\
165 VERSION="$${VERSION}-dirty";\
168 trap "$(RM) ./version.tmp" 0 1 2 15;\
169 printf > ./version.tmp "#define VERSION \"$${VERSION}\"\n";\
170 $(CMP) ./version.tmp ./version.h >/dev/null 2>&1 && exit;\
171 mv ./version.tmp ./version.h;\
175 if [ "`git rev-parse --verify HEAD`" != \
176 "`git rev-parse --verify master`" ]; then \
177 echo >&2 'Not on the [master] branch';\
180 echo 'Name of release tag:';\
182 echo "Is $(UAGENT) <v$${REL}> correct? ENTER continues";\
184 FREL=`echo $${REL} | $(SED) -e 's/\./_/g'` &&\
185 $(MAKE) -f ./mk.mk _update-version &&\
186 git add version.h &&\
187 git commit -m "Bump $(UAGENT) v$${REL}" &&\
188 git tag -f "v$${REL}" &&\
189 $(MAKE) -f ./mk.mk _update-version &&\
190 git add version.h && git commit --amend &&\
191 git tag -f "v$${REL}" &&\
192 git update-ref refs/heads/next master &&\
193 git log --no-walk --decorate --oneline --branches --remotes &&\
195 echo "Push git(1) repo? ENTER continues";\
198 git archive --prefix="$(UAGENT)-$${REL}/" \
199 -o "$${TMPDIR}/$(UAGENT)-$${FREL}.tar.gz" HEAD &&\
201 tar -x -z -f "$(UAGENT)-$${FREL}.tar.gz" &&\
202 $(RM) -f "$(UAGENT)-$${FREL}.tar.gz" &&\
203 tar -c -f "$(UAGENT)-$${FREL}.tar" "$(UAGENT)-$${REL}" &&\
204 < "$(UAGENT)-$${FREL}.tar" gzip > "$(UAGENT)-$${FREL}.tar.gz" &&\
205 < "$(UAGENT)-$${FREL}.tar" xz > "$(UAGENT)-$${FREL}.tar.xz" &&\
206 $(RM) -f "$(UAGENT)-$${FREL}.tar" &&\
207 openssl md5 "$(UAGENT)-$${FREL}.tar.gz" > \
208 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
209 openssl sha1 "$(UAGENT)-$${FREL}.tar.gz" >> \
210 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
211 openssl sha256 "$(UAGENT)-$${FREL}.tar.gz" >> \
212 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
213 openssl md5 "$(UAGENT)-$${FREL}.tar.xz" >> \
214 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
215 openssl sha1 "$(UAGENT)-$${FREL}.tar.xz" >> \
216 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
217 openssl sha256 "$(UAGENT)-$${FREL}.tar.xz" >> \
218 "$(UAGENT)-$${FREL}.cksum" 2>&1 &&\
219 ( echo "-put $(UAGENT)-$${FREL}.tar.gz";\
220 echo "-put $(UAGENT)-$${FREL}.tar.xz" ) | \
221 sftp -b - sdaoden@frs.sourceforge.net:/home/frs/project/s-nail &&\
222 echo 'All seems fine';\
223 echo 'Really send announcement mail? ENTER continues';\
225 cd "$(UAGENT)-$${REL}" &&\
227 ./s-nail -A sn_sf -s "[ANNOUNCE] of S-nail v$${REL}" nail-announce &&\
229 echo "Really remove $(UAGENT)-$${REL} build dir? ENTER continues";\
231 $(RM) -rf "$(UAGENT)-$${REL}" &&\
234 # vim:set fenc=utf-8 ft=make: