1#
2#  Example Makefile for building a program with embedded Duktape.
3#
4#  There are two source sets in the distribution: (1) combined sources where
5#  you only need duktape.c, duktape.h, and duk_config.h, and (2) separate
6#  sources where you have a bunch of source and header files.  Whichever
7#  you use, simply include the relevant sources into your C project.  This
8#  Makefile uses the combined source file.
9#
10
11DUKTAPE_SOURCES = src/duktape.c
12
13# Compiler options are quite flexible.  GCC versions have a significant impact
14# on the size of -Os code, e.g. gcc-4.6 is much worse than gcc-4.5.
15
16CC = gcc
17CCOPTS = -Os -pedantic -std=c99 -Wall -fstrict-aliasing -fomit-frame-pointer
18CCOPTS += -I./src  # for combined sources
19CCLIBS = -lm
20DEFINES =
21
22# If you want a 32-bit build on a 64-bit host
23#CCOPTS += -m32
24
25# Use the tools/configure.py utility to modify Duktape default configuration:
26# http://duktape.org/guide.html#compiling
27# http://wiki.duktape.org/Configuring.html
28
29# For debugging, use -O0 -g -ggdb, and don't add -fomit-frame-pointer
30
31hello: $(DUKTAPE_SOURCES) examples/hello/hello.c
32	$(CC) -o $@ $(DEFINES) $(CCOPTS) $(DUKTAPE_SOURCES) examples/hello/hello.c $(CCLIBS)
33