# # Example Makefile for building a program with embedded Duktape. # The example program here is the Duktape command line tool. # # Duktape sources - include these in your project and supply your own main() DUKTAPE_SOURCES = \ src/duk_util_hashbytes.c \ src/duk_util_hashprime.c \ src/duk_util_bitdecoder.c \ src/duk_util_bitencoder.c \ src/duk_util_tinyrandom.c \ src/duk_util_misc.c \ src/duk_alloc_default.c \ src/duk_debug_macros.c \ src/duk_debug_vsnprintf.c \ src/duk_debug_heap.c \ src/duk_debug_hobject.c \ src/duk_debug_fixedbuffer.c \ src/duk_error_macros.c \ src/duk_error_longjmp.c \ src/duk_error_throw.c \ src/duk_error_fatal.c \ src/duk_error_augment.c \ src/duk_error_misc.c \ src/duk_heap_misc.c \ src/duk_heap_memory.c \ src/duk_heap_alloc.c \ src/duk_heap_refcount.c \ src/duk_heap_markandsweep.c \ src/duk_heap_hashstring.c \ src/duk_heap_stringtable.c \ src/duk_heap_stringcache.c \ src/duk_hthread_misc.c \ src/duk_hthread_alloc.c \ src/duk_hthread_builtins.c \ src/duk_hthread_stacks.c \ src/duk_hobject_alloc.c \ src/duk_hobject_class.c \ src/duk_hobject_enum.c \ src/duk_hobject_props.c \ src/duk_hobject_finalizer.c \ src/duk_hobject_pc2line.c \ src/duk_hobject_misc.c \ src/duk_hbuffer_alloc.c \ src/duk_hbuffer_ops.c \ src/duk_unicode_tables.c \ src/duk_unicode_support.c \ src/duk_strings.c \ src/duk_builtins.c \ src/duk_js_ops.c \ src/duk_js_var.c \ src/duk_numconv.c \ src/duk_api_call.c \ src/duk_api_compile.c \ src/duk_api_codec.c \ src/duk_api_memory.c \ src/duk_api_string.c \ src/duk_api_object.c \ src/duk_api_thread.c \ src/duk_api_buffer.c \ src/duk_api_var.c \ src/duk_api.c \ src/duk_lexer.c \ src/duk_js_call.c \ src/duk_js_executor.c \ src/duk_js_compiler.c \ src/duk_regexp_compiler.c \ src/duk_regexp_executor.c \ src/duk_builtin_duk.c \ src/duk_builtin_thread.c \ src/duk_builtin_thrower.c \ src/duk_builtin_array.c \ src/duk_builtin_boolean.c \ src/duk_builtin_date.c \ src/duk_builtin_error.c \ src/duk_builtin_function.c \ src/duk_builtin_global.c \ src/duk_builtin_json.c \ src/duk_builtin_math.c \ src/duk_builtin_number.c \ src/duk_builtin_object.c \ src/duk_builtin_regexp.c \ src/duk_builtin_string.c # Duktape command line tool - example of a main() program DUKTAPE_CMDLINE_SOURCES = \ examples/cmdline/duk_cmdline.c \ examples/cmdline/duk_ncurses.c \ examples/cmdline/duk_socket.c \ examples/cmdline/duk_fileio.c # Compiler options are quite flexible. Some platform specific defines may be # necessary to interface with platform specific functionality (like time # handling). GCC versions have a significant impact on the size of -Os code, # e.g. gcc-4.6 is much worse than gcc-4.5. CC = gcc CCOPTS = -Os -pedantic -ansi -std=c99 -Wall -fstrict-aliasing -fomit-frame-pointer CCOPTS += -I./src CCOPTS += -D_POSIX_C_SOURCE=200809L CCOPTS += -D_GNU_SOURCE # e.g. getdate_r CCOPTS += -D_XOPEN_SOURCE # e.g. strptime CCOPTS += -m32 # force 32-bit compilation on a 64-bit host CCLIBS = -lm DEFINES = -DDUK_PROFILE=100 # if omitted, profile defaults to 100 # For debugging, use -O0 -g -ggdb, and don't add -fomit-frame-pointer # These are only needed by the example modules (duk_socket, duk_curses.c), # and are not needed for embedding Duktape into your own project. CCOPTS += -I/usr/include/ncursesw CCLIBS += -lreadline -lncursesw # Example target for one profile (using duk_cmdline.c as the "main" program) duk: $(DUKTAPE_SOURCES) $(DUKTAPE_CMDLINE_SOURCES) $(CC) -o $@ $(DEFINES) $(CCOPTS) $(DUKTAPE_SOURCES) $(DUKTAPE_CMDLINE_SOURCES) $(CCLIBS)