2011-04-01 05:29:20 +04:00
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
BIN_DIR = Scripts
|
|
|
|
else
|
|
|
|
BIN_DIR = bin
|
|
|
|
endif
|
|
|
|
|
2011-03-24 15:46:07 +03:00
|
|
|
APPNAME = server-shared-send
|
2011-04-12 19:49:56 +04:00
|
|
|
DEPS = mozilla:server-core,github:server-share-core
|
2011-03-24 15:46:07 +03:00
|
|
|
VIRTUALENV = virtualenv
|
2011-04-01 05:29:20 +04:00
|
|
|
NOSE = $(BIN_DIR)/nosetests
|
2011-03-30 22:17:16 +04:00
|
|
|
NOSETESTS_ARGS = -s
|
|
|
|
NOSETESTS_ARGS_C = -s --with-xunit --with-coverage --cover-package=linkdrop,linkoauth --cover-erase
|
2011-03-28 14:13:36 +04:00
|
|
|
TESTS = linkdrop/tests deps/server-share-core/linkoauth/tests
|
2011-04-01 05:29:20 +04:00
|
|
|
PYTHON = $(BIN_DIR)/python
|
2011-03-26 01:23:37 +03:00
|
|
|
version = $(shell $(PYTHON) setup.py --version)
|
|
|
|
tag = $(shell grep tag_build setup.cfg | cut -d= -f2 | xargs echo )
|
2011-04-01 05:29:20 +04:00
|
|
|
|
|
|
|
# *sob* - just running easy_install on Windows prompts for UAC...
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
EZ = $(PYTHON) $(BIN_DIR)/easy_install-script.py
|
|
|
|
else
|
|
|
|
EZ = $(BIN_DIR)/easy_install
|
|
|
|
endif
|
2011-03-24 15:46:07 +03:00
|
|
|
COVEROPTS = --cover-html --cover-html-dir=html --with-coverage --cover-package=linkdrop
|
2011-03-25 20:19:05 +03:00
|
|
|
COVERAGE := coverage
|
2011-04-01 05:29:20 +04:00
|
|
|
PYLINT = $(BIN_DIR)/pylint
|
2011-03-24 15:46:07 +03:00
|
|
|
PKGS = linkdrop
|
|
|
|
|
2011-04-19 21:02:16 +04:00
|
|
|
GIT_DESCRIBE := `git describe --long`
|
2011-04-19 20:09:57 +04:00
|
|
|
|
2010-09-29 00:42:26 +04:00
|
|
|
ifeq ($(TOPSRCDIR),)
|
|
|
|
export TOPSRCDIR = $(shell pwd)
|
|
|
|
endif
|
|
|
|
srcdir=$(TOPSRCDIR)/extensions/firefox-share/src/
|
|
|
|
objdir=$(TOPSRCDIR)/extensions/firefox-share/dist/
|
2011-03-18 19:46:20 +03:00
|
|
|
dist_dir=$(TOPSRCDIR)/dist
|
2010-09-29 00:42:26 +04:00
|
|
|
stage_dir=$(objdir)/stage
|
2011-01-27 06:51:58 +03:00
|
|
|
xpi_dir=$(TOPSRCDIR)/web/dev
|
2011-01-07 01:46:52 +03:00
|
|
|
web_dir=$(TOPSRCDIR)/web/dev
|
|
|
|
static_dir=$(TOPSRCDIR)/web/$(version)
|
2010-10-01 02:26:08 +04:00
|
|
|
webbuild_dir=$(TOPSRCDIR)/tools/webbuild
|
|
|
|
requirejs_dir=$(webbuild_dir)/requirejs
|
2010-09-29 00:42:26 +04:00
|
|
|
|
2011-01-27 06:51:58 +03:00
|
|
|
xpi_name := ffshare.xpi
|
2011-03-22 23:37:38 +03:00
|
|
|
xpi_files := bootstrap.js chrome install.rdf modules
|
2010-09-30 21:35:42 +04:00
|
|
|
dep_files := Makefile $(shell find $(srcdir) -type f)
|
2010-09-29 00:42:26 +04:00
|
|
|
|
|
|
|
SLINK = ln -sf
|
|
|
|
ifneq ($(findstring MINGW,$(shell uname -s)),)
|
|
|
|
SLINK = cp -r
|
|
|
|
export NO_SYMLINK = 1
|
|
|
|
endif
|
|
|
|
|
2010-12-09 03:15:18 +03:00
|
|
|
all: xpi
|
2010-09-30 21:35:42 +04:00
|
|
|
|
|
|
|
xpi: $(xpi_dir)/$(xpi_name)
|
2010-09-29 00:42:26 +04:00
|
|
|
|
2010-09-30 21:35:42 +04:00
|
|
|
$(xpi_dir):
|
2010-09-29 00:42:26 +04:00
|
|
|
mkdir -p $(xpi_dir)
|
2010-12-09 03:15:18 +03:00
|
|
|
|
2011-03-22 23:37:38 +03:00
|
|
|
stage_files = $(stage_dir)/chrome $(stage_dir)/install.rdf $(stage_dir)/bootstrap.js $(stage_dir)/modules
|
2010-09-30 21:35:42 +04:00
|
|
|
|
|
|
|
$(stage_dir):
|
2010-09-29 00:42:26 +04:00
|
|
|
mkdir -p $(stage_dir)
|
2010-09-30 21:35:42 +04:00
|
|
|
$(MAKE) $(stage_files)
|
2010-12-09 03:15:18 +03:00
|
|
|
|
2011-03-22 23:37:38 +03:00
|
|
|
$(stage_dir)/bootstrap.js: $(srcdir)/bootstrap.js
|
|
|
|
$(SLINK) $(srcdir)/bootstrap.js $(stage_dir)/bootstrap.js
|
2010-09-29 00:42:26 +04:00
|
|
|
|
2010-09-30 21:35:42 +04:00
|
|
|
$(stage_dir)/install.rdf: $(srcdir)/install.rdf
|
|
|
|
$(SLINK) $(srcdir)/install.rdf $(stage_dir)/install.rdf
|
2010-09-29 00:42:26 +04:00
|
|
|
|
2010-09-30 21:35:42 +04:00
|
|
|
$(stage_dir)/chrome: $(srcdir)/chrome
|
|
|
|
$(SLINK) $(srcdir)/chrome $(stage_dir)/chrome
|
|
|
|
|
2010-10-27 23:34:05 +04:00
|
|
|
$(stage_dir)/modules: $(srcdir)/modules
|
|
|
|
$(SLINK) $(srcdir)/modules $(stage_dir)/modules
|
|
|
|
|
2010-12-09 03:15:18 +03:00
|
|
|
$(xpi_dir)/$(xpi_name): $(xpi_dir) $(stage_dir) $(dep_files)
|
2010-09-29 00:42:26 +04:00
|
|
|
rm -f $(xpi_dir)/$(xpi_name)
|
2010-09-30 21:35:42 +04:00
|
|
|
cd $(stage_dir) && zip -9r $(xpi_name) $(xpi_files)
|
2010-09-29 00:42:26 +04:00
|
|
|
mv $(stage_dir)/$(xpi_name) $(xpi_dir)/$(xpi_name)
|
|
|
|
|
2010-10-01 02:26:08 +04:00
|
|
|
web: $(static_dir)
|
|
|
|
|
|
|
|
$(static_dir):
|
2010-10-01 21:01:55 +04:00
|
|
|
rsync -av $(web_dir)/ $(static_dir)/
|
2011-01-07 01:46:52 +03:00
|
|
|
|
2011-02-17 00:48:08 +03:00
|
|
|
perl -i -pe "s:VERSION='[^']+':VERSION='$(version)':" $(TOPSRCDIR)/setup.py
|
2011-03-24 03:55:46 +03:00
|
|
|
perl -i -pe 's:/[^/]+/auth.html:/$(version)/auth.html:go' $(TOPSRCDIR)/staging.ini
|
|
|
|
perl -i -pe 's:/[^/]+/auth.html:/$(version)/auth.html:go' $(TOPSRCDIR)/production.ini
|
2011-02-24 23:02:21 +03:00
|
|
|
|
2011-01-07 03:10:26 +03:00
|
|
|
find $(static_dir) -name \*.html | xargs perl -i -pe 's:/dev/:/$(version)/:go'
|
2011-02-24 23:02:21 +03:00
|
|
|
perl -i -pe 's:/dev/:/$(version)/:go' $(static_dir)/scripts/oauth.js
|
2011-01-07 03:10:26 +03:00
|
|
|
|
2011-01-07 01:46:52 +03:00
|
|
|
cd $(static_dir) && $(requirejs_dir)/build/build.sh build.js
|
|
|
|
cd $(static_dir)/settings && $(requirejs_dir)/build/build.sh build.js
|
|
|
|
cd $(static_dir)/share && $(requirejs_dir)/build/build.sh build.js
|
2011-02-03 22:33:58 +03:00
|
|
|
cd $(static_dir)/share/panel && $(requirejs_dir)/build/build.sh build.js
|
2010-10-01 02:26:08 +04:00
|
|
|
|
2010-09-29 00:42:26 +04:00
|
|
|
clean:
|
|
|
|
rm -rf $(objdir)
|
2010-10-01 02:26:08 +04:00
|
|
|
rm -rf $(static_dir)
|
2011-03-18 19:46:20 +03:00
|
|
|
rm -rf $(dist_dir)
|
2011-03-23 22:39:12 +03:00
|
|
|
rm -f f1.spec
|
2010-09-29 00:42:26 +04:00
|
|
|
|
2011-03-23 22:39:12 +03:00
|
|
|
dist: f1.spec
|
2011-03-18 19:46:20 +03:00
|
|
|
$(PYTHON) setup.py sdist --formats gztar,zip
|
2011-03-23 22:44:56 +03:00
|
|
|
# This is so Hudson can get stable urls to this tarball
|
2011-03-23 22:46:36 +03:00
|
|
|
ln -sf linkdrop-$(version)$(tag).tar.gz dist/linkdrop-current.tar.gz
|
2011-03-18 19:46:20 +03:00
|
|
|
|
2011-03-23 22:39:12 +03:00
|
|
|
rpm: f1.spec
|
2011-03-18 20:33:03 +03:00
|
|
|
$(PYTHON) setup.py bdist_rpm
|
2011-03-24 03:55:46 +03:00
|
|
|
|
2011-04-01 21:26:41 +04:00
|
|
|
f1.spec: f1.spec.in Makefile tools/makespec
|
2011-04-19 20:09:57 +04:00
|
|
|
tools/makespec $(version)$(tag) linkdrop.egg-info/requires.txt $(GIT_DESCRIBE) < f1.spec.in > f1.spec
|
2011-03-18 20:33:03 +03:00
|
|
|
|
2011-03-24 15:46:07 +03:00
|
|
|
build:
|
2011-03-29 04:50:59 +04:00
|
|
|
$(VIRTUALENV) --no-site-packages --distribute .
|
2011-03-24 15:46:07 +03:00
|
|
|
$(PYTHON) build.py $(APPNAME) $(DEPS)
|
|
|
|
$(EZ) nose
|
|
|
|
$(EZ) WebTest
|
|
|
|
$(EZ) Funkload
|
|
|
|
$(EZ) pylint
|
|
|
|
$(EZ) coverage
|
|
|
|
|
2011-03-25 19:48:47 +03:00
|
|
|
test:
|
2011-03-28 14:13:36 +04:00
|
|
|
$(NOSE) $(NOSETESTS_ARGS) $(TESTS)
|
2011-03-30 22:17:16 +04:00
|
|
|
|
|
|
|
coverage:
|
|
|
|
$(NOSE) $(NOSETESTS_ARGS_C) $(TESTS)
|
2011-03-25 19:58:27 +03:00
|
|
|
$(COVERAGE) xml
|
2011-03-25 19:48:47 +03:00
|
|
|
|
2011-04-20 22:42:32 +04:00
|
|
|
.PHONY: xpi clean dist rpm build test coverage web $(static_dir)
|