2013-09-24 00:35:54 +00:00
|
|
|
CFLAGS = -c -g -O3 -Wall -Wextra -Wno-unused-parameter -Isrc
|
2011-09-08 19:37:50 +00:00
|
|
|
|
2013-09-22 09:10:51 +00:00
|
|
|
ifneq ($(OS),Windows_NT)
|
|
|
|
CFLAGS += -fPIC
|
|
|
|
endif
|
|
|
|
|
2013-09-20 06:09:52 +00:00
|
|
|
HOEDOWN_SRC=\
|
2011-09-08 19:37:50 +00:00
|
|
|
src/autolink.o \
|
2013-09-20 15:08:29 +00:00
|
|
|
src/buffer.o \
|
2013-09-20 06:09:52 +00:00
|
|
|
src/escape.o \
|
|
|
|
src/html.o \
|
2013-09-21 02:57:08 +00:00
|
|
|
src/html_blocks.o \
|
2013-09-20 06:09:52 +00:00
|
|
|
src/html_smartypants.o \
|
2013-09-20 15:08:29 +00:00
|
|
|
src/markdown.o \
|
|
|
|
src/stack.o
|
2011-09-08 19:37:50 +00:00
|
|
|
|
2013-09-21 09:57:13 +00:00
|
|
|
.PHONY: all test clean
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2013-09-21 09:57:13 +00:00
|
|
|
all: libhoedown.so hoedown smartypants
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2013-09-22 09:10:51 +00:00
|
|
|
# Libraries
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2013-09-21 09:57:13 +00:00
|
|
|
libhoedown.so: libhoedown.so.1
|
2011-04-16 10:11:02 +00:00
|
|
|
ln -f -s $^ $@
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2013-09-20 06:09:52 +00:00
|
|
|
libhoedown.so.1: $(HOEDOWN_SRC)
|
2012-09-23 06:23:05 +00:00
|
|
|
$(CC) $(LDFLAGS) -shared $^ -o $@
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2013-09-22 09:10:51 +00:00
|
|
|
# Executables
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2013-09-21 09:57:13 +00:00
|
|
|
hoedown: examples/hoedown.o $(HOEDOWN_SRC)
|
2011-05-05 14:47:37 +00:00
|
|
|
$(CC) $(LDFLAGS) $^ -o $@
|
|
|
|
|
2013-09-20 06:09:52 +00:00
|
|
|
smartypants: examples/smartypants.o $(HOEDOWN_SRC)
|
2011-04-15 08:36:46 +00:00
|
|
|
$(CC) $(LDFLAGS) $^ -o $@
|
|
|
|
|
2013-09-22 09:10:51 +00:00
|
|
|
# Perfect hashing
|
2011-08-30 15:46:06 +00:00
|
|
|
|
2013-09-21 02:57:08 +00:00
|
|
|
src/html_blocks.c: html_block_names.gperf
|
|
|
|
gperf -L ANSI-C -N hoedown_find_block_tag -c -C -E -S 1 --ignore-case -m100 $^ > $@
|
2011-08-30 15:46:06 +00:00
|
|
|
|
2013-09-22 09:10:51 +00:00
|
|
|
# Testing
|
2013-09-21 09:57:13 +00:00
|
|
|
|
2013-09-20 06:09:52 +00:00
|
|
|
test: hoedown
|
2013-09-18 21:36:04 +00:00
|
|
|
perl test/MarkdownTest_1.0.3/MarkdownTest.pl \
|
2013-09-20 06:09:52 +00:00
|
|
|
--script=./hoedown --testdir=test/MarkdownTest_1.0.3/Tests --tidy
|
2011-08-30 15:46:06 +00:00
|
|
|
|
2013-09-22 09:10:51 +00:00
|
|
|
# Housekeeping
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2013-09-21 09:57:13 +00:00
|
|
|
clean:
|
2013-09-26 00:48:59 +00:00
|
|
|
$(RM) src/*.o examples/*.o
|
|
|
|
$(RM) libhoedown.so libhoedown.so.1 hoedown smartypants
|
|
|
|
$(RM) hoedown.exe smartypants.exe
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2013-09-22 09:10:51 +00:00
|
|
|
# Generic object compilations
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2013-09-21 09:57:13 +00:00
|
|
|
%.o: src/%.c examples/%.c
|
2011-04-15 08:36:46 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ $<
|