Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2766e36265
Fetching contributors…

Cannot retrieve contributors at this time

89 lines (71 sloc) 2.159 kb
ERLANG_PATH:=$(shell erl -eval 'io:format("~s~n", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version), "/include"])])' -s init stop -noshell)
CFLAGS_DISCOUNT=-g -fPIC -O3
CFLAGS=$(CFLAGS_DISCOUNT) -Idiscount_src
ERLANG_FLAGS=-I$(ERLANG_PATH)
CC?=clang
CXX?=clang++
EBIN_DIR=ebin
ifeq ($(shell uname),Darwin)
OPTIONS=-dynamiclib -undefined dynamic_lookup
endif
NIF_SRC=\
src/markdown_nif.c
DISCOUNT_OBJS=\
discount_src/mkdio.o \
discount_src/markdown.o \
discount_src/dumptree.o \
discount_src/generate.o \
discount_src/resource.o \
discount_src/docheader.o \
discount_src/version.o \
discount_src/toc.o \
discount_src/css.o \
discount_src/xml.o \
discount_src/Csio.o \
discount_src/xmlpage.o \
discount_src/basename.o \
discount_src/emmatch.o \
discount_src/github_flavoured.o \
discount_src/setup.o \
discount_src/tags.o \
discount_src/html5.o \
discount_src/flags.o
DISCOUNT_LIB=discount_src/libmarkdown.a
all: discount_ex
priv/markdown.so: ${DISCOUNT_LIB} ${NIF_SRC}
mkdir -p priv && \
$(CC) $(CFLAGS) $(ERLANG_FLAGS) -shared $(OPTIONS) \
$(DISCOUNT_OBJS) \
$(NIF_SRC) \
-o $@ 2>&1 >/dev/null
discount_ex:
mix deps.get
mix compile
cbin/markdown: discount_src/libmarkdown.a
mkdir -p cbin && cp discount_src/markdown cbin/
$(DISCOUNT_LIB): discount_src/configure.sh
cd discount_src && \
CFLAGS="$(CFLAGS_DISCOUNT)" ./configure.sh \
--with-dl=Both \
--with-id-anchor \
--with-github-tags \
--with-fenced-code \
--enable-all-features && \
CFLAGS="$(CFLAGS_DISCOUNT)" $(MAKE)
discount_src/configure.sh:
git submodule update --init
discount_src-clean:
test ! -f $(DISCOUNT_LIB) || \
(cd discount_src && $(MAKE) clean)
discount_src-distclean:
test ! -f discount_src/Makefile || \
(cd discount_src && \
$(MAKE) distclean && \
git clean -d -f -x)
discount_ex-clean:
rm -rf $(EBIN_DIR) test/tmp cbin share/*
discount_nif-clean:
rm -rf priv/markdown.*
clean: discount_src-clean discount_ex-clean discount_nif-clean
distclean: discount_src-distclean discount_ex-clean discount_nif-clean
.PHONY: all discount_ex clean distclean discount_src-clean discount_src-distclean
Jump to Line
Something went wrong with that request. Please try again.