Home | History | Annotate | Line # | Download | only in dist
Makefile revision 1.1.1.10
      1 .PHONY: 	 clean install installwww
      2 .SUFFIXES:	 .sgml .html .md5 .h .h.html
      3 .SUFFIXES:	 .1       .3       .7
      4 .SUFFIXES:	 .1.txt   .3.txt   .7.txt
      5 .SUFFIXES:	 .1.pdf   .3.pdf   .7.pdf
      6 .SUFFIXES:	 .1.ps    .3.ps    .7.ps
      7 .SUFFIXES:	 .1.html  .3.html  .7.html 
      8 .SUFFIXES:	 .1.xhtml .3.xhtml .7.xhtml 
      9 
     10 # Specify this if you want to hard-code the operating system to appear
     11 # in the lower-left hand corner of -mdoc manuals.
     12 # CFLAGS	+= -DOSNAME="\"OpenBSD 4.5\""
     13 
     14 VERSION		 = 1.11.1
     15 VDATE		 = 04 April 2011
     16 CFLAGS		+= -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
     17 CFLAGS     	+= -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
     18 PREFIX		 = /usr/local
     19 BINDIR		 = $(PREFIX)/bin
     20 INCLUDEDIR	 = $(PREFIX)/include/mandoc
     21 LIBDIR		 = $(PREFIX)/lib/mandoc
     22 MANDIR		 = $(PREFIX)/man
     23 EXAMPLEDIR	 = $(PREFIX)/share/examples/mandoc
     24 INSTALL		 = install
     25 INSTALL_PROGRAM	 = $(INSTALL) -m 0755
     26 INSTALL_DATA	 = $(INSTALL) -m 0444
     27 INSTALL_LIB	 = $(INSTALL) -m 0644
     28 INSTALL_MAN	 = $(INSTALL_DATA)
     29 
     30 all: mandoc
     31 
     32 SRCS		 = Makefile \
     33 		   arch.c \
     34 		   arch.in \
     35 		   att.c \
     36 		   att.in \
     37 		   chars.c \
     38 		   chars.in \
     39 		   compat.c \
     40 		   config.h.post \
     41 		   config.h.pre \
     42 		   eqn.7 \
     43 		   eqn.c \
     44 		   example.style.css \
     45 		   external.png \
     46 		   html.c \
     47 		   html.h \
     48 		   index.css \
     49 		   index.sgml \
     50 		   lib.c \
     51 		   lib.in \
     52 		   libman.h \
     53 		   libmandoc.h \
     54 		   libmdoc.h \
     55 		   libroff.h \
     56 		   main.c \
     57 		   main.h \
     58 		   man.h \
     59 		   man.7 \
     60 		   man.c \
     61 		   man_hash.c \
     62 		   man_html.c \
     63 		   man_macro.c \
     64 		   man_term.c \
     65 		   man_validate.c \
     66 		   mandoc.1 \
     67 		   mandoc.3 \
     68 		   mandoc.c \
     69 		   mandoc.h \
     70 		   mandoc-db.1 \
     71 		   mandoc-db.c \
     72 		   mandoc_char.7 \
     73 		   mdoc.h \
     74 		   mdoc.7 \
     75 		   mdoc.c \
     76 		   mdoc_argv.c \
     77 		   mdoc_hash.c \
     78 		   mdoc_html.c \
     79 		   mdoc_macro.c \
     80 		   mdoc_term.c \
     81 		   mdoc_validate.c \
     82 		   msec.c \
     83 		   msec.in \
     84 		   out.c \
     85 		   out.h \
     86 		   read.c \
     87 		   roff.7 \
     88 		   roff.c \
     89 		   st.c \
     90 		   st.in \
     91 		   style.css \
     92 		   tbl.7 \
     93 		   tbl.c \
     94 		   tbl_data.c \
     95 		   tbl_html.c \
     96 		   tbl_layout.c \
     97 		   tbl_opts.c \
     98 		   tbl_term.c \
     99 		   term.c \
    100 		   term.h \
    101 		   term_ascii.c \
    102 		   term_ps.c \
    103 		   test-strlcat.c \
    104 		   test-strlcpy.c \
    105 		   tree.c \
    106 		   vol.c \
    107 		   vol.in
    108 
    109 LIBMAN_OBJS	 = man.o \
    110 		   man_hash.o \
    111 		   man_macro.o \
    112 		   man_validate.o
    113 LIBMAN_LNS	 = man.ln \
    114 		   man_hash.ln \
    115 		   man_macro.ln \
    116 		   man_validate.ln
    117 
    118 LIBMDOC_OBJS	 = arch.o \
    119 		   att.o \
    120 		   lib.o \
    121 		   mdoc.o \
    122 		   mdoc_argv.o \
    123 		   mdoc_hash.o \
    124 		   mdoc_macro.o \
    125 		   mdoc_validate.o \
    126 		   msec.o \
    127 		   st.o \
    128 		   vol.o
    129 LIBMDOC_LNS	 = arch.ln \
    130 		   att.ln \
    131 		   lib.ln \
    132 		   mdoc.ln \
    133 		   mdoc_argv.ln \
    134 		   mdoc_hash.ln \
    135 		   mdoc_macro.ln \
    136 		   mdoc_validate.ln \
    137 		   msec.ln \
    138 		   st.ln \
    139 		   vol.ln
    140 
    141 LIBROFF_OBJS	 = eqn.o \
    142 		   roff.o \
    143 		   tbl.o \
    144 		   tbl_data.o \
    145 		   tbl_layout.o \
    146 		   tbl_opts.o
    147 LIBROFF_LNS	 = eqn.ln \
    148 		   roff.ln \
    149 		   tbl.ln \
    150 		   tbl_data.ln \
    151 		   tbl_layout.ln \
    152 		   tbl_opts.ln
    153 
    154 LIBMANDOC_OBJS	 = $(LIBMAN_OBJS) \
    155 		   $(LIBMDOC_OBJS) \
    156 		   $(LIBROFF_OBJS) \
    157 		   mandoc.o \
    158 		   read.o
    159 LIBMANDOC_LNS	 = $(LIBMAN_LNS) \
    160 		   $(LIBMDOC_LNS) \
    161 		   $(LIBROFF_LNS) \
    162 		   mandoc.ln \
    163 		   read.ln
    164 
    165 arch.o arch.ln: arch.in
    166 att.o att.ln: att.in
    167 lib.o lib.ln: lib.in
    168 msec.o msec.ln: msec.in
    169 st.o st.ln: st.in
    170 vol.o vol.ln: vol.in
    171 
    172 $(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
    173 $(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
    174 $(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
    175 $(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
    176 
    177 MANDOC_HTML_OBJS = html.o \
    178 		   man_html.o \
    179 		   mdoc_html.o \
    180 		   tbl_html.o
    181 MANDOC_HTML_LNS	 = html.ln \
    182 		   man_html.ln \
    183 		   mdoc_html.ln \
    184 		   tbl_html.ln
    185 
    186 MANDOC_TERM_OBJS = man_term.o \
    187 		   mdoc_term.o \
    188 		   term.o \
    189 		   term_ascii.o \
    190 		   term_ps.o \
    191 		   tbl_term.o
    192 MANDOC_TERM_LNS	 = man_term.ln \
    193 		   mdoc_term.ln \
    194 		   term.ln \
    195 		   term_ascii.ln \
    196 		   term_ps.ln \
    197 		   tbl_term.ln
    198 
    199 MANDOC_OBJS	 = $(MANDOC_HTML_OBJS) \
    200 		   $(MANDOC_TERM_OBJS) \
    201 		   chars.o \
    202 		   main.o \
    203 		   out.o \
    204 		   tree.o
    205 MANDOC_LNS	 = $(MANDOC_HTML_LNS) \
    206 		   $(MANDOC_TERM_LNS) \
    207 		   chars.ln \
    208 		   main.ln \
    209 		   out.ln \
    210 		   tree.ln
    211 
    212 chars.o chars.ln: chars.in
    213 
    214 $(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
    215 $(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
    216 $(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
    217 
    218 compat.o compat.ln: config.h
    219 
    220 MANDOCDB_OBJS	 = mandoc-db.o
    221 MANDOCDB_LNS	 = mandoc-db.ln
    222 
    223 $(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandoc.h mdoc.h man.h config.h
    224 
    225 INDEX_MANS	 = mandoc.1.html \
    226 		   mandoc.1.xhtml \
    227 		   mandoc.1.ps \
    228 		   mandoc.1.pdf \
    229 		   mandoc.1.txt \
    230 		   mandoc.3.html \
    231 		   mandoc.3.xhtml \
    232 		   mandoc.3.ps \
    233 		   mandoc.3.pdf \
    234 		   mandoc.3.txt \
    235 		   eqn.7.html \
    236 		   eqn.7.xhtml \
    237 		   eqn.7.ps \
    238 		   eqn.7.pdf \
    239 		   eqn.7.txt \
    240 		   man.7.html \
    241 		   man.7.xhtml \
    242 		   man.7.ps \
    243 		   man.7.pdf \
    244 		   man.7.txt \
    245 		   mandoc_char.7.html \
    246 		   mandoc_char.7.xhtml \
    247 		   mandoc_char.7.ps \
    248 		   mandoc_char.7.pdf \
    249 		   mandoc_char.7.txt \
    250 		   mdoc.7.html \
    251 		   mdoc.7.xhtml \
    252 		   mdoc.7.ps \
    253 		   mdoc.7.pdf \
    254 		   mdoc.7.txt \
    255 		   roff.7.html \
    256 		   roff.7.xhtml \
    257 		   roff.7.ps \
    258 		   roff.7.pdf \
    259 		   roff.7.txt \
    260 		   tbl.7.html \
    261 		   tbl.7.xhtml \
    262 		   tbl.7.ps \
    263 		   tbl.7.pdf \
    264 		   tbl.7.txt
    265 
    266 $(INDEX_MANS): mandoc
    267 
    268 INDEX_OBJS	 = $(INDEX_MANS) \
    269 		   man.h.html \
    270 		   mandoc.h.html \
    271 		   mdoc.h.html \
    272 		   mdocml.tar.gz \
    273 		   mdocml.md5
    274 
    275 www: index.html
    276 
    277 lint: llib-llibmandoc.ln llib-lmandoc.ln
    278 
    279 clean:
    280 	rm -f libmandoc.a $(LIBMANDOC_OBJS)
    281 	rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
    282 	rm -f mandoc-db $(MANDOCDB_OBJS)
    283 	rm -f llib-lmandoc-db.ln $(MANDOCDB_LNS)
    284 	rm -f mandoc $(MANDOC_OBJS)
    285 	rm -f llib-lmandoc.ln $(MANDOC_LNS)
    286 	rm -f config.h config.log compat.o compat.ln
    287 	rm -f mdocml.tar.gz
    288 	rm -f index.html $(INDEX_OBJS)
    289 
    290 install: all
    291 	mkdir -p $(DESTDIR)$(BINDIR)
    292 	mkdir -p $(DESTDIR)$(EXAMPLEDIR)
    293 	mkdir -p $(DESTDIR)$(MANDIR)/man1
    294 	mkdir -p $(DESTDIR)$(MANDIR)/man3
    295 	mkdir -p $(DESTDIR)$(MANDIR)/man7
    296 	$(INSTALL_PROGRAM) mandoc $(DESTDIR)$(BINDIR)
    297 	$(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
    298 	$(INSTALL_MAN) mandoc.1 $(DESTDIR)$(MANDIR)/man1
    299 	$(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
    300 	$(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
    301 	$(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
    302 
    303 installwww: www
    304 	mkdir -p $(PREFIX)/snapshots
    305 	$(INSTALL_DATA) index.html external.png index.css $(PREFIX)
    306 	$(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
    307 	$(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
    308 	$(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
    309 	$(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
    310 	$(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
    311 	$(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
    312 
    313 libmandoc.a: compat.o $(LIBMANDOC_OBJS)
    314 	$(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
    315 
    316 llib-llibmandoc.ln: compat.ln $(LIBMANDOC_LNS)
    317 	$(LINT) $(LINTFLAGS) -Clibmandoc compat.ln $(LIBMANDOC_LNS)
    318 
    319 mandoc: $(MANDOC_OBJS) libmandoc.a
    320 	$(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
    321 
    322 # You'll need -ldb for Linux.
    323 mandoc-db: $(MANDOCDB_OBJS) libmandoc.a
    324 	$(CC) -o $@ $(MANDOCDB_OBJS) libmandoc.a
    325 
    326 llib-lmandoc.ln: $(MANDOC_LNS)
    327 	$(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
    328 
    329 llib-lmandoc-db.ln: $(MANDOCDB_LNS)
    330 	$(LINT) $(LINTFLAGS) -Cmandoc-db $(MANDOCDB_LNS)
    331 
    332 mdocml.md5: mdocml.tar.gz
    333 	md5 mdocml.tar.gz >$@
    334 
    335 mdocml.tar.gz: $(SRCS)
    336 	mkdir -p .dist/mdocml-$(VERSION)/
    337 	$(INSTALL) -m 0444 $(SRCS) .dist/mdocml-$(VERSION)
    338 	( cd .dist/ && tar zcf ../$@ ./ )
    339 	rm -rf .dist/
    340 
    341 index.html: $(INDEX_OBJS)
    342 
    343 config.h: config.h.pre config.h.post
    344 	rm -f config.log
    345 	( cat config.h.pre; \
    346 	  echo; \
    347 	  if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
    348 		echo '#define HAVE_STRLCAT'; \
    349 		rm test-strlcat; \
    350 	  fi; \
    351 	  if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
    352 		echo '#define HAVE_STRLCPY'; \
    353 		rm test-strlcpy; \
    354 	  fi; \
    355 	  echo; \
    356 	  cat config.h.post \
    357 	) > $@
    358 
    359 .h.h.html:
    360 	highlight -I $< >$@
    361 
    362 .1.1.txt .3.3.txt .7.7.txt:
    363 	./mandoc -Tascii -Wall,stop $< | col -b >$@
    364 
    365 .1.1.html .3.3.html .7.7.html:
    366 	./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
    367 
    368 .1.1.ps .3.3.ps .7.7.ps:
    369 	./mandoc -Tps -Wall,stop $< >$@
    370 
    371 .1.1.xhtml .3.3.xhtml .7.7.xhtml:
    372 	./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
    373 
    374 .1.1.pdf .3.3.pdf .7.7.pdf:
    375 	./mandoc -Tpdf -Wall,stop $< >$@
    376 
    377 .sgml.html:
    378 	validate --warn $<
    379 	sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@
    380