summaryrefslogtreecommitdiff
path: root/common/Makefile.common
blob: 0820a039c54121cbec6a2e54cf748f1f573d431a (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#### configuration

TOP           = $(shell pwd)
OS            = $(shell uname -s)
BUILD_DATE    = $(shell date "+%Y/%m/%d %H:%M:%S")
BASE          = $(TOP)/../common

LOCALEDIR     = locale
DOC_SRC_FILES = $(wildcard $(LOCALEDIR)/*/*.txt)
LOCALES       = $(foreach locale,$(wildcard $(LOCALEDIR)/*),$(word 2,$(subst /, ,$(locale))))

MAKE_JAR      = VERSION="$(VERSION)" DATE="$(BUILD_DATE)" bash  $(BASE)/make_jar.sh

# TODO: specify source files manually?
JAR_BASES     = $(TOP) $(BASE)
JAR_DIRS      = content skin locale
JAR_TEXTS     = js css dtd xml xul html xhtml
JAR_BINS      = png

JAR           = chrome/$(NAME).jar

XPI_BASES     = $(JAR_BASES) $(TOP)/..
XPI_FILES     = install.rdf TODO AUTHORS Donators NEWS License.txt
XPI_DIRS      = modules components chrome
XPI_TEXTS     = js jsm
XPI_BINS      = jar

XPI_NAME      = $(NAME)_$(VERSION)
XPI_PATH      = ../downloads/$(XPI_NAME)
XPI           = $(XPI_PATH).xpi

RDF           = ../downloads/update.rdf
RDF_IN        = $(RDF).in

BUILD_DIR     = build.$(VERSION).$(OS)

ASCIIDOC = asciidoc
AWK = awk

.SILENT:

#### rules

TARGETS = all help info doc jar xpi install clean distclean $(JAR)
$(TARGETS:%=\%.%):
	echo MAKE $* $(@:$*.%=%)
	$(MAKE) -C $* $(@:$*.%=%)
	echo $$SHELL
.PHONY: $(TARGETS)
all: help

help:
	@echo "$(NAME) $(VERSION) build"
	@echo
	@echo "  make help      - display this help"
	@echo "  make info      - show some info about the system"
	@echo "  make doc       - build doc files"
	@echo "  make jar       - build a JAR ($(JAR))"
	@echo "  make xpi       - build an XPI ($(XPI_NAME))"
	@echo "  make release   - updates update.rdf (this is not for you)"
	@echo "  make clean     - clean up"
	@echo "  make distclean - clean up more"
	@echo
	@echo "running some commands with V=1 will show more build details"

info:
	@echo "version             $(VERSION)"
	@echo "release file        $(XPI)"
	@echo "doc files           $(DOC_SRC_FILES)"
	@echo "xpi files           $(XPI_FILES)"

xpi: $(XPI)
jar: $(JAR)

release: $(XPI) $(RDF)

$(RDF): $(RDF_IN) Makefile
	@echo "Preparing release..."
	$(SED) -e "s,###VERSION###,$(VERSION),g" \
	           -e "s,###DATE###,$(BUILD_DATE),g" \
	           < $< > $@
	@echo "SUCCESS: $@"

clean: $(LOCALES:%=%.clean)
	@echo "General $(NAME) cleanup..."
	rm -f $(JAR) $(XPI)

distclean: $(LOCALES:%=%.distclean) clean
	@echo "More $(NAME) cleanup..."
	rm -rf $(BUILD_DIR)

#### xpi

$(XPI): $(JAR)
	@echo "Building XPI..."
	mkdir -p $(XPI_PATH)
	$(AWK) -v 'name=$(NAME)' -f $(BASE)/process_manifest.awk $(TOP)/chrome.manifest >$(XPI_PATH)/chrome.manifest
	$(MAKE_JAR) "$(XPI)" "$(XPI_BASES)" "$(XPI_DIRS)" "$(XPI_TEXTS)" "$(XPI_BINS)" "$(XPI_FILES)"
	@echo "SUCCESS: $@"

#### jar

$(JAR): doc
	@echo "Building JAR..."
	$(MAKE_JAR) "$(JAR)" "$(JAR_BASES)" "$(JAR_DIRS)" "$(JAR_TEXTS)" "$(JAR_BINS)" "$(JAR_FILES)"
	@echo "SUCCESS: $@"

#### doc (see Makefile.doc)

doc: $(foreach localetgt,$(LOCALES:%=%.doc),$(addprefix $(LOCALEDIR)/,$(localetgt))) ;