我有一个Makefile的下面代码。如果我在命令行中运行“make”,它将创建xpi文件。但是,当我运行“make install”命令时,它会显示“在配置文件夹中安装。完成!”但是没有找到.xpi,也没有一个在我需要复制的路径中。
昨天我已经完成了这项工作,但是今天我丢失了所有的数据,需要从刮擦开始,似乎我错过了一些东西。无法弄清楚是什么。
# The name of the extension.
extension_name := helloworld@xulschool.com
# The UUID of the extension.
extension_uuid := helloworld@xulschool.com
# The name of the profile dir where the extension can be installed.
profile_dir := wiuxd07g.default
# The zip application to be used.
ZIP := zip
# The target location of the build and build files.
bin_dir := ../bin
# The target XPI file.
xpi_file := $(bin_dir)/$(extension_name).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/\{$(extension_uuid)\}
else
profile_location := \
"$(subst \,\\,$(APPDATA))\\Mozilla\\Firefox\\Profiles\\$(profile_dir)\\extensions\\"
endif
endif
# The temporary location where the extension tree will be copied and built.
build_dir := $(bin_dir)/build
# 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)
# 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 ../bin/* $(profile_location)
@echo "Installing in profile folder. Done!"
@echo
$(xpi_file): $(build_dir) $(xpi_built)
@echo "Creating XPI file."
@$(ZIP) $(xpi_file) $(xpi_built)
@echo "Creating XPI file. Done!"
$(build_dir)/%: %
@cp -f $< $@
$(build_dir):
@if [ ! -x $(build_dir) ]; \
then \
mkdir $(build_dir); \
fi
答案 0 :(得分:1)
[你的愿望就是我的命令!]
$(bin_dir)
代替../bin
。@
不起作用时,不要隐藏正在执行的内容。cp
命令是否是您认为应该执行的命令。如果是,请检查源目录(../bin
)是否包含您期望的文件。您的cp
是否有-v
(详细)模式?如果是这样,请使用它。所以
cp
命令有效。无论文件夹中是什么,它都会复制到另一个路径。但是没有要复制的xpi文件,因此它不会执行任何操作。沿线的某处它不会创建xpi文件。
@
符号(您可以将它们保留在echo
命令中),这样您就可以看到出现了什么问题 - 为什么没有按照您的预期构建xpi文件。 或者使用make -d
从make获取(丰富的)调试输出。你可能想要使用类似的东西:
make -d install 2>&1 | tee make.log
这样你就可以捕捉到制作过的东西。如果该选项不是-d
,请咨询您的man make
或同等选项。