Makefile.in 5.33 KB
Newer Older
1 2
CC=@CC@ -I.
LFLAGS=-L.
3 4 5 6 7 8 9 10
CFLAGS=@CFLAGS@
AR=@AR@
RANLIB=@RANLIB@

BINDIR=@exedir@
MANDIR=@mandir@
LIBDIR=@libdir@
INCDIR=@prefix@/include
11
@MK_PKGCONFIG@PKGDIR=$(LIBDIR)/pkgconfig
12 13 14 15 16 17 18 19

PGMS=markdown
SAMPLE_PGMS=mkd2html makepage
@THEME@SAMPLE_PGMS+= theme
MKDLIB=libmarkdown
OBJS=mkdio.o markdown.o dumptree.o generate.o \
     resource.o docheader.o version.o toc.o css.o \
     xml.o Csio.o xmlpage.o basename.o emmatch.o \
20 21 22 23 24 25
     github_flavoured.o setup.o tags.o html5.o flags.o \
     @AMALLOC@ @H1TITLE@
TESTFRAMEWORK=echo cols branch

# modules that markdown, makepage, mkd2html, &tc use
COMMON=pgm_options.o gethopt.o notspecial.o
26 27 28

MAN3PAGES=mkd-callbacks.3 mkd-functions.3 markdown.3 mkd-line.3

29
all: $(PGMS) $(SAMPLE_PGMS) $(TESTFRAMEWORK)
30

31
install: $(PGMS) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) $(DESTDIR)$(PKGDIR)
32 33 34
	@INSTALL_PROGRAM@ $(PGMS) $(DESTDIR)$(BINDIR)
	./librarian.sh install libmarkdown VERSION $(DESTDIR)$(LIBDIR)
	@INSTALL_DATA@ mkdio.h $(DESTDIR)$(INCDIR)
35
	@MK_PKGCONFIG@@INSTALL_DATA@ $(MKDLIB).pc $(DESTDIR)$(PKGDIR)
36 37 38

install.everything: install install.samples install.man

39 40
install.samples: $(SAMPLE_PGMS) install $(DESTDIR)$(BINDIR)
	@INSTALL_DIR@ $(DESTDIR)$(MANDIR)/man1
41 42 43 44
	for x in $(SAMPLE_PGMS); do \
	    @INSTALL_PROGRAM@ $$x $(DESTDIR)$(BINDIR)/$(SAMPLE_PFX)$$x; \
	    @INSTALL_DATA@ $$x.1 $(DESTDIR)$(MANDIR)/man1/$(SAMPLE_PFX)$$x.1; \
	done
45 46

install.man:
47 48
	@INSTALL_DIR@ $(DESTDIR)$(MANDIR)/man3
	@INSTALL_DATA@ $(MAN3PAGES) $(DESTDIR)$(MANDIR)/man3
49
	for x in mkd_line mkd_generateline; do \
50
	    ( echo '.\"' ; echo ".so man3/mkd-line.3" ) > $(DESTDIR)$(MANDIR)/man3/$$x.3;\
51 52
	done
	for x in mkd_in mkd_string; do \
53
	    ( echo '.\"' ; echo ".so man3/markdown.3" ) > $(DESTDIR)$(MANDIR)/man3/$$x.3;\
54 55
	done
	for x in mkd_compile mkd_css mkd_generatecss mkd_generatehtml mkd_cleanup mkd_doc_title mkd_doc_author mkd_doc_date; do \
56
	    ( echo '.\"' ; echo ".so man3/mkd-functions.3" ) > $(DESTDIR)$(MANDIR)/man3/$$x.3; \
57
	done
58 59 60 61
	@INSTALL_DIR@ $(DESTDIR)$(MANDIR)/man7
	@INSTALL_DATA@ markdown.7 mkd-extensions.7 $(DESTDIR)$(MANDIR)/man7
	@INSTALL_DIR@ $(DESTDIR)$(MANDIR)/man1
	@INSTALL_DATA@ markdown.1 $(DESTDIR)$(MANDIR)/man1
62 63 64

install.everything: install install.man

65 66
$(DESTDIR)$(BINDIR):
	@INSTALL_DIR@ $(DESTDIR)$(BINDIR)
67

68 69
$(DESTDIR)$(INCDIR):
	@INSTALL_DIR@ $(DESTDIR)$(INCDIR)
70

71 72
$(DESTDIR)$(LIBDIR):
	@INSTALL_DIR@ $(DESTDIR)$(LIBDIR)
73

74 75
@MK_PKGCONFIG@$(DESTDIR)$(PKGDIR):
@MK_PKGCONFIG@	@INSTALL_DIR@ $(DESTDIR)$(PKGDIR)
76

77 78
version.o: version.c VERSION branch
	$(CC) $(CFLAGS) -DBRANCH=`./branch` -DVERSION=\"`cat VERSION`\" -c version.c
79

80 81 82
VERSION:
	@true

83
tags.o: tags.c cstring.h tags.h blocktags
84 85 86 87

blocktags: mktags
	./mktags > blocktags

88
# example programs
89 90
@THEME@theme:  theme.o $(COMMON) $(MKDLIB) mkdio.h
@THEME@	$(CC) $(CFLAGS) $(LFLAGS) -o theme theme.o $(COMMON) -lmarkdown @LIBS@
91 92


93 94
mkd2html:  mkd2html.o $(MKDLIB) mkdio.h gethopt.h $(COMMON)
	$(CC) $(CFLAGS) $(LFLAGS) -o mkd2html mkd2html.o $(COMMON) -lmarkdown @LIBS@
95

96 97
markdown: main.o $(COMMON) $(MKDLIB)
	$(CC) $(CFLAGS) $(LFLAGS) -o markdown main.o $(COMMON) -lmarkdown @LIBS@
98
	
99 100
makepage:  makepage.c $(COMMON) $(MKDLIB) mkdio.h
	$(CC) $(CFLAGS) $(LFLAGS) -o makepage makepage.c $(COMMON) -lmarkdown @LIBS@
101 102

pgm_options.o: pgm_options.c mkdio.h config.h
103
	$(CC) $(CFLAGS) -I. -c pgm_options.c
104

105 106 107 108 109 110
notspecial.o: notspecial.c
	$(CC) $(CFLAGS) -I. -c notspecial.c

gethopt.o: gethopt.c
	$(CC) $(CFLAGS) -I. -c gethopt.c

111
main.o: main.c mkdio.h config.h
112
	$(CC) $(CFLAGS) -I. -c main.c
113 114 115 116 117 118 119

$(MKDLIB): $(OBJS)
	./librarian.sh make $(MKDLIB) VERSION $(OBJS)

verify: echo tools/checkbits.sh
	@./echo -n "headers ... "; tools/checkbits.sh && echo "GOOD"

120
test:	$(PGMS) $(TESTFRAMEWORK) verify
121 122 123 124
	@for x in tests/*.t; do \
	    @LD_LIBRARY_PATH@=`pwd` sh $$x || exit 1; \
	done

125 126
branch: tools/branch.c config.h
	$(CC) -o branch tools/branch.c
127 128 129 130 131 132
cols:   tools/cols.c config.h
	$(CC) -o cols tools/cols.c
echo:   tools/echo.c config.h
	$(CC) -o echo tools/echo.c
	
clean:
133
	rm -f $(PGMS) $(TESTFRAMEWORK) $(SAMPLE_PGMS) *.o
134 135 136
	rm -f $(MKDLIB) `./librarian.sh files $(MKDLIB) VERSION`

distclean spotless: clean
137
	@DISTCLEAN@ @GENERATED_FILES@ @CONFIGURE_FILES@ ./mktags ./blocktags
138 139 140 141 142 143 144 145 146 147

Csio.o: Csio.c cstring.h amalloc.h config.h markdown.h
amalloc.o: amalloc.c
basename.o: basename.c config.h cstring.h amalloc.h markdown.h
css.o: css.c config.h cstring.h amalloc.h markdown.h
docheader.o: docheader.c config.h cstring.h amalloc.h markdown.h
dumptree.o: dumptree.c markdown.h cstring.h amalloc.h config.h
emmatch.o: emmatch.c config.h cstring.h amalloc.h markdown.h
generate.o: generate.c config.h cstring.h amalloc.h markdown.h
main.o: main.c config.h amalloc.h
148
pgm_options.o: pgm_options.c pgm_options.h config.h amalloc.h
149 150 151 152 153 154 155 156 157 158
makepage.o: makepage.c
markdown.o: markdown.c config.h cstring.h amalloc.h markdown.h
mkd2html.o: mkd2html.c config.h mkdio.h cstring.h amalloc.h
mkdio.o: mkdio.c config.h cstring.h amalloc.h markdown.h
resource.o: resource.c config.h cstring.h amalloc.h markdown.h
theme.o: theme.c config.h mkdio.h cstring.h amalloc.h
toc.o: toc.c config.h cstring.h amalloc.h markdown.h
version.o: version.c config.h
xml.o: xml.c config.h cstring.h amalloc.h markdown.h
xmlpage.o: xmlpage.c config.h cstring.h amalloc.h markdown.h
159 160
setup.o: setup.c config.h cstring.h amalloc.h markdown.h
github_flavoured.o: github_flavoured.c config.h cstring.h amalloc.h markdown.h
161 162 163
gethopt.o: gethopt.c gethopt.h
h1title.o: h1title.c markdown.h
notspecial.o: notspecial.c config.h