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 accmacvar.o: okeys.h
31 config.o imap.o pop3.o smtp.o urlcrecry.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) '\
54 i = ENVIRON["_VERSION"];\
57 XX = ".ds XX \\\\%[\\\\*(VV-" substr(i, j + 1) "]";\
59 XX = ".ds XX \\\\%[\\\\*(VV]";\
61 /\.\\"--MKMAN-START--/, /\.\\"--MKMAN-END--/ {\
66 un = toupper(ENVIRON["_UAGENT"]);\
68 cn = toupper(substr(ln, 1, 1)) substr(ln, 2);\
70 print ".ds UU \\\\%", un;\
71 print ".ds UA \\\\%", cn;\
72 print ".ds ua \\\\%", ln;\
73 print ".ds UR \\\\%", ENVIRON["_SYSCONFRC"];\
81 mkrc.rc: nail.rc mk.mk
82 @[ -n "$(VERBOSE)" ] &&\
83 echo ' GEN $(UAGENT) default resource file ($(@))';\
84 _SYSCONFRC="$(SYSCONFRC)" _UAGENT="$(UAGENT)" \
85 < ./nail.rc > $(@) $(AWK) 'BEGIN {written = 0}\
86 /^#--MKRC-START--/, /^#--MKRC-END--/ {\
91 ln = tolower(ENVIRON["_UAGENT"]);\
92 cn = toupper(substr(ln, 1, 1)) substr(ln, 2);\
93 print "# ", ENVIRON["_SYSCONFRC"], \
94 " - configuration file for ", cn, "(1)";\
104 install: _install_echoes mk.mk mkman.1 mkrc.rc
107 if [ ! -d "$${_dir}" ]; then \
108 if [ -n "$(VERBOSE)" ]; then \
109 echo " \$$ $(MKDIR) -m 0755 -p '$${_dir}'";\
111 $(MKDIR) -m 0755 -p "$${_dir}";\
115 _mode=$${1} _src=$${2} _dst=$${3};\
116 if [ -n "$(VERBOSE)" ]; then \
117 echo " \$$ $(CP) -f '$${_src}' '$${_dst}'";\
118 echo " \$$ $(CHMOD) $${_mode} '$${_dst}'";\
120 $(CP) -f "$${_src}" "$${_dst}";\
121 $(CHMOD) $${_mode} "$${_dst}";\
125 if [ "$(WANT_DEBUG)" != 0 ]; then \
126 if [ -n "$(VERBOSE)" ]; then \
127 echo " \$$ :WANT_DEBUG=1, not strip(1)ing";\
129 elif [ -n "$(HAVE_STRIP)" ]; then \
130 if [ -n "$(VERBOSE)" ]; then \
131 echo " \$$ $(STRIP) '$${_file}'";\
133 $(STRIP) "$${_file}";\
136 if [ -n "$(DESTDIR)" ]; then __mkdir "$(DESTDIR)"; fi;\
137 __mkdir "$(DESTDIR)$(BINDIR)";\
138 __copyfile 0755 "$(UAGENT)" "$(DESTDIR)$(BINDIR)/$(UAGENT)";\
139 __stripfile "$(DESTDIR)$(BINDIR)/$(UAGENT)";\
140 __mkdir "$(DESTDIR)$(MANDIR)/man1";\
141 __copyfile 0644 ./mkman.1 "$(DESTDIR)$(MANDIR)/man1/$(UAGENT).1";\
142 __mkdir "$(DESTDIR)$(SYSCONFDIR)";\
143 if [ ! -f "$(DESTDIR)$(SYSCONFRC)" ]; then \
144 __copyfile 0644 ./mkrc.rc "$(DESTDIR)$(SYSCONFRC)";\
148 @echo 'Uninstalling..';\
149 [ -n "$(VERBOSE)" ] &&\
150 echo ' $$ $(RM) -f "$(DESTDIR)$(BINDIR)/$(UAGENT)" \
151 "$(DESTDIR)$(MANDIR)/man1/$(UAGENT).1"';\
152 $(RM) -f "$(DESTDIR)$(BINDIR)/$(UAGENT)" \
153 "$(DESTDIR)$(MANDIR)/man1/$(UAGENT).1";\
154 if [ -n "$(VERBOSE)" ] && [ -f "$(DESTDIR)$(SYSCONFRC)" ]; then \
155 echo ' NOTE: not removing "$(DESTDIR)$(SYSCONFRC)"';\
159 @echo 'Cleaning up..';\
160 [ -n "$(VERBOSE)" ] &&\
161 echo ' $$ $(RM) -f $(OBJ) $(UAGENT) ./mime_types.h ./mkman.1 \
163 $(RM) -f $(OBJ) $(UAGENT) ./mime_types.h ./mkman.1 ./mkrc.rc
166 @echo 'Deconfiguring..';\
167 [ -n "$(VERBOSE)" ] && echo ' $$ $(RM) -f ./config.* ./*.mk';\
168 $(RM) -f ./config.* ./*.mk
171 @if [ -z "$(VERSION)" ]; then \
172 eval VERSION="`(git describe --tags) 2>/dev/null`";\
173 if [ -z "$${VERSION}" ]; then \
174 VERSION="`$(SED) -e 's/[^\"]*\"\([^\"]\{1,\}\)\"/\1/' \
176 echo "$${VERSION}" | $(GREP) -q -F dirty ||\
177 VERSION="$${VERSION}-dirty";\
180 trap "$(RM) ./version.tmp" 0 1 2 15;\
181 printf > ./version.tmp "#define VERSION \"$${VERSION}\"\n";\
182 $(CMP) ./version.tmp ./version.h >/dev/null 2>&1 && exit;\
183 mv ./version.tmp ./version.h;\
186 # vim:set fenc=utf-8 ft=make: