상위 디렉토리를 "../bin"으로 참조하려고하는 샘플 프로젝트의 makefile이 있습니다. 이것은 "make install"을 실행할 때 작동하지 않는 것 같습니다. 내가 오류는 다음과 같습니다Makefile - 부모 디렉토리 참조 문제
cp: cannot stat `/bin/build/*': No such file or directory
프로젝트의 레이아웃은 다음과 같습니다
/빈
/SRC/메이크
(그래서 메이크 파일을 실행할 때, 현재 디렉토리는/src /입니다)
상위 디렉토리를 참조하는 것으로 나타납니다. ".."가 잘못되었습니다. {CURDIR} 변수를 사용하여 현재 디렉토리를 참조 할 수 있다는 것을 알고 있지만/bin /이 올바르게 참조되도록 부모 디렉토리를 참조하는 적절한 변수 또는 방법을 알아야합니다. 나는 makefile을 움직여이 문제를 해결할 수있을 것이라고 생각하지만, 미래의 사용을 위해 이것을 수행하는 실제 방법을 알고 싶다.
makefile은 내가 GNU는 12
덕분에 리눅스 민트에 3.81를 확인 사용하고
# 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!"
(문제 아르는 ##### 문제 ###### 강조)과 같다 .
@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
그건 그냥 이상한 ... Cp 대신'$ (build_dir)'과'$ (profile_location)'에 echo를 할 수 있습니까? 또한 여기에 오류를 입력했거나 터미널에서 복사 했습니까? 조심스럽게 보면 인용문에 약간의 불일치가 있습니다 ... 어쩌면 이것이 단서 일 수 있습니다. –
출력은 터미널에서 직선이며, 이상하게 보일 수도 있지만 확실하지는 않습니다. 질문의 끝 부분에 요청한 출력을 추가했습니다. – Bryan