1 1.1 joerg .SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz .1.txt .3.txt .7.txt .1.sgml .3.sgml .7.sgml 2 1.1 joerg 3 1.1 joerg BINDIR = $(PREFIX)/bin 4 1.1 joerg INCLUDEDIR = $(PREFIX)/include 5 1.1 joerg LIBDIR = $(PREFIX)/lib 6 1.1 joerg MANDIR = $(PREFIX)/man 7 1.1 joerg EXAMPLEDIR = $(PREFIX)/share/examples/mandoc 8 1.1 joerg INSTALL_PROGRAM = install -m 0755 9 1.1 joerg INSTALL_DATA = install -m 0444 10 1.1 joerg INSTALL_LIB = install -m 0644 11 1.1 joerg INSTALL_MAN = $(INSTALL_DATA) 12 1.1 joerg 13 1.1 joerg VERSION = 1.9.15 14 1.1 joerg VDATE = 18 February 2010 15 1.1 joerg 16 1.1 joerg VFLAGS = -DVERSION="\"$(VERSION)\"" -DHAVE_CONFIG_H 17 1.1 joerg WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings 18 1.1 joerg CFLAGS += -g $(VFLAGS) $(WFLAGS) 19 1.1 joerg #CFLAGS += -DOSNAME="\"OpenBSD 4.5\"" 20 1.1 joerg LINTFLAGS += $(VFLAGS) 21 1.1 joerg 22 1.1 joerg MANDOCFLAGS = -Wall -fstrict 23 1.1 joerg MANDOCHTML = -Thtml -Ostyle=style.css,man=%N.%S.html,includes=%I.html 24 1.1 joerg 25 1.1 joerg MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln mdoc_strings.ln \ 26 1.1 joerg mdoc_argv.ln mdoc_validate.ln mdoc_action.ln \ 27 1.1 joerg lib.ln att.ln arch.ln vol.ln msec.ln st.ln \ 28 1.1 joerg mandoc.ln 29 1.1 joerg MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o mdoc_strings.o \ 30 1.1 joerg mdoc_argv.o mdoc_validate.o mdoc_action.o lib.o att.o \ 31 1.1 joerg arch.o vol.o msec.o st.o mandoc.o 32 1.1 joerg MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \ 33 1.1 joerg mdoc_argv.c mdoc_validate.c mdoc_action.c lib.c att.c \ 34 1.1 joerg arch.c vol.c msec.c st.c mandoc.c 35 1.1 joerg 36 1.1 joerg MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \ 37 1.1 joerg man_action.ln mandoc.ln man_argv.ln 38 1.1 joerg MANOBJS = man_macro.o man.o man_hash.o man_validate.o \ 39 1.1 joerg man_action.o mandoc.o man_argv.o 40 1.1 joerg MANSRCS = man_macro.c man.c man_hash.c man_validate.c \ 41 1.1 joerg man_action.c mandoc.c man_argv.c 42 1.1 joerg 43 1.1 joerg MAINLNS = main.ln mdoc_term.ln chars.ln term.ln tree.ln \ 44 1.1 joerg compat.ln man_term.ln html.ln mdoc_html.ln \ 45 1.1 joerg man_html.ln out.ln 46 1.1 joerg MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \ 47 1.1 joerg man_term.o html.o mdoc_html.o man_html.o out.o 48 1.1 joerg MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \ 49 1.1 joerg man_term.c html.c mdoc_html.c man_html.c out.c 50 1.1 joerg 51 1.1 joerg LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln 52 1.1 joerg LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS) 53 1.1 joerg LIBS = libmdoc.a libman.a 54 1.1 joerg OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS) 55 1.1 joerg SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS) 56 1.1 joerg DATAS = arch.in att.in lib.in msec.in st.in \ 57 1.1 joerg vol.in chars.in 58 1.1 joerg HEADS = mdoc.h libmdoc.h man.h libman.h term.h \ 59 1.1 joerg libmandoc.h html.h chars.h out.h main.h 60 1.1 joerg GSGMLS = mandoc.1.sgml mdoc.3.sgml mdoc.7.sgml manuals.7.sgml \ 61 1.1 joerg mandoc_char.7.sgml man.7.sgml man.3.sgml 62 1.1 joerg SGMLS = index.sgml 63 1.1 joerg HTMLS = ChangeLog.html index.html 64 1.1 joerg XSLS = ChangeLog.xsl 65 1.1 joerg GHTMLS = mandoc.1.html mdoc.3.html man.3.html mdoc.7.html \ 66 1.1 joerg man.7.html mandoc_char.7.html manuals.7.html 67 1.1 joerg TEXTS = mandoc.1.txt mdoc.3.txt man.3.txt mdoc.7.txt man.7.txt \ 68 1.1 joerg mandoc_char.7.txt manuals.7.txt ChangeLog.txt 69 1.1 joerg EXAMPLES = example.style.css 70 1.1 joerg XMLS = ChangeLog.xml 71 1.1 joerg STATICS = index.css style.css external.png 72 1.1 joerg MD5S = mdocml-$(VERSION).md5 73 1.1 joerg TARGZS = mdocml-$(VERSION).tar.gz 74 1.1 joerg MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \ 75 1.1 joerg man.7 man.3 76 1.1 joerg BINS = mandoc 77 1.1 joerg TESTS = test-strlcat.c test-strlcpy.c 78 1.1 joerg CONFIGS = config.h.pre config.h.post 79 1.1 joerg CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \ 80 1.1 joerg $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) \ 81 1.1 joerg $(GHTMLS) config.h config.log 82 1.1 joerg INSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \ 83 1.1 joerg $(DATAS) $(XSLS) $(EXAMPLES) $(TESTS) $(CONFIGS) 84 1.1 joerg 85 1.1 joerg all: $(BINS) 86 1.1 joerg 87 1.1 joerg lint: $(LLNS) 88 1.1 joerg 89 1.1 joerg clean: 90 1.1 joerg rm -f $(CLEAN) 91 1.1 joerg 92 1.1 joerg cleanlint: 93 1.1 joerg rm -f $(LNS) $(LLNS) 94 1.1 joerg 95 1.1 joerg cleanhtml: 96 1.1 joerg rm -f $(HTMLS) $(GSGMLS) $(GHTMLS) 97 1.1 joerg 98 1.1 joerg dist: mdocml-$(VERSION).tar.gz 99 1.1 joerg 100 1.1 joerg www: all $(GSGMLS) $(GHTMLS) $(HTMLS) $(TEXTS) $(MD5S) $(TARGZS) 101 1.1 joerg 102 1.1 joerg htmls: all $(GSGMLS) $(GHTMLS) 103 1.1 joerg 104 1.1 joerg installwww: www 105 1.1 joerg install -m 0444 $(GHTMLS) $(HTMLS) $(TEXTS) $(STATICS) $(PREFIX)/ 106 1.1 joerg install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/ 107 1.1 joerg install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/ 108 1.1 joerg install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz 109 1.1 joerg install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/mdocml.md5 110 1.1 joerg 111 1.1 joerg install: 112 1.1 joerg mkdir -p $(BINDIR) 113 1.1 joerg mkdir -p $(EXAMPLEDIR) 114 1.1 joerg mkdir -p $(MANDIR)/man1 115 1.1 joerg mkdir -p $(MANDIR)/man7 116 1.1 joerg $(INSTALL_PROGRAM) mandoc $(BINDIR) 117 1.1 joerg $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1 118 1.1 joerg $(INSTALL_MAN) man.7 mdoc.7 $(MANDIR)/man7 119 1.1 joerg $(INSTALL_DATA) example.style.css $(EXAMPLEDIR) 120 1.1 joerg 121 1.1 joerg uninstall: 122 1.1 joerg rm -f $(BINDIR)/mandoc 123 1.1 joerg rm -f $(MANDIR)/man1/mandoc.1 124 1.1 joerg rm -f $(MANDIR)/man7/mdoc.7 125 1.1 joerg rm -f $(MANDIR)/man7/man.7 126 1.1 joerg rm -f $(EXAMPLEDIR)/example.style.css 127 1.1 joerg 128 1.1 joerg $(OBJS): config.h 129 1.1 joerg 130 1.1 joerg $(LNS): config.h 131 1.1 joerg 132 1.1 joerg man_macro.ln: man_macro.c libman.h 133 1.1 joerg man_macro.o: man_macro.c libman.h 134 1.1 joerg 135 1.1 joerg lib.ln: lib.c lib.in libmdoc.h 136 1.1 joerg lib.o: lib.c lib.in libmdoc.h 137 1.1 joerg 138 1.1 joerg att.ln: att.c att.in libmdoc.h 139 1.1 joerg att.o: att.c att.in libmdoc.h 140 1.1 joerg 141 1.1 joerg arch.ln: arch.c arch.in libmdoc.h 142 1.1 joerg arch.o: arch.c arch.in libmdoc.h 143 1.1 joerg 144 1.1 joerg vol.ln: vol.c vol.in libmdoc.h 145 1.1 joerg vol.o: vol.c vol.in libmdoc.h 146 1.1 joerg 147 1.1 joerg chars.ln: chars.c chars.in chars.h 148 1.1 joerg chars.o: chars.c chars.in chars.h 149 1.1 joerg 150 1.1 joerg msec.ln: msec.c msec.in libmdoc.h 151 1.1 joerg msec.o: msec.c msec.in libmdoc.h 152 1.1 joerg 153 1.1 joerg st.ln: st.c st.in libmdoc.h 154 1.1 joerg st.o: st.c st.in libmdoc.h 155 1.1 joerg 156 1.1 joerg mdoc_macro.ln: mdoc_macro.c libmdoc.h 157 1.1 joerg mdoc_macro.o: mdoc_macro.c libmdoc.h 158 1.1 joerg 159 1.1 joerg mdoc_term.ln: mdoc_term.c term.h mdoc.h 160 1.1 joerg mdoc_term.o: mdoc_term.c term.h mdoc.h 161 1.1 joerg 162 1.1 joerg mdoc_strings.ln: mdoc_strings.c libmdoc.h 163 1.1 joerg mdoc_strings.o: mdoc_strings.c libmdoc.h 164 1.1 joerg 165 1.1 joerg man_hash.ln: man_hash.c libman.h 166 1.1 joerg man_hash.o: man_hash.c libman.h 167 1.1 joerg 168 1.1 joerg mdoc_hash.ln: mdoc_hash.c libmdoc.h 169 1.1 joerg mdoc_hash.o: mdoc_hash.c libmdoc.h 170 1.1 joerg 171 1.1 joerg mdoc.ln: mdoc.c libmdoc.h 172 1.1 joerg mdoc.o: mdoc.c libmdoc.h 173 1.1 joerg 174 1.1 joerg man.ln: man.c libman.h 175 1.1 joerg man.o: man.c libman.h 176 1.1 joerg 177 1.1 joerg main.ln: main.c mdoc.h 178 1.1 joerg main.o: main.c mdoc.h 179 1.1 joerg 180 1.1 joerg compat.ln: compat.c 181 1.1 joerg compat.o: compat.c 182 1.1 joerg 183 1.1 joerg term.ln: term.c term.h man.h mdoc.h chars.h 184 1.1 joerg term.o: term.c term.h man.h mdoc.h chars.h 185 1.1 joerg 186 1.1 joerg html.ln: html.c html.h chars.h 187 1.1 joerg html.o: html.c html.h chars.h 188 1.1 joerg 189 1.1 joerg mdoc_html.ln: mdoc_html.c html.h mdoc.h 190 1.1 joerg mdoc_html.o: mdoc_html.c html.h mdoc.h 191 1.1 joerg 192 1.1 joerg man_html.ln: man_html.c html.h man.h out.h 193 1.1 joerg man_html.o: man_html.c html.h man.h out.h 194 1.1 joerg 195 1.1 joerg out.ln: out.c out.h 196 1.1 joerg out.o: out.c out.h 197 1.1 joerg 198 1.1 joerg tree.ln: tree.c man.h mdoc.h 199 1.1 joerg tree.o: tree.c man.h mdoc.h 200 1.1 joerg 201 1.1 joerg mdoc_argv.ln: mdoc_argv.c libmdoc.h 202 1.1 joerg mdoc_argv.o: mdoc_argv.c libmdoc.h 203 1.1 joerg 204 1.1 joerg man_argv.ln: man_argv.c libman.h 205 1.1 joerg man_argv.o: man_argv.c libman.h 206 1.1 joerg 207 1.1 joerg man_validate.ln: man_validate.c libman.h 208 1.1 joerg man_validate.o: man_validate.c libman.h 209 1.1 joerg 210 1.1 joerg mdoc_validate.ln: mdoc_validate.c libmdoc.h 211 1.1 joerg mdoc_validate.o: mdoc_validate.c libmdoc.h 212 1.1 joerg 213 1.1 joerg mdoc_action.ln: mdoc_action.c libmdoc.h 214 1.1 joerg mdoc_action.o: mdoc_action.c libmdoc.h 215 1.1 joerg 216 1.1 joerg libmdoc.h: mdoc.h 217 1.1 joerg 218 1.1 joerg ChangeLog.xml: 219 1.1 joerg cvs2cl --xml --xml-encoding iso-8859-15 -t --noxmlns -f $@ 220 1.1 joerg 221 1.1 joerg ChangeLog.txt: 222 1.1 joerg cvs2cl -t -f $@ 223 1.1 joerg 224 1.1 joerg ChangeLog.html: ChangeLog.xml ChangeLog.xsl 225 1.1 joerg xsltproc -o $@ ChangeLog.xsl ChangeLog.xml 226 1.1 joerg 227 1.1 joerg mdocml-$(VERSION).tar.gz: $(INSTALL) 228 1.1 joerg mkdir -p .dist/mdocml/mdocml-$(VERSION)/ 229 1.1 joerg cp -f $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/ 230 1.1 joerg ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ ) 231 1.1 joerg rm -rf .dist/ 232 1.1 joerg 233 1.1 joerg llib-llibmdoc.ln: $(MDOCLNS) 234 1.1 joerg $(LINT) -Clibmdoc $(MDOCLNS) 235 1.1 joerg 236 1.1 joerg llib-llibman.ln: $(MANLNS) 237 1.1 joerg $(LINT) -Clibman $(MANLNS) 238 1.1 joerg 239 1.1 joerg llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln 240 1.1 joerg $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln 241 1.1 joerg 242 1.1 joerg libmdoc.a: $(MDOCOBJS) 243 1.1 joerg $(AR) rs $@ $(MDOCOBJS) 244 1.1 joerg 245 1.1 joerg libman.a: $(MANOBJS) 246 1.1 joerg $(AR) rs $@ $(MANOBJS) 247 1.1 joerg 248 1.1 joerg mandoc: $(MAINOBJS) libmdoc.a libman.a 249 1.1 joerg $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a libman.a 250 1.1 joerg 251 1.1 joerg .sgml.html: 252 1.1 joerg validate --warn $< 253 1.1 joerg sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@ 254 1.1 joerg 255 1.1 joerg .1.1.txt .3.3.txt .7.7.txt: 256 1.1 joerg ./mandoc $(MANDOCFLAGS) $< | col -b > $@ 257 1.1 joerg 258 1.1 joerg .1.1.sgml .3.3.sgml .7.7.sgml: 259 1.1 joerg ./mandoc $(MANDOCFLAGS) $(MANDOCHTML) $< > $@ 260 1.1 joerg 261 1.1 joerg .tar.gz.md5: 262 1.1 joerg md5 $< > $@ 263 1.1 joerg 264 1.1 joerg config.h: config.h.pre config.h.post 265 1.1 joerg rm -f config.log 266 1.1 joerg ( cat config.h.pre; \ 267 1.1 joerg echo; \ 268 1.1 joerg if $(CC) $(CFLAGS) -Werror -c test-strlcat.c >> config.log 2>&1; then \ 269 1.1 joerg echo '#define HAVE_STRLCAT'; \ 270 1.1 joerg rm test-strlcat.o; \ 271 1.1 joerg fi; \ 272 1.1 joerg if $(CC) $(CFLAGS) -Werror -c test-strlcpy.c >> config.log 2>&1; then \ 273 1.1 joerg echo '#define HAVE_STRLCPY'; \ 274 1.1 joerg rm test-strlcpy.o; \ 275 1.1 joerg fi; \ 276 1.1 joerg echo; \ 277 1.1 joerg cat config.h.post \ 278 1.1 joerg ) > $@ 279