2015-05-15 19:01:48 +00:00
|
|
|
CFLAGS = -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter
|
2014-11-04 12:53:58 +00:00
|
|
|
PREFIX = /usr/local
|
2015-05-15 19:06:38 +00:00
|
|
|
BINDIR = $(PREFIX)/bin
|
|
|
|
LIBDIR = $(PREFIX)/lib
|
|
|
|
INCLUDEDIR = $(PREFIX)/include
|
2011-09-08 19:37:50 +00:00
|
|
|
|
2015-05-15 19:01:48 +00:00
|
|
|
HOEDOWN_CFLAGS = $(CFLAGS) -Isrc
|
2013-09-22 09:10:51 +00:00
|
|
|
ifneq ($(OS),Windows_NT)
|
2015-05-15 19:01:48 +00:00
|
|
|
HOEDOWN_CFLAGS += -fPIC
|
2013-09-22 09:10:51 +00:00
|
|
|
endif
|
|
|
|
|
2015-11-25 05:19:46 +00:00
|
|
|
SONAME = -soname
|
|
|
|
ifeq ($(shell uname -s),Darwin)
|
|
|
|
SONAME = -install_name
|
|
|
|
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 \
|
2014-02-06 18:40:41 +00:00
|
|
|
src/document.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 \
|
2014-02-06 19:38:21 +00:00
|
|
|
src/stack.o \
|
|
|
|
src/version.o
|
2011-09-08 19:37:50 +00:00
|
|
|
|
2014-01-23 03:30:46 +00:00
|
|
|
.PHONY: all test test-pl clean
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2015-05-15 18:58:49 +00:00
|
|
|
all: libhoedown.so libhoedown.a 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
|
|
|
|
2014-11-04 18:18:32 +00:00
|
|
|
libhoedown.so: libhoedown.so.3
|
2011-04-16 10:11:02 +00:00
|
|
|
ln -f -s $^ $@
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2014-11-04 18:18:32 +00:00
|
|
|
libhoedown.so.3: $(HOEDOWN_SRC)
|
2015-11-25 05:19:46 +00:00
|
|
|
$(CC) -Wl,$(SONAME),$(@F) -shared $^ $(LDFLAGS) -o $@
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2013-09-26 01:06:13 +00:00
|
|
|
libhoedown.a: $(HOEDOWN_SRC)
|
|
|
|
$(AR) rcs libhoedown.a $^
|
|
|
|
|
2013-09-22 09:10:51 +00:00
|
|
|
# Executables
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2014-03-23 19:17:02 +00:00
|
|
|
hoedown: bin/hoedown.o $(HOEDOWN_SRC)
|
2014-06-26 15:23:25 +00:00
|
|
|
$(CC) $^ $(LDFLAGS) -o $@
|
2011-05-05 14:47:37 +00:00
|
|
|
|
2014-03-23 19:17:02 +00:00
|
|
|
smartypants: bin/smartypants.o $(HOEDOWN_SRC)
|
2014-06-26 15:23:25 +00:00
|
|
|
$(CC) $^ $(LDFLAGS) -o $@
|
2011-04-15 08:36:46 +00:00
|
|
|
|
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
|
2014-09-09 09:45:24 +00:00
|
|
|
python test/runner.py
|
2014-01-23 03:30:46 +00:00
|
|
|
|
|
|
|
test-pl: 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:
|
2014-03-23 19:17:02 +00:00
|
|
|
$(RM) src/*.o bin/*.o
|
2013-09-26 01:06:13 +00:00
|
|
|
$(RM) libhoedown.so libhoedown.so.1 libhoedown.a
|
|
|
|
$(RM) hoedown smartypants hoedown.exe smartypants.exe
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2014-11-04 06:20:16 +00:00
|
|
|
# Installing
|
|
|
|
|
|
|
|
install:
|
2015-05-15 19:06:38 +00:00
|
|
|
install -m755 -d $(DESTDIR)$(LIBDIR)
|
|
|
|
install -m755 -d $(DESTDIR)$(BINDIR)
|
|
|
|
install -m755 -d $(DESTDIR)$(INCLUDEDIR)
|
2014-11-04 06:20:16 +00:00
|
|
|
|
2015-05-15 19:06:38 +00:00
|
|
|
install -m644 libhoedown.a $(DESTDIR)$(LIBDIR)
|
|
|
|
install -m755 libhoedown.so.3 $(DESTDIR)$(LIBDIR)
|
|
|
|
ln -f -s libhoedown.so.3 $(DESTDIR)$(LIBDIR)/libhoedown.so
|
2014-11-04 06:20:16 +00:00
|
|
|
|
2015-05-15 19:06:38 +00:00
|
|
|
install -m755 hoedown $(DESTDIR)$(BINDIR)
|
|
|
|
install -m755 smartypants $(DESTDIR)$(BINDIR)
|
|
|
|
|
|
|
|
install -m755 -d $(DESTDIR)$(INCLUDEDIR)/hoedown
|
|
|
|
install -m644 src/*.h $(DESTDIR)$(INCLUDEDIR)/hoedown
|
2014-11-04 06:20:16 +00:00
|
|
|
|
2013-09-22 09:10:51 +00:00
|
|
|
# Generic object compilations
|
2011-04-15 08:36:46 +00:00
|
|
|
|
2014-01-21 20:47:56 +00:00
|
|
|
%.o: %.c
|
2015-05-15 19:01:48 +00:00
|
|
|
$(CC) $(HOEDOWN_CFLAGS) -c -o $@ $<
|
2014-10-18 23:33:34 +00:00
|
|
|
|
|
|
|
src/html_blocks.o: src/html_blocks.c
|
2015-05-15 19:01:48 +00:00
|
|
|
$(CC) $(HOEDOWN_CFLAGS) -Wno-static-in-inline -c -o $@ $<
|