Skip to content
This repository
tag: v0.1.0
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 103 lines (83 sloc) 3.094 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
LUADIR=deps/luajit
UVDIR=deps/uv
HTTPDIR=deps/http-parser
BUILDDIR=build
GENDIR=${BUILDDIR}/generated

LUALIBS=${GENDIR}/luvit.o \
        ${GENDIR}/http.o \
        ${GENDIR}/url.o \
        ${GENDIR}/request.o \
        ${GENDIR}/response.o \
        ${GENDIR}/fs.o \
        ${GENDIR}/process.o \
        ${GENDIR}/emitter.o \
        ${GENDIR}/udp.o \
        ${GENDIR}/stream.o \
        ${GENDIR}/tcp.o \
        ${GENDIR}/pipe.o \
        ${GENDIR}/tty.o \
        ${GENDIR}/timer.o \
        ${GENDIR}/repl.o \
        ${GENDIR}/fiber.o \
        ${GENDIR}/mime.o \
        ${GENDIR}/path.o \
        ${GENDIR}/stack.o \
        ${GENDIR}/utils.o

LUVLIBS=${BUILDDIR}/utils.o \
        ${BUILDDIR}/luv_fs.o \
        ${BUILDDIR}/luv_handle.o \
        ${BUILDDIR}/luv_udp.o \
        ${BUILDDIR}/luv_fs_watcher.o \
        ${BUILDDIR}/luv_timer.o \
        ${BUILDDIR}/luv_process.o \
        ${BUILDDIR}/luv_stream.o \
        ${BUILDDIR}/luv_tcp.o \
        ${BUILDDIR}/luv_pipe.o \
        ${BUILDDIR}/luv_tty.o \
        ${BUILDDIR}/luv_misc.o \
        ${BUILDDIR}/lconstants.o \
        ${BUILDDIR}/lenv.o \
        ${BUILDDIR}/lhttp_parser.o

ALLLIBS=${BUILDDIR}/luvit.o \
        ${LUVLIBS} \
        ${BUILDDIR}/luv.o \
        ${LUADIR}/src/libluajit.a \
        ${UVDIR}/uv.a \
        ${HTTPDIR}/http_parser.o \
        ${LUALIBS}

all: ${BUILDDIR}/luvit

deps: ${LUADIR}/src/libluajit.a ${UVDIR}/uv.a ${HTTPDIR}/http_parser.o

${GENDIR}:
mkdir -p ${GENDIR}

${LUADIR}/src/libluajit.a:
git submodule update --init ${LUADIR}
sed -e "s/#XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT/XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT/" -i deps/luajit/src/Makefile
sed -e "s/#XCFLAGS+= -DLUA_USE_APICHECK/XCFLAGS+= -DLUA_USE_APICHECK/" -i deps/luajit/src/Makefile
$(MAKE) -C ${LUADIR}

${UVDIR}/uv.a:
git submodule update --init ${UVDIR}
$(MAKE) -C ${UVDIR} uv.a

${HTTPDIR}/http_parser.o:
git submodule update --init ${HTTPDIR}
make -C ${HTTPDIR} http_parser.o

${GENDIR}/%.c: lib/%.lua deps
${LUADIR}/src/luajit -b $< $@

${GENDIR}/%.o: ${GENDIR}/%.c
$(CC) -Wall -c $< -o $@

${BUILDDIR}/%.o: src/%.c src/%.h deps
mkdir -p ${BUILDDIR}
$(CC) -Wall -Werror -c $< -o $@ -I${HTTPDIR} -I${UVDIR}/include -I${LUADIR}/src -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

${BUILDDIR}/luvit: ${GENDIR} ${ALLLIBS}
$(CC) -o ${BUILDDIR}/luvit ${ALLLIBS} -Wall -lm -ldl -lrt -lpthread -Wl,-E

clean:
make -C ${LUADIR} clean
make -C ${HTTPDIR} clean
make -C ${UVDIR} distclean
rm -rf build

install: ${BUILDDIR}/luvit
install ${BUILDDIR}/luvit -s -v /usr/local/bin/luvit

examples/native/vector.luvit: examples/native/vector.c examples/native/vector.h
make -C examples/native

test: ${BUILDDIR}/luvit examples/native/vector.luvit
find tests -name "test-*.lua" | while read LINE; do ${BUILDDIR}/luvit $$LINE > tests/failed_test.log && rm tests/failed_test.log || cat tests/failed_test.log; done

.PHONY: test

Something went wrong with that request. Please try again.