Makefile.mozextension.2

This Makefile is a modification of the Makefile.mozextention, found in Makefile for packaging an extension - MozillaZine Knowledge Base (2005).

Note that the original Makefile.mozextention merely repeats the steps in Getting started with extension development - MozillaZine Knowledge Base (2008). The same goes for this slight Makefile rework here.

NOTE: Unfortunately, this wiki system at developer.mozilla.org will try to parse xml declarations - even if they are within a pre tag!! Which is why the code shown below is corrupt - so you may wanna click on edit and view source instead !! Then again if you do that, all of the < > will be quoted as & lt ; so again it will be corrupt :(

 

 

## file: Makefile.mozextension2
## based on http://kb.mozillazine.org/Makefile_for_packaging_an_extension
## "This Makefile.mozextention is for the test extension"
## the original Makefile.mozextention reconstructs http://kb.mozillazine.org/Getting_started_with_extension_development

# call with:
# make -f Makefile.mozextension2 make_structure
## (without args for 'all')

# note: @echo silent; without @ the command is written in stdout

PROJECT=test

PROJECT_NAME=TestWorld

#~ PROJECT_ID={XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
PROJECT_ID=test@TestWorld.ext
PROJECT_VERSION=1.0
PROJECT_DESC="A $(PROJECT_NAME) project with advanced features"
PROJECT_AUTHOR=Author Name


# MKDIR=$(shell which mkdir)
MKDIR=/bin/mkdir
ZIPPROG=/usr/bin/zip
SHELL = /bin/sh
NOOP = $(SHELL) -c true
NOECHO = @
RM_RF=rm -f
CP=/bin/cp -i


.PHONY: all


all ::  make_structure make_files
	$(NOECHO) $(NOOP)

package:: make_xpi
	$(NOECHO) $(NOOP)

#install :: make_xpi make_install
#	$(NOECHO) $(NOOP)

clean :: make_clean
	$(NOECHO) $(NOOP)

make_structure:
	@$(MKDIR) $(PROJECT) || { echo "creating directory failed; it probably exists. Either remove (clean it), or choose individual targets to build."; exit 1; }
	@echo $(MKDIR) $(PROJECT)
	$(MKDIR) $(PROJECT)/content $(PROJECT)/locale $(PROJECT)/locale/en-us $(PROJECT)/components/ $(PROJECT)/defaults/ $(PROJECT)/defaults/preferences/ $(PROJECT)/locale/de-de $(PROJECT)/skin

make_xpi:
	$(MKDIR) $(PROJECT)/chrome && \
	cd $(PROJECT) && \
	$(ZIPPROG)  -r  chrome/$(PROJECT).jar content locale skin && \
	$(ZIPPROG)  -r  $(PROJECT).xpi chrome.manifest install.rdf components defaults chrome && cd ..


make_files: chrome.manifest install.rdf overlay.xul overlay.js overlay.dtd
	$(NOECHO) $(NOOP)

make_clean:
	rm -rf $(PROJECT)

# this may be a bit too old ?! Keeping it anyway.. 
real_install:
	$(CP) chrome/$(PROJECT).jar ~/.mozilla/default/32p27fdr.slt/chrome/



####################################

######
define CHROME_MANIFEST
content	$(PROJECT) content/
overlay	chrome://browser/content/browser.xul 	chrome://$(PROJECT)/content/overlay.xul

locale	$(PROJECT)	en-US	locale/en-US/
skin	$(PROJECT)	classic/1.0	skin/
style	chrome://global/content/customizeToolbar.xul	chrome://$(PROJECT)/skin/overlay.css

endef
export CHROME_MANIFEST

chrome.manifest:
	@echo Generating $(PROJECT)/chrome.manifest
	@echo "$$CHROME_MANIFEST" > $(PROJECT)/chrome.manifest


######
#Firefox 	{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
#Thunderbird 	{3550f703-e582-4d05-9a08-453d09bdfdc6}
#Nvu 	{136c295a-4a5a-41cf-bf24-5cee526720d5}
#Mozilla Suite 	{86c18b42-e466-45a9-ae7a-9b95ba6f5640}
#SeaMonkey 	{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
#Sunbird 	{718e30fb-e89b-41dd-9da7-e25a45638b28}
#Netscape Browser	{3db10fab-e461-4c80-8b97-957ad5f8ea47}
######
define INSTALL_RDF

<rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">

<description about="urn:mozilla:install-manifest">

<id>$(PROJECT_ID)</id>
<name>$(PROJECT_NAME)</name>
<version>$(PROJECT_VERSION)</version>
<description>$(PROJECT_DESC)</description>
<creator>$(PROJECT_AUTHOR)</creator>

<contributor>Here is a place for you who helped me</contributor>

<homepageurl>http://$(PROJECT).mozdev.org/</homepageurl>
<optionsurl>chrome://$(PROJECT)/content/settings.xul</optionsurl>
<abouturl>chrome://$(PROJECT)/content/about.xul</abouturl>
<iconurl>chrome://$(PROJECT)/skin/mainicon.png</iconurl>
<updateurl>http://$(PROJECT).mozdev.org/update.rdf</updateurl>
<type>2</type> 

      
<targetapplication>
  <description>
    <id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id>
    <minversion>2.0</minversion>
    <maxversion>9.0</maxversion>
  </description>
</targetapplication>

</description>
</rdf>
endef
export INSTALL_RDF

install.rdf:
	@echo Generating $(PROJECT)/install.rdf
	@echo "$$INSTALL_RDF" > $(PROJECT)/install.rdf


######
define OVERLAY_XUL



<overlay id="$(PROJECT)-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><script src="overlay.js"/></overlay>

Document Tags and Contributors

 Contributors to this page: teoli, sdaau
 Last updated by: sdaau,