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# Optional feature defines, see: http://duktape.org/guide.html#compiling 26DEFINES += -DDUK_OPT_SELF_TESTS 27#DEFINES += -DDUK_OPT_DEBUG 28#DEFINES += -DDUK_OPT_DPRINT 29#DEFINES += -DDUK_OPT_NO_TRACEBACKS 30# ... 31 32# For debugging, use -O0 -g -ggdb, and don't add -fomit-frame-pointer 33 34hello: $(DUKTAPE_SOURCES) examples/hello/hello.c 35 $(CC) -o $@ $(DEFINES) $(CCOPTS) $(DUKTAPE_SOURCES) examples/hello/hello.c $(CCLIBS) 36