XULSchool制作:***没有规则要制作目标'../bin/build','install'需要。停止

时间:2014-02-20 23:39:00

标签: makefile firefox-addon

我正在完成xulschool教程here

到目前为止,一切都进展顺利,但我遇到了包含makefile的问题。 “make”工作正常,但“make install”会抛出错误:

"make: *** No rule to make target '../bin/build', needed by 'install'.  Stop."

我之前从未使用过make,但看起来它需要一些额外的参数,这些参数在本教程的任何地方都没有提到。任何帮助将不胜感激。

makefile的内容:

# The name of the extension.
    extension_name := xulschoolhello

# The UUID of the extension.
extension_uuid := helloworld@xulschool.com

# The name of the profile dir where the extension can be installed.
profile_dir := XULSchool

# 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)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/\{$(extension_uuid)\}
  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

# 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 $(build_dir)/* $(profile_location)
    @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!"

2 个答案:

答案 0 :(得分:0)

我正在关注相同的教程并遇到了问题,但我设法通过手动创建以下文件夹(在OSX上)来实现它:

~/Library/Application Support/Firefox/Profiles/xulschool-dev/extensions/{helloworld@xulschool.com}

但是,我后来发现文件夹xulschool-dev是通过设置一个具有该名称的新Firefox配置文件而创建的。

答案 1 :(得分:0)

我通过分配:

在我的Mac上解决了这个问题
profile_location := \
~/Library/Application\ Support/Firefox/Profiles/$(profile_dir)/extensions/\{$(extension_uuid)\}

由于某种原因,else(第26行)语句在Mac上执行。

在此之前需要创建$(profile_dir)。如何创建它解释here

此外:

build_dir := $(bin_dir)

而不是

build_dir := $(bin_dir)/build

在他们被发起之后。

但命令make clean将被破坏,以解决它:

@rm -rf $(build_dir)/bin

而不是:

@rm -rf $(build_dir)

最终结果如下: https://jsfiddle.net/bhjbfc0t/1/