最初是这样定义的,咋看没问题
DT_VERSION = 5.1.0
ifeq ($(shell which git), )
DT_BACKEND_VERSION = $(DT_VERSION)
else
DATE = $(shell date "+%m/%d/%Y")
GIT_VERSION = $(shell git rev-parse HEAD | cut -c 1-8)
DT_BACKEND_VERSION = $(DT_VERSION)-$(GIT_VERSION) (Built on $(DATE))
endif
CXXFLAGS += -DDT_VERSION="$(DT_VERSION)" \
-DDT_BACKEND_VERSION="$(DT_BACKEND_VERSION)"
make就报错
修改为(只有最后两行不同)
DT_VERSION = 5.1.0
ifeq ($(shell which git), )
DT_BACKEND_VERSION = $(DT_VERSION)
else
DATE = $(shell date "+%m/%d/%Y")
GIT_VERSION = $(shell git rev-parse HEAD | cut -c 1-8)
DT_BACKEND_VERSION = $(DT_VERSION)-$(GIT_VERSION) (Built on $(DATE))
endif
CXXFLAGS += -DDT_VERSION="\"$(DT_VERSION)\"" \
-DDT_BACKEND_VERSION="\"$(DT_BACKEND_VERSION)\""
仔细比较后就知道坑在哪里