# makefile to compile a lua-based application into a standalone executable. all: # # Byte-code-compile all required lua files (in the correct order) into generated.luac luac -o generated.luac ../mnoo_current/mnoo.lua ../mnoo_current/args_cl.lua ../mnoo_current/mnoofltk.lua ../mnoo_fltk_test.lua # # Generate a C header file. # # #include"generated.h" on a lua interpreter L does the equivalent of calling lua's dofile() on all the source files # # in the given order. # # generated.h is included from demo.c bin2c generated.luac > generated.h ifeq ($(OSTYPE),msys) # Windows build gcc ${CFLAGS} -o demo.exe -static demo.c -llua -llualib ../lib/libmnoofltk_msys.a -lm `fltk-config --ldstaticflags` strip demo.exe cp demo.exe bin/ gcc ${CFLAGS} -o demo_console.exe -static demo.c -llua -llualib ../lib/libmnoofltk_msys.a -lm `fltk-config --ldstaticflags` -mconsole strip demo_console.exe cp demo_console.exe bin/ else # Linux build # # Note: the dependency on -ldl comes, because my lua is compiled with loadlib() support. # # Recompiling lua would allow to remove that dependency. gcc ${CFLAGS} -o demo -static demo.c -llua -llualib ../lib/libmnoofltk_linux.a -lm -ldl `fltk-config --ldstaticflags` -lpthread strip demo cp demo bin/ endif clean: rm -f generated.luac, generated.h, demo