# ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications. # Portions created by the Initial Developer are Copyright (C) 2003 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Brian Ryner # Mark Mentovai # Smokey Ardisson # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ***** END LICENSE BLOCK ***** DEPTH = .. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk DIRS = \ flashblock \ $(NULL) APP_NAME = Camino PYTHON ?= python RSYNC_ALL = rsync -aC --exclude .cvsignore --delete CM_APP_VERSION_FILE = $(srcdir)/config/version.txt CM_APP_VERSION := $(shell cat $(CM_APP_VERSION_FILE)) CM_COPYRIGHT_YEAR_FILE = $(srcdir)/config/year.txt CM_COPYRIGHT_YEAR := $(shell cat $(CM_COPYRIGHT_YEAR_FILE)) FOX_APP_VERSION_FILE = $(topsrcdir)/browser/config/version.txt FOX_APP_VERSION := $(shell cat $(FOX_APP_VERSION_FILE)) PLATFORM_VERSION_FILE = $(topsrcdir)/config/milestone.txt PLATFORM_VERSION := $(shell egrep "^[^\#]+" $(PLATFORM_VERSION_FILE)) PLATFORM_BUILD_ID_FILE = generated/platform_build_id PLATFORM_BUILD_ID := \ $(shell $(PYTHON) \ $(topsrcdir)/toolkit/xre/make-platformini.py --print-buildid) PLATFORM_INI_FILE = ../toolkit/xre/platform.ini # For Launch Services compatibility, CFBundleVersion can be at most three # .-separated integers, aaaaaa.bb.cc, with a maximum of 429496.99.99. Use # Camino's major and minor version number and the build date as the basis for # CFBundleVersion. This transforms version a.b (and any alphas, betas, # prereleases, and bug-fix versions) built on date 20yy.mm.dd into # CFBundleVersion abyy.mm.dd. Only a and b from the version need to be # significant, since any further updates (a.b.c) will necessarily be built on # future dates, and will have larger CFBundleVersion values. This mapping # assumes 0 <= b <= 9 and is not year 2100-compliant. There is currently no # CM_APP_VERSION_CFBUNDLE_FILE to depend on; any rule that uses this value # should depend on CM_APP_VERSION_FILE and PLATFORM_BUILD_ID_FILE. CM_APP_VERSION_CFBUNDLE := $(shell echo $(CM_APP_VERSION)@$(PLATFORM_BUILD_ID) | \ sed -E -e 's/^([0-9]+)\.([0-9]).*@[02]0([0-9]{2})([0-9]{2})([0-9]{2})[0-9]{2}$$/\1\2\3.\4.\5/') # Info.plist needs to have keys for some values removed, instead of placing # empty values. Start out with a pattern that doesn't exist to give something # to append "or" regex clauses to. GREP_V_PATTERN = __dummy__ # If a CVS tag (or branch) can be determined, use it as the CVS tag name in # Info.plist. If no tag can be found, set up to remove the relevant key from # Info.plist. CVS_TAG_FILE = generated/cvs_tag CVS_TAG := $(shell if [ -d $(srcdir)/CVS ] ; then \ if [ -f $(srcdir)/CVS/Tag ] ; then \ sed -e 's/^D.*/HEAD/' -e 's/^[NT]//' $(srcdir)/CVS/Tag ; \ else \ echo HEAD ; \ fi \ fi) ifdef CVS_TAG SED_ARGS += -e "s/%CVS_TAG%/$(CVS_TAG)/" else # CVS_TAG # Add the extra dummy pattern to ensure that make can't add whitespace to the # strings we care about. GREP_V_PATTERN += \|MozillaCVSTag\|%CVS_TAG%\|__dummy__ endif # CVS_TAG # If MOZ_CO_DATE is set, use it as the CVS time in Info.plist. If it doesn't # exist, set up to remove the relevant key from Info.plist. CVS_TIME_FILE = generated/cvs_time ifdef MOZ_CO_DATE CVS_TIME := $(shell $(PERL) $(srcdir)/config/mozcodate2iso8601 "$(MOZ_CO_DATE)") ifndef CVS_TIME # Fail if the MOZ_CO_DATE format ever changes. CVS_TIME := $(error mozcodate2iso8601) endif # !CVS_TIME SED_ARGS += -e "s/%CVS_TIME%/$(CVS_TIME)/" else # MOZ_CO_DATE # Add the extra dummy pattern to ensure that make can't add whitespace to the # strings we care about. GREP_V_PATTERN += \|MozillaCVSTime\|%CVS_TIME%\|__dummy__ endif # MOZ_CO_DATE STRINGS_FILES = \ resources/localized/English.lproj/CertificateDialogs.strings \ resources/localized/English.lproj/Localizable.strings \ PreferencePanes/Appearance/English.lproj/Localizable.strings \ PreferencePanes/Appearance/English.lproj/RegionNames.strings \ PreferencePanes/Downloads/English.lproj/Localizable.strings \ PreferencePanes/General/English.lproj/Localizable.strings \ PreferencePanes/History/English.lproj/Localizable.strings \ PreferencePanes/Privacy/English.lproj/Localizable.strings \ PreferencePanes/Security/English.lproj/Localizable.strings \ PreferencePanes/Tabs/English.lproj/Localizable.strings \ PreferencePanes/WebFeatures/English.lproj/Localizable.strings \ $(NULL) GENERATED_STRINGS_FILES = $(patsubst %,generated/%,$(STRINGS_FILES)) ifdef MOZ_DEBUG BUILDSTYLE = Development else BUILDSTYLE = Deployment endif ifdef BUILD_STATIC_LIBS TARGET = CaminoStatic else TARGET = Camino endif GARBAGE += \ $(PLATFORM_INI_FILE) \ $(DIST)/bin/platform.ini \ $(NULL) GARBAGE_DIRS += \ build \ $(DIST)/$(APP_NAME).app \ embed-replacements.tmp \ generated \ sparkle/build \ $(NULL) include $(topsrcdir)/config/rules.mk unexport CC CXX ABS_topsrcdir := $(shell cd $(topsrcdir); pwd) export:: mkdir -p wallet/tables ln -fs $(ABS_topsrcdir)/extensions/wallet/src/*.tbl wallet/tables ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT)) $(RSYNC_ALL) $(srcdir)/Camino.xcodeproj . ln -fs $(srcdir)/src ln -fs $(srcdir)/resources ln -fs $(srcdir)/config mkdir -p sparkle rm -rf sparkle/Sparkle.xcodeproj ln -fs $(ABS_topsrcdir)/camino/sparkle/* sparkle rm -rf sparkle/Sparkle.xcodeproj $(RSYNC_ALL) $(ABS_topsrcdir)/camino/sparkle/Sparkle.xcodeproj sparkle ln -fs $(srcdir)/PreferencePanes ln -fs $(srcdir)/Info-*.plist . endif generated: mkdir -p $@ # Generate files which need to pull version numbers or dates from other files # in the tree generated/resources/application/all-camino.js: \ $(srcdir)/resources/application/all-camino.js.in \ $(FOX_APP_VERSION_FILE) \ $(CM_APP_VERSION_FILE) \ generated mkdir -p $(dir $@) sed -e "s/%FOX_APP_VERSION%/$(FOX_APP_VERSION)/" \ -e "s/%CM_APP_VERSION%/$(CM_APP_VERSION)/" $< > $@ generated/Info-Camino.plist: \ $(srcdir)/Info-Camino.plist.in \ $(CM_APP_VERSION_FILE) \ $(CM_COPYRIGHT_YEAR_FILE) \ $(PLATFORM_BUILD_ID_FILE) \ $(PLATFORM_VERSION_FILE) \ $(CVS_TAG_FILE) \ $(CVS_TIME_FILE) \ generated mkdir -p $(dir $@) sed -e "s/%CM_APP_VERSION%/$(CM_APP_VERSION)/" \ -e "s/%CM_APP_VERSION_CFBUNDLE%/$(CM_APP_VERSION_CFBUNDLE)/" \ -e "s/%CM_COPYRIGHT_YEAR%/$(CM_COPYRIGHT_YEAR)/" \ -e "s/%PLATFORM_BUILD_ID%/$(PLATFORM_BUILD_ID)/" \ -e "s/%PLATFORM_VERSION%/$(PLATFORM_VERSION)/" \ $(SED_ARGS) $< | \ grep -v "$(GREP_V_PATTERN)" > $@ generated/resources/localized/English.lproj/InfoPlist.strings: \ $(srcdir)/resources/localized/English.lproj/InfoPlist.strings.in \ $(CM_APP_VERSION_FILE) \ $(CM_COPYRIGHT_YEAR_FILE) \ generated mkdir -p $(dir $@) sed -e "s/%CM_APP_VERSION%/$(CM_APP_VERSION)/" \ -e "s/%CM_COPYRIGHT_YEAR%/$(CM_COPYRIGHT_YEAR)/" $< | \ iconv -f UTF-8 -t UTF-16 > $@ # Generate UTF-16 with BOM strings files from UTF-8 strings.in files. On Mac # OS X, iconv seems always to output big-endian when asked for UTF-16 with a # BOM, which is what AppleGlot seems to require. $(GENERATED_STRINGS_FILES): \ generated/%.strings: $(srcdir)/%.strings.in \ generated mkdir -p $(dir $@) iconv -f UTF-8 -t UTF-16 $< > $@ # The "grep -lFx" construct in these rules will only touch the file if the # contents are changing. The file's timestamp will be preserved when the # contents aren't changing, reducing unnecessary build activity. $(PLATFORM_BUILD_ID_FILE): FORCE generated grep -lFx "$(PLATFORM_BUILD_ID)" $@ >& /dev/null || \ echo $(PLATFORM_BUILD_ID) > $@ $(CVS_TAG_FILE): FORCE generated grep -lFx "$(CVS_TAG)" $@ >& /dev/null || \ echo $(CVS_TAG) > $@ $(CVS_TIME_FILE): FORCE generated grep -lFx "$(CVS_TIME)" $@ >& /dev/null || \ echo $(CVS_TIME) > $@ # Put platform.ini into toolkit/xre and dist/bin, because that's where # Tinderbox looks to figure out the build ID. It currently doesn't need # to be distributed with the application. $(PLATFORM_INI_FILE): $(PLATFORM_BUILD_ID_FILE) $(PLATFORM_VERSION_FILE) mkdir -p `dirname $@` echo [Build] > $@ echo BuildID=$(PLATFORM_BUILD_ID) >> $@ echo Milestone=$(PLATFORM_VERSION) >> $@ $(INSTALL) $@ $(DIST)/bin # The embed-replacements rsync is done for both srcdir and objdir builds # to avoid adding CVS stuff to embed.jar. libs:: \ generated/resources/application/all-camino.js \ generated/Info-Camino.plist \ generated/resources/localized/English.lproj/InfoPlist.strings \ $(GENERATED_STRINGS_FILES) \ $(PLATFORM_INI_FILE) $(RSYNC_ALL) $(srcdir)/embed-replacements/ embed-replacements.tmp cd embed-replacements.tmp && \ $(ZIP) -r0DX ../../dist/Embed/chrome/embed.jar * $(PBBUILD) -project Camino.xcodeproj -target $(TARGET) \ -configuration $(BUILDSTYLE) $(PBBUILD_SETTINGS) $(RSYNC_ALL) --copy-unsafe-links \ $(XCODE_PRODUCT_DIR)/Camino.app/ $(DIST)/$(APP_NAME).app $(RM) $(DIST)/$(APP_NAME).app/Contents/MacOS/components/camino.xpt $(XPIDL_LINK) $(DIST)/$(APP_NAME).app/Contents/MacOS/camino.xpt \ $(DIST)/$(APP_NAME).app/Contents/MacOS/components/*.xpt $(RM) $(DIST)/$(APP_NAME).app/Contents/MacOS/components/*.xpt mv $(DIST)/$(APP_NAME).app/Contents/MacOS/camino.xpt \ $(DIST)/$(APP_NAME).app/Contents/MacOS/components/camino.xpt