File:  [mozdev] / bookwyrm / src / Makefile
Revision 1.11: download - view: text, annotated - select for diffs - revision graph
Wed May 3 20:39:17 2006 UTC (11 years, 5 months ago) by ryukage
Branches: MAIN
CVS tags: HEAD
Getting everything up to date so I can start rewiring the database system for the IFCatalog specification.

#######################################################################
# This makefile will build a single XPI that can be installed into    #
# Firefox as an extension, and in the future into XULRunner as a      #
# cross-platform application.                                         #
# =================================================================== #
# This Makefile may not work with make utilities other than GNU make. #
# =================================================================== #
# Some targets in the various makefiles used by this project depend   #
# on directories instead of specific files. This was unavoidable due  #
# to syntax constraints. It should not be a problem on POSIX systems, #
# as they typically set the modification time of a folder whenever    #
# a file within it is modified. Windows and DOS do not, however, so   #
# you'll have to do some extra work on those systems; either delete   #
# the outdated jar or manually update the folder timestamp.           #
#######################################################################

SHELL=/bin/sh

# The include makefile defines options and command vars,
# but we'll provide defaults if it's missing
# CONFIGFILE=config.make
# -include $(CONFIGFILE)

# PACKAGE?=bookwyrm
# VERSION?=unknown
# VENDOR?=dragonforge
# LANG?=??-??
# THEME?=????*
# JAR?=zip
# JARFLAGS?= -r8
# EXCLUDE_CVS?=-x "*/CVS/*"

INI = application.ini

# Select the optional modules to include
# These can be space-separated lists or wildcards
# take care when using wildcards that they cannot match 'CVS'
# the defaults will include all available
PLATFORM = WINNT Linux
PLATFORM_ABI = WINNT_x86-msvc Linux_x86-gcc3 Linux_x86_64-gcc3
LANG = ??-??
THEME = ????*

# The command for creating jar and xpi files. The commandline used is:
#   $(JAR) $(JARFLAGS) jarfile files $(EXCLUDE_CVS)
# The defaults are set up to use the InfoZip 'zip' command, available
# on most UNIX-compatible systems including Cygwin.
JAR = zip
JARFLAGS = -r8
EXCLUDE_CVS = -x "*/CVS/*"

export LANG THEME JAR JARFLAGS EXCLUDE_CVS

# get the packaging info from application.ini
BUILD:= $(shell date +%Y%m%d)
NAME:= $(shell sed -n -e 's/^Name=\(.*\)/\1/p' $(INI))
VERSION:= $(shell sed -n -e 's/^Version=\(.*\)/\1/p' $(INI))
ID:= $(shell sed -n -e 's/^ID=\(.*\)/\1/p' $(INI))
PACKAGE:= $(shell sed -n -e 's/^ID=\([^@]*\).*/\1/p' $(INI))
VENDOR:= $(shell sed -n -e 's/^ID=[^@]*[@]\([^.]*\).*/\1/p' $(INI))
VENDORNAME:= $(shell sed -n -e 's/^Vendor=\(.*\)/\1/p' $(INI))

# sed patterns for inserting information from application.ini into other files
SEDCMD:= -e 's/%NAME%/$(NAME)/' \
         -e 's/%VERSION%/$(VERSION)/' \
         -e 's/%VENDOR%/$(VENDORNAME)/' \
         -e 's/%ID%/$(ID)/' \
         -e 's/%VENDORTAG%/$(VENDOR)/' \
         -e 's/%PACKAGE%/$(PACKAGE)/'

# list the jarfiles we build
CHROME_PATHS:= $(wildcard chrome/content/????*) \
               $(wildcard $(addprefix chrome/locale/,$(LANG))) \
               $(wildcard $(addprefix chrome/skin/,$(THEME)))

JARNAMES:= $(notdir $(CHROME_PATHS))
JARFILES:= $(addprefix chrome/,$(addsuffix .jar,$(JARNAMES)))

MANIFESTS = chrome.manifest chrome/chrome.manifest install.rdf $(INI)

PREFERENCES_FILES:= $(sort $(subst .j_,.js,$(wildcard defaults/preferences/*.j?)))

PLATFORM_FILES:= $(addprefix platform/,$(addsuffix /*.*,$(PLATFORM))) \
                 $(addprefix platform/,$(addsuffix /*.*,$(PLATFORM_ABI)))

OTHER_FILES:= chrome/database/$(LANG)/*.rdf \
              chrome/icons/default/*.* \
              components/*.* components/*.*

ALL_FILES= $(MANIFESTS) $(PREFERENCES_FILES) $(JARFILES) $(OTHER_FILES) $(PLATFORM_FILES)

# We append the version number and vendor tag to the app name for the XPI
LANGTAG= $(subst _??,,$(subst -??,,_$(LANG)))
DIST_NAME:= $(PACKAGE)_$(VERSION)-$(VENDOR)$(LANGTAG)
XPI_NAME:= $(DIST_NAME).xpi

# build the whole xpi
all: $(XPI_NAME)

# we may eventually be able to auto-install, if we can learn where
# Firefox or XULRunner is installed.
.SILENT: install check
install:
	echo 'Automatic installation not yet available, sorry.'
	echo 'Please see README.txt for manual installation instructions.'

# we don't have anything to strip, so this is just a normal install
install-strip: install

check:
	echo 'No checks available for this application.'

# pack the xpi
$(XPI_NAME): $(ALL_FILES)
	sed -i -e 's/(BuildID=)(.*)/BuildID=$(BUILD)-$(VENDOR)/' $(INI)
	$(JAR) $(JARFLAGS) $(XPI_NAME) $(ALL_FILES) $(EXCLUDE_CVS)

# copy the chrome manifest to the top level location
chrome.manifest: chrome.manifest.release
	cp chrome/chrome.manifest .

# write the application manifests
# application.ini: application.in_ $(CONFIGFILE)
# 	sed $(SEDCMD) $< > $@

install.rdf: install.rd_ $(CONFIGFILE)
	sed $(SEDCMD) $< > $@

$(PREFERENCES_FILES):%.js:%.j_ $(CONFIGFILE)
	sed $(SEDCMD) $< > $@

# pack the jarfiles
# we invoke a second makefile in the chrome/ folder to
# do this, it will handle dependency checking
.PHONY: $(JARFILES)
$(JARFILES):
	cd chrome && $(MAKE) $(notdir $@)

# phony target to build jars
.PHONY: chrome
chrome: $(JARFILES)

# mostlyclean - delete most files, but leave manifests
mostlyclean:
	rm -f $(JARFILES) $(XPI_NAME)

# clean - delete all derived files for current configuration
clean: mostlyclean
	rm -f chrome.manifest

# distclean - regular clean plus any leftovers from builds with different configs
distclean: clean
	rm -f $(PACKAGE)_*.xpi chrome/*.jar

# delete everything that's not in CVS
maintainer-clean: distclean
	rm -f $(PREFERENCES_FILES) install.rdf

# create a partially-compiled source tarball
dist: $(MANIFESTS) $(PREFERENCES_FILES) $(JARFILES)
	mkdir $(DIST_NAME)
	ln -s -t $(DIST_NAME) CVS chrome defaults
	ln -s -t $(DIST_NAME) README.txt MPL-1.1.html Makefile config.make
	ln -s -t $(DIST_NAME) chrome.manifest install.rd? application.in?
	tar -cz --dereference --file=$(DIST_NAME).tar.gz $(DIST_NAME)
	rm $(DIST_NAME)/*
	rmdir $(DIST_NAME)



FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>