1# Install protobuf and set PROTOBUF_ROOT to its location 2ifndef PROTOBUF_ROOT 3$(error PROTOBUF_ROOT is not set) 4endif 5PROTOC:=LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PROTOBUF_ROOT}/lib ${PROTOBUF_ROOT}/bin/protoc 6CC:=g++ 7 8BUILD_DIR:=build 9PROTO_BUILD_DIR:=${BUILD_DIR}/proto 10PROTO_DIR:=proto 11SRC_DIR:=src 12 13GAME_OBJS:=${PROTO_BUILD_DIR}/tuningfork_extensions.pb.o ${BUILD_DIR}/game.o 14ENG_GAME_OBJS:=${PROTO_BUILD_DIR}/eng_tuningfork_extensions.pb.o ${BUILD_DIR}/eng_game.o 15TUNINGFORK_OBJS:= ${PROTO_BUILD_DIR}/tuningfork.pb.o ${BUILD_DIR}/mocktuningfork.o 16GAMEENGINE_OBJS:= ${PROTO_BUILD_DIR}/eng_tuningfork.pb.o ${BUILD_DIR}/gameengine.o 17SZTOOL_OBJS:=${PROTO_BUILD_DIR}/tuningfork.pb.o ${PROTO_BUILD_DIR}/tuningfork_clearcut_log.pb.o ${BUILD_DIR}/sztool.o ${BUILD_DIR}/dynamicproto.o 18PLAY_OBJS:=${BUILD_DIR}/dynamicproto.o ${BUILD_DIR}/play.o 19 20CDEFS:=-I${PROTOBUF_ROOT}/include -fPIC -I${BUILD_DIR} -std=c++11 21LIBS:=-lprotobuf -L${PROTOBUF_ROOT}/lib 22TUNINGFORK_LIB:=${BUILD_DIR}/mocktuningfork.so 23GAMEENGINE_LIB:=${BUILD_DIR}/gameengine.so 24 25all: run 26 27run: play game eng_game sztool 28 ./play proto/tuningfork_extensions.proto > fidelityparams.pbin 29 ./game 30 ./eng_game 31 ./sztool proto/tuningfork_extensions.proto tuningfork_settings.txt 32 33clean: 34 rm -rf ${BUILD_DIR} play sztool game eng_game 35 36game: ${TUNINGFORK_LIB} ${GAME_OBJS} 37 ${CC} -o $@ $^ ${LIBS} 38 39eng_game: ${GAMEENGINE_LIB} ${TUNINGFORK_LIB} ${ENG_GAME_OBJS} 40 ${CC} -o $@ $^ ${LIBS} 41 42${TUNINGFORK_LIB}: ${TUNINGFORK_OBJS} 43 ${CC} -o $@ $^ -shared 44 45${GAMEENGINE_LIB}: ${GAMEENGINE_OBJS} 46 ${CC} -o $@ $^ -shared 47 48play: ${PLAY_OBJS} 49 ${CC} -o $@ $^ ${LIBS} 50 51sztool: ${SZTOOL_OBJS} 52 ${CC} -o $@ $^ ${LIBS} 53 54${BUILD_DIR}/%.o: ${SRC_DIR}/%.cc | ${BUILD_DIR} 55 ${CC} -o $@ -c ${CDEFS} $< 56 57${PROTO_BUILD_DIR}/%.pb.o: ${PROTO_BUILD_DIR}/%.pb.cc | ${PROTO_BUILD_DIR} 58 ${CC} -o $@ -c ${CDEFS} $< 59 60${PROTO_BUILD_DIR}/%.pb.cc: ${PROTO_DIR}/%.proto | ${PROTO_BUILD_DIR} 61 ${PROTOC} --cpp_out=${BUILD_DIR}/proto -Iproto -I${PROTOBUF_ROOT}/include $< 62 63${BUILD_DIR}: 64 mkdir -p $@ 65 66${PROTO_BUILD_DIR}: 67 mkdir -p $@ 68 69.PHONY: all run clean 70