Skip to content

Makefile and minor fixes #2

@aropan

Description

@aropan

I used this Makefile for correctly work (sorry that I do not pull request):

PROTO_SRC := <path-to-proto-files>
PROTO_DST := ${PROTO_SRC}/build
PROTO_FILES := $(wildcard ${PROTO_SRC}/*.proto)
LUA_FILES := $(addprefix ${PROTO_DST}/,$(notdir $(PROTO_FILES:.proto=_pb.lua)))

all: ${PROTO_DST} ${LUA_FILES}

${PROTO_DST}:
    mkdir -p ${PROTO_DST}

${PROTO_DST}/%_pb.lua: ${PROTO_SRC}/%.proto
    protoc -I ${PROTO_SRC} $< --lua_out ${PROTO_DST}

    # fixed require with bracket end line
    sed "s/^\(local.*require.*\))$$/\1/" -i $@

    # fixed message from extrenal file
    grep '^local [^=]*_pb = require' $@ | \
        awk '{print $$2}' | \
        while read r; do sed -i "s/ = module.$${r}_/ = $${r}./i" $@; done

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions