diff options
Diffstat (limited to 'etc')
-rw-r--r-- | etc/Makefile | 21 | ||||
-rw-r--r-- | etc/README | 9 | ||||
-rw-r--r-- | etc/lua.pc | 18 |
3 files changed, 31 insertions, 17 deletions
diff --git a/etc/Makefile b/etc/Makefile index 2dfc937c..02f09423 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -8,14 +8,15 @@ SRC= $(TOP)/src TST= $(TOP)/test CC= gcc -CFLAGS= -O2 -Wall $(MYCFLAGS) -MYCFLAGS= -ansi -I$(INC) +CFLAGS= -O2 -Wall -I$(INC) $(MYCFLAGS) +MYCFLAGS= MYLDFLAGS= -Wl,-E -MYLIBS= -lm -ldl +MYLIBS= -lm +#MYLIBS= -lm -Wl,-E -ldl -lreadline -lhistory -lncurses RM= rm -f -all: - @echo 'choose a target: min noparser one clean' +default: + @echo 'Please choose a target: min noparser one clean' min: min.c $(CC) $(CFLAGS) $@.c -L$(LIB) -llua $(MYLIBS) @@ -31,5 +32,13 @@ one: $(CC) $(CFLAGS) all.c $(MYLIBS) ./a.out $(TST)/hello.lua +strict: + -$(BIN)/lua -e 'print(a);b=2' + -$(BIN)/lua -lstrict -e 'print(a)' + -$(BIN)/lua -e 'function f() b=2 end f()' + -$(BIN)/lua -lstrict -e 'function f() b=2 end f()' + clean: - $(RM) noparser.o a.out core core.* *.o luac.out + $(RM) a.out core core.* *.o luac.out + +.PHONY: default min noparser one strict clean @@ -1,9 +1,12 @@ This directory contains some useful files and code. Unlike the code in ../src, everything here is in the public domain. +If any of the makes fail, you're probably not using the same libraries +used to build Lua. Set MYLIBS in Makefile accordingly. + all.c Full Lua interpreter in a single file. - Do "make one". + Do "make one" for a demo. lua.hpp Lua header files for C++ using 'extern "C"'. @@ -21,11 +24,13 @@ luavs.bat min.c A minimal Lua interpreter. Good for learning and for starting your own. + Do "make min" for a demo. noparser.c Linking with noparser.o avoids loading the parsing modules in lualib.a. - Do "make noparser" to see a demo. + Do "make noparser" for a demo. strict.lua Traps uses of undeclared global variables. + Do "make strict" for a demo. @@ -1,19 +1,19 @@ # lua.pc -- pkg-config data for Lua # vars from install Makefile -# grep '^INSTALL_.*=' ../Makefile -INSTALL_TOP= /usr/local -INSTALL_BIN= $(INSTALL_TOP)/bin -INSTALL_INC= $(INSTALL_TOP)/include -INSTALL_LIB= $(INSTALL_TOP)/lib -INSTALL_MAN= $(INSTALL_TOP)/man/man1 -INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V -INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V # grep '^V=' ../Makefile V= 5.1 -prefix=${INSTALL_TOP} +# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' +prefix= /usr/local +INSTALL_BIN= ${prefix}/bin +INSTALL_INC= ${prefix}/include +INSTALL_LIB= ${prefix}/lib +INSTALL_MAN= ${prefix}/man/man1 +INSTALL_LMOD= ${prefix}/share/lua/${V} +INSTALL_CMOD= ${prefix}/lib/lua/${V} + exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include |