This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
78 lines (58 loc) · 2.35 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
version := 0.3.1
ifeq ($(TOPSRCDIR),)
export TOPSRCDIR = $(shell pwd)
endif
srcdir=$(TOPSRCDIR)/extensions/firefox-share/src/
objdir=$(TOPSRCDIR)/extensions/firefox-share/dist/
stage_dir=$(objdir)/stage
xpi_dir=$(TOPSRCDIR)/web/dev
web_dir=$(TOPSRCDIR)/web/dev
static_dir=$(TOPSRCDIR)/web/$(version)
webbuild_dir=$(TOPSRCDIR)/tools/webbuild
requirejs_dir=$(webbuild_dir)/requirejs
xpi_name := ffshare.xpi
xpi_files := chrome.manifest chrome install.rdf defaults modules
dep_files := Makefile $(shell find $(srcdir) -type f)
SLINK = ln -sf
ifneq ($(findstring MINGW,$(shell uname -s)),)
SLINK = cp -r
export NO_SYMLINK = 1
endif
all: xpi
xpi: $(xpi_dir)/$(xpi_name)
$(xpi_dir):
mkdir -p $(xpi_dir)
stage_files = $(stage_dir)/defaults $(stage_dir)/chrome $(stage_dir)/install.rdf $(stage_dir)/chrome.manifest $(stage_dir)/modules
$(stage_dir):
mkdir -p $(stage_dir)
$(MAKE) $(stage_files)
$(stage_dir)/chrome.manifest: $(srcdir)/chrome.manifest
$(SLINK) $(srcdir)/chrome.manifest $(stage_dir)/chrome.manifest
$(stage_dir)/install.rdf: $(srcdir)/install.rdf
$(SLINK) $(srcdir)/install.rdf $(stage_dir)/install.rdf
$(stage_dir)/chrome: $(srcdir)/chrome
$(SLINK) $(srcdir)/chrome $(stage_dir)/chrome
$(stage_dir)/modules: $(srcdir)/modules
$(SLINK) $(srcdir)/modules $(stage_dir)/modules
$(stage_dir)/defaults: $(srcdir)/defaults
$(SLINK) $(srcdir)/defaults $(stage_dir)/defaults
$(xpi_dir)/$(xpi_name): $(xpi_dir) $(stage_dir) $(dep_files)
rm -f $(xpi_dir)/$(xpi_name)
cd $(stage_dir) && zip -9r $(xpi_name) $(xpi_files)
mv $(stage_dir)/$(xpi_name) $(xpi_dir)/$(xpi_name)
web: $(static_dir)
$(static_dir):
rsync -av $(web_dir)/ $(static_dir)/
perl -i -pe "s:VERSION='[^']+':VERSION='$(version)':" $(TOPSRCDIR)/setup.py
perl -i -pe 's:/dev/auth.html:/$(version)/auth.html:go' $(TOPSRCDIR)/staging.ini
perl -i -pe 's:/dev/auth.html:/$(version)/auth.html:go' $(TOPSRCDIR)/production.ini
find $(static_dir) -name \*.html | xargs perl -i -pe 's:/dev/:/$(version)/:go'
perl -i -pe 's:/dev/:/$(version)/:go' $(static_dir)/scripts/oauth.js
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
cd $(static_dir)/share/panel && $(requirejs_dir)/build/build.sh build.js
clean:
rm -rf $(objdir)
rm -rf $(static_dir)
.PHONY: xpi clean