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