1#
2#  Example Makefile for building a program with embedded Duktape.
3#  The example program here is the Duktape command line tool.
4#
5
6DUKTAPE_SOURCES = src/duktape.c
7
8DUKTAPE_CMDLINE_SOURCES = \
9	examples/cmdline/duk_cmdline.c
10
11CC	= gcc
12CCOPTS	= -Os -pedantic -std=c99 -Wall -fstrict-aliasing -fomit-frame-pointer
13CCOPTS += -I./src   # duktape.h and duk_config.h must be in include path
14CCLIBS	= -lm
15
16# If you want linenoise, you can enable these.  At the moment linenoise
17# will cause some harmless compilation warnings.
18#CCOPTS += -DDUK_CMDLINE_FANCY
19#DUKTAPE_CMDLINE_SOURCES += linenoise/linenoise.c
20#CCOPTS += -I./linenoise
21#duk:	linenoise
22
23# Optional feature defines, see: http://duktape.org/guide.html#compiling
24CCOPTS += -DDUK_OPT_SELF_TESTS
25#CCOPTS += -DDUK_OPT_DEBUG
26#CCOPTS += -DDUK_OPT_DPRINT
27# ...
28
29duk:	$(DUKTAPE_SOURCES) $(DUKTAPE_CMDLINE_SOURCES)
30	$(CC) -o $@ $(DEFINES) $(CCOPTS) $(DUKTAPE_SOURCES) $(DUKTAPE_CMDLINE_SOURCES) $(CCLIBS)
31
32linenoise/linenoise.c: linenoise
33linenoise:
34	git clone https://github.com/antirez/linenoise.git
35