makefile 内容如下:
CC = gcc
CXX ?= g++
LVL ?= -g -O3
Opts += $(LVL)
VPATH=../k8s-c-client/kubernetes/config/ ../k8s-c-client/kubernetes/include/ ../k8s-c-client/kubernetes/api/ ../k8s-c-client/kubernetes/watch/ ../k8s-c-client/kubernetes/external
CFLAGS = -std=c++11 -Wall -w $(Opts)
INCFLAGS = -I../k8s-c-client/kubernetes/config/ -I../k8s-c-client/kubernetes/include -I../k8s-c-client/kubernetes/api -I../k8s-c-client/kubernetes/watch -I../k8s-c-client/kubernetes/external
LDFLAGS += $(LDLIBCPP) -rdynamic -lpthread
target = predixy
cobjs = apiClient.o kube_config.o CoreV1API.o watch_util.h cJSON.o
objs = \
Crc16.o \
HashFunc.o \
Timer.o \
Logger.o \
LogFileSink.o \
Alloc.o \
Socket.o \
ListenSocket.o \
AcceptSocket.o \
ConnectSocket.o \
$(multiplexor).o \
Subscribe.o \
Connection.o \
AcceptConnection.o \
ConnectConnection.o \
Buffer.o \
Command.o \
Distribution.o \
Enums.o \
Reply.o \
ConfParser.o \
Conf.o \
Auth.o \
DC.o \
LatencyMonitor.o \
RequestParser.o \
Request.o \
ResponseParser.o \
Response.o \
Server.o \
ServerGroup.o \
ServerPool.o \
ClusterNodesParser.o \
ClusterServerPool.o \
StandaloneServerPool.o \
ConnectConnectionPool.o \
Handler.o \
Proxy.o \
CGetEndpoint.o \
main.o
.PHONY : default debug clean
default: $(target)
$(target): $(cobjs) $(objs)
$(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS)
%.o : %.c
$(CC) -c $^ -o $@ $(INCFLAGS)
%.o : %.cpp
$(CXX) $(CFLAGS) -c $^ $(INCFLAGS)
debug:
@make LVL=-g
clean:
@rm -rf $(objs) $(target)
@rm -rf $(cobjs)
@echo Done.
报错:
make: *** No rule to make target `apiClient.o', needed by `predixy'. Stop.
C++的代码一切正常,就是 C 的死活编译不过(报上面的错),makefile 已经来回检查不知道多少遍了,快崩溃了,希望有老哥能指点一二,感激不尽。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.