-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
70 lines (57 loc) · 2.65 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
EMSCRIPTEN_ROOT=$(shell python find_emscripten.py)
EMCONFIGURE=$(EMSCRIPTEN_ROOT)/emconfigure
EMCC=$(EMSCRIPTEN_ROOT)/emcc
SRCDIR=graphviz-src
INSTALLDIR=graphviz-install
INSTALLED_LIBS=$(addprefix $(INSTALLDIR)/lib/,libgvc.a libgraph.a libcdt.a)
# EXTRA_LIBS=$(addprefix $(SRCDIR)/lib/, \
# common/.libs/libcommon_C.a pathplan/.libs/libpathplan_C.a \
# )
PLUGINS=$(addprefix $(INSTALLDIR)/lib/graphviz/,libgvplugin_core.a libgvplugin_dot_layout.a libgvplugin_neato_layout.a)
INCLUDEDIR=$(INSTALLDIR)/include/graphviz
.PHONY: all clean cleanjs
all: graphviz.min.js
# Working in Node but not in browser
graphviz.opt.js: graphviz-js-wrapper.c | $(INSTALLDIR)/lib
EMCC_DEBUG=1 $(EMCC) -o $@ $< $(PLUGINS) $(INSTALLED_LIBS) -I$(INCLUDEDIR) \
-O2 -s EXPORTED_FUNCTIONS="['_graphvizjs']"
graphviz.min.js: graphviz.js
jsmin < $< > $@
# Note that the order here is extremely important!
# Plugins must be linked before the libraries, otherwise dead code stripping will kill things
graphviz.js: graphviz-js-wrapper.c | $(INSTALLDIR)/lib
EMCC_DEBUG=1 $(EMCC) -o $@ $< $(PLUGINS) $(INSTALLED_LIBS) -I$(INCLUDEDIR) -O1 --llvm-opts 3
$(INSTALLDIR)/lib: | $(SRCDIR)/Makefile $(INSTALLDIR)
cd $(SRCDIR) && make -i && $(CC) lib/gvpr/mkdefs.c -o lib/gvpr/mkdefs && make
cd $(SRCDIR)/lib && make install
cd $(SRCDIR)/plugin && make install
# Need pipe | here to just look for presence, not how new directories are
$(SRCDIR)/Makefile: | $(SRCDIR) $(INSTALLDIR)
cd $(SRCDIR) && CPATH=$(CURDIR)/sysinclude:${CPATH} $(EMCONFIGURE) ./configure \
--enable-swig=no --enable-sharp=no --enable-go=no \
--enable-io=no --enable-java=no --enable-lua=no \
--enable-ocaml=no --enable-perl=no --enable-php=no \
--enable-python=no --enable-r=no --enable-ruby=no \
--enable-tcl=no \
--without-tcl --without-x --without-expat --without-devil --without-Xpm \
--without-Xaw --without-z --without-rsvg --without-ghostscript \
--without-visio --without-pangocairo --without-lasi \
--without-glitz --without-freetype2 --without-fontconfig \
--without-gdk-pixbuf --without-gtk --without-gtkgl --without-gtkglext \
--without-glade --without-ming --without-qt --without-quartz \
--without-gdiplus --without-libgd --without-glut --without-iconv \
--without-png --without-jpeg \
--enable-static --enable-shared=no \
--prefix=$(CURDIR)/$(INSTALLDIR)
$(INSTALLDIR):
mkdir -p $(INSTALLDIR)
$(SRCDIR): | graphviz-src.tar.gz
mkdir -p $(SRCDIR)
tar xjf graphviz-src.tar.gz -C $(SRCDIR) --strip=1
graphviz-src.tar.gz:
curl "http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.28.0.tar.gz" -o graphviz-src.tar.gz
clean: cleanjs
rm -rf $(SRCDIR)
rm -rf $(INSTALLDIR)
cleanjs:
rm -f graphviz*.js