1CC=@CC@ 2CFLAGS=@CFLAGS@ 3LDFLAGS=@LDFLAGS@ 4AR=@AR@ 5RANLIB=@RANLIB@ 6INSTALL_PROGRAM=@INSTALL_PROGRAM@ 7INSTALL_DIR=@INSTALL_DIR@ 8INSTALL_DATA=@INSTALL_DATA@ 9 10BUILD=$(CC) -I. $(CFLAGS) 11LINK=$(CC) -L. $(LDFLAGS) 12 13.c.o: 14 $(BUILD) -c -o $@ $< 15 16 17BINDIR=@exedir@ 18MANDIR=@mandir@ 19LIBDIR=@libdir@ 20INCDIR=@prefix@/include 21@MK_PKGCONFIG@PKGDIR=$(LIBDIR)/pkgconfig 22 23PGMS=markdown 24SAMPLE_PGMS=mkd2html makepage 25@THEME@SAMPLE_PGMS+= theme 26MKDLIB=libmarkdown 27OBJS=mkdio.o markdown.o dumptree.o generate.o \ 28 resource.o docheader.o version.o toc.o css.o \ 29 xml.o Csio.o xmlpage.o basename.o emmatch.o \ 30 github_flavoured.o setup.o tags.o html5.o \ 31 @AMALLOC@ @H1TITLE@ flags.o 32TESTFRAMEWORK=echo cols branch pandoc_headers 33 34# modules that markdown, makepage, mkd2html, &tc use 35COMMON=pgm_options.o gethopt.o notspecial.o 36 37MAN3PAGES=mkd-callbacks.3 mkd-functions.3 markdown.3 mkd-line.3 38 39all: $(PGMS) $(SAMPLE_PGMS) $(TESTFRAMEWORK) 40 41install: $(PGMS) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) $(DESTDIR)$(PKGDIR) 42 $(INSTALL_PROGRAM) $(PGMS) $(DESTDIR)$(BINDIR) 43 ./librarian.sh install libmarkdown VERSION $(DESTDIR)$(LIBDIR) 44 $(INSTALL_DATA) mkdio.h $(DESTDIR)$(INCDIR) 45 @MK_PKGCONFIG@$(INSTALL_DATA) $(MKDLIB).pc $(DESTDIR)$(PKGDIR) 46 47install.everything: install install.samples install.man 48 49install.samples: $(SAMPLE_PGMS) install $(DESTDIR)$(BINDIR) 50 $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man1 51 for x in $(SAMPLE_PGMS); do \ 52 $(INSTALL_PROGRAM) $$x $(DESTDIR)$(BINDIR)/$(SAMPLE_PFX)$$x; \ 53 $(INSTALL_DATA) $$x.1 $(DESTDIR)$(MANDIR)/man1/$(SAMPLE_PFX)$$x.1; \ 54 done 55 56install.man: 57 $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man3 58 $(INSTALL_DATA) $(MAN3PAGES) $(DESTDIR)$(MANDIR)/man3 59 for x in mkd_line mkd_generateline; do \ 60 ln -sf mkd-line.3 $(DESTDIR)$(MANDIR)/man3/$$x.3; \ 61 done 62 for x in mkd_in mkd_string; do \ 63 ln -sf markdown.3 $(DESTDIR)$(MANDIR)/man3/$$x.3; \ 64 done 65 for x in mkd_compile mkd_css mkd_generatecss mkd_generatehtml mkd_cleanup mkd_doc_title mkd_doc_author mkd_doc_date; do \ 66 ln -sf mkd-functions.3 $(DESTDIR)$(MANDIR)/man3/$$x.3; \ 67 done 68 $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man7 69 $(INSTALL_DATA) markdown.7 mkd-extensions.7 $(DESTDIR)$(MANDIR)/man7 70 $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man1 71 $(INSTALL_DATA) markdown.1 $(DESTDIR)$(MANDIR)/man1 72 73install.everything: install install.man 74 75$(DESTDIR)$(BINDIR): 76 $(INSTALL_DIR) $(DESTDIR)$(BINDIR) 77 78$(DESTDIR)$(INCDIR): 79 $(INSTALL_DIR) $(DESTDIR)$(INCDIR) 80 81$(DESTDIR)$(LIBDIR): 82 $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) 83 84@MK_PKGCONFIG@$(DESTDIR)$(PKGDIR): 85@MK_PKGCONFIG@ $(INSTALL_DIR) $(DESTDIR)$(PKGDIR) 86 87version.o: version.c VERSION branch 88 $(BUILD) -DBRANCH=`./branch` -DVERSION=\"`cat VERSION`\" -c version.c 89 90VERSION: 91 @true 92 93tags.o: tags.c cstring.h tags.h blocktags 94 95blocktags: mktags 96 ./mktags > blocktags 97 98mktags: mktags.o 99 $(LINK) -o mktags mktags.o 100 101# example programs 102@THEME@theme: theme.o $(COMMON) $(MKDLIB) mkdio.h 103@THEME@ $(LINK) -o theme theme.o $(COMMON) -lmarkdown @LIBS@ 104 105 106mkd2html: mkd2html.o $(MKDLIB) mkdio.h gethopt.h $(COMMON) 107 $(LINK) -o mkd2html mkd2html.o $(COMMON) -lmarkdown @LIBS@ 108 109markdown: main.o $(COMMON) $(MKDLIB) 110 $(LINK) -o markdown main.o $(COMMON) -lmarkdown @LIBS@ 111 112makepage.o: makepage.c mkdio.h 113 $(BUILD) -c makepage.c 114makepage: makepage.o $(COMMON) $(MKDLIB) 115 $(LINK) -o makepage makepage.o $(COMMON) -lmarkdown @LIBS@ 116 117pgm_options.o: pgm_options.c mkdio.h config.h 118 $(BUILD) -c pgm_options.c 119 120notspecial.o: notspecial.c 121 $(BUILD) -c notspecial.c 122 123gethopt.o: gethopt.c 124 $(BUILD) -c gethopt.c 125 126main.o: main.c mkdio.h config.h 127 $(BUILD) -c main.c 128 129$(MKDLIB): $(OBJS) 130 ./librarian.sh make $(MKDLIB) VERSION $(OBJS) 131 ar crv $(MKDLIB).a $(OBJS) 132 133verify: echo tools/checkbits.sh 134 @./echo -n "headers ... "; tools/checkbits.sh && echo "GOOD" 135 136test: $(PGMS) $(TESTFRAMEWORK) verify 137 @for x in $${TESTS:-tests/*.t}; do \ 138 @LD_LIBRARY_PATH@=`pwd` sh $$x || exit 1; \ 139 done 140 141pandoc_headers.o: tools/pandoc_headers.c config.h 142 $(BUILD) -c -o pandoc_headers.o tools/pandoc_headers.c 143pandoc_headers: pandoc_headers.o 144 $(LINK) -o pandoc_headers pandoc_headers.o $(COMMON) -lmarkdown 145 146branch.o: tools/branch.c config.h 147 $(BUILD) -c -o branch.o tools/branch.c 148branch: branch.o 149 $(LINK) -o branch branch.o 150 151cols.o: tools/cols.c config.h 152 $(BUILD) -c -o cols.o tools/cols.c 153cols: cols.o 154 $(LINK) -o cols cols.o 155 156echo.o: tools/echo.c config.h 157 $(BUILD) -c -o echo.o tools/echo.c 158echo: echo.o 159 $(LINK) -o echo echo.o 160 161clean: 162 rm -f $(PGMS) $(TESTFRAMEWORK) $(SAMPLE_PGMS) *.o 163 rm -f $(MKDLIB) `./librarian.sh files $(MKDLIB) VERSION` 164 165distclean spotless: clean 166 @DISTCLEAN@ @GENERATED_FILES@ @CONFIGURE_FILES@ ./mktags ./blocktags 167 168Csio.o: Csio.c cstring.h amalloc.h config.h markdown.h 169amalloc.o: amalloc.c 170basename.o: basename.c config.h cstring.h amalloc.h markdown.h 171css.o: css.c config.h cstring.h amalloc.h markdown.h 172docheader.o: docheader.c config.h cstring.h amalloc.h markdown.h 173dumptree.o: dumptree.c markdown.h cstring.h amalloc.h config.h 174emmatch.o: emmatch.c config.h cstring.h amalloc.h markdown.h 175generate.o: generate.c config.h cstring.h amalloc.h markdown.h 176main.o: main.c config.h amalloc.h 177pgm_options.o: pgm_options.c pgm_options.h config.h amalloc.h 178makepage.o: makepage.c 179markdown.o: markdown.c config.h cstring.h amalloc.h markdown.h 180mkd2html.o: mkd2html.c config.h mkdio.h cstring.h amalloc.h 181mkdio.o: mkdio.c config.h cstring.h amalloc.h markdown.h 182resource.o: resource.c config.h cstring.h amalloc.h markdown.h 183theme.o: theme.c config.h mkdio.h cstring.h amalloc.h 184toc.o: toc.c config.h cstring.h amalloc.h markdown.h 185version.o: version.c config.h 186xml.o: xml.c config.h cstring.h amalloc.h markdown.h 187xmlpage.o: xmlpage.c config.h cstring.h amalloc.h markdown.h 188setup.o: setup.c config.h cstring.h amalloc.h markdown.h 189github_flavoured.o: github_flavoured.c config.h cstring.h amalloc.h markdown.h 190gethopt.o: gethopt.c gethopt.h 191h1title.o: h1title.c markdown.h 192notspecial.o: notspecial.c config.h 193