我有一個來自試圖將父目錄引用爲「../bin」的示例項目的makefile。這在運行「make install」時似乎不起作用。我得到的錯誤是:Makefile - 引用父目錄的問題
cp: cannot stat `/bin/build/*': No such file or directory
項目的佈局是:
/bin中
/src目錄/ Makefile文件
(所以,當我運行makefile,當前目錄是/ src /)
它似乎引用父目錄用「..」不正確。我知道我可以使用{$ CURDIR}變量引用當前目錄,但我需要知道正確的變量或引用父目錄的方法,以便正確引用/ bin /。我想我可以通過移動makefile來解決這個問題,但我想知道如何做到這一點以備將來使用。
的生成文件看起來是這樣的(問題頃強調了與#####的問題######)
# The name of the extension.
extension_name := xulschoolhello
# The UUID of the extension.
extension_uuid := [email protected]
# The name of the profile dir where the extension can be installed.
profile_dir := 8mtbjosv.development
# The zip application to be used.
ZIP := zip
# The target location of the build and build files.
bin_dir := ../bin ##### problem ######
# The target XPI file.
xpi_file := $(bin_dir)/$(extension_name)2.xpi
# The type of operating system this make command is running on.
os_type := $(patsubst darwin%,darwin,$(shell echo $(OSTYPE)))
# The location of the extension profile.
ifeq ($(os_type), darwin)
profile_location := \
~/Library/Application\ Support/Firefox/Profiles/$(profile_dir)/extensions/\{$(extension_uuid)\}
else
ifeq ($(os_type), linux-gnu)
profile_location := \
~/.mozilla/firefox/$(profile_dir)/extensions/
else
profile_location := \
"$(subst \,\\,$(APPDATA))\\Mozilla\\Firefox\\Profiles\\$(profile_dir)\\extensions\\{$(extension_uuid)}"
endif
endif
# The temporary location where the extension tree will be copied and built.
build_dir := $(bin_dir)/build ##### problem ######
# This builds the extension XPI file.
.PHONY: all
all: $(xpi_file)
@echo
@echo "Build finished successfully."
@echo
# This cleans all temporary files and directories created by 'make'.
.PHONY: clean
clean:
@rm -rf $(build_dir)
@rm -f $(xpi_file)
@echo "Cleanup is done."
# The sources for the XPI file.
xpi_built := install.rdf \
chrome.manifest \
$(wildcard content/*.js) \
$(wildcard content/*.xul) \
$(wildcard content/*.xml) \
$(wildcard content/*.css) \
$(wildcard skin/*.css) \
$(wildcard skin/*.png) \
$(wildcard locale/*/*.dtd) \
$(wildcard locale/*/*.properties)
$(build_dir) $(xpi_built): $(xpi_built)
# This builds everything except for the actual XPI, and then it copies it to the
# specified profile directory, allowing a quick update that requires no install.
.PHONY: install
install: $(build_dir) $(xpi_built)
@echo "Installing in profile folder: $(profile_location)"
@cp -Rf $(build_dir)/* $(profile_location) ##### problem ######
@echo "Installing in profile folder. Done!"
@echo
$(xpi_file): $(xpi_built)
@echo "Creating XPI file."
@$(ZIP) $(xpi_file) $(xpi_built)
@echo "Creating XPI file. Done!"
我使用GNU Linux上的造幣廠製作3.81 12
謝謝。
的
@echo "Installing in profile folder: $(profile_location)"
@echo ${build_dir}
@echo ${profile_location}
輸出是:
Installing in profile folder: ~/.mozilla/firefox/8mtbjosv.development/extensions/
../bin/build
/home/owner/.mozilla/firefox/8mtbjosv.development/extensions/
似乎沒有問題。我chmod'd $(profile_location),仍然得到相同的錯誤。線結束也很好。 – Bryan
這只是簡單的怪異的...你可以做一個回聲'$(build_dir)'和'$(profile_location)'而不是cp?此外,您是否在此輸入錯誤或是否已從終端複製錯誤?如果你仔細觀察,報價中會有小的不一致......也許這是一個線索。 –
輸出是從終端直接 - 我同意它看起來很奇怪,但不知道是什麼原因造成的。我已將您請求的輸出附加到問題末尾。 – Bryan