没有规则成为Makefile的目标

时间:2018-07-18 08:52:04

标签: c++ makefile grpc

我正在自定义下面附带的gRPC Makefile,以仅生成头文件和.cc文件。

我从以下github链接Github Link中获取了参考

我得到以下答复

make: *** No rule to make target 'rpu_up.pb.cc', needed by 'all'.  Stop.

制作文件

#
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
SYSTEM ?= $(HOST_SYSTEM)
CXX = g++
CPPFLAGS += `pkg-config --cflags protobuf grpc`
CXXFLAGS += -std=c++11
ifeq ($(SYSTEM),Darwin)
LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc`\
           -lgrpc++_reflection\
           -ldl
else
LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc`\
           -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed\
           -ldl
endif

.PHONY: all clean

PROTOC = protoc
PROTOS_PATH = protos
GRPC_CPP_PLUGIN = `which grpc_cpp_plugin`

#vpath %.proto $(PROTOS_PATH)
all: rpu_up.pb.cc rpu_up.grpc.pb.cc

%.pb.cc: %.proto
  $(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<

%.grpc.pb.cc: %.proto
  $(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN) $<

clean:
  rm -f *.pb.cc *.pb.h

原始文件

  cat rpu_up.proto

    syntax = "proto3";

    package rpup_grpc;

    /*! Define RPC message services for RPUP client-server communication. */
    service RpupServerClient{
      rpc BpuAdd (BpuAddInputParams) returns (BpuAddOutputParams) {}
    }

    /*! Input parameters for 'bpu add' command. */
    message BpuAddInputParams {
      string command = 1;
    }

    /*! Output parameters of 'bpu add' command. */
    message BpuAd

dOutputParams {
 int32 rpu_up_id = 1;
 string rpu_up_ip_ran = 2;
 string rpu_up_ip_ue = 3;
}

0 个答案:

没有答案