I have the below code for a Makefile. If I run "make" in the command line it creates the xpi file. But when I run the "make install" command it says "Installing in profile folder. Done!" but there is no .xpi to be found and also there isn't one in the path where I need it to be copied.
I've made this work yesterday, but today I lost all the data and needed to start from scrath and it seems I'm missing something. Can't figure out what.
# The name of the extension.
extension_name := [email protected]
# The UUID of the extension.
extension_uuid := [email protected]
# 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
[Your wish is my command!]
$(bin_dir)
instead of ../bin
in the install rule.@
when it isn't working.cp
command being executed is the one you think should be being executed. If it is, check whether the source directory (../bin
) contains the files you expect. Does your cp
have a -v
(verbose) mode? If so, use it.So the
cp
command works. Whatever is in the folder, it copies to the other path. But there isn't an xpi file to copy so it doesn't do anything. Somewhere along the line it doesn't create the xpi file.
@
signs from the executed commands (you can leave them on the echo
commands) so you can see what's going wrong — why the xpi file is not built as you expect.Or use make -d
to get (copious) debug output from make. You'll probably want to use something like:
make -d install 2>&1 | tee make.log
so you capture what make was doing. If the option isn't -d
, consult your man make
or equivalent.