summaryrefslogtreecommitdiff
path: root/Makefile
blob: d7fe945a60380f3af123649bb999db5c38cb4821 (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
PRODUCT=Hosted Kolab
VERSION=2.2.4

BUILD_FORMATS="pdf html html-single"
BUILD_LANGS="en-US"

SRCDIR	:=$(shell pwd)

all: clean
	@mkdir builds
	@sed -i -r \
		-e 's|ENTITY PRODUCT_VERSION "([\.0-9]+)"|ENTITY PRODUCT_VERSION "$(VERSION)"|g' \
		-e 's|productnumber>([\.0-9]+)</productnumber|productnumber>$(VERSION)</productnumber|g' \
		`find -type f -name "Book_Info.xml" -or -name "*.ent"`
	for dir in `find -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sort`; do \
		if [ -f "$$dir/publican.cfg" ]; then \
			cd $$dir; \
			publican build \
				--formats=$(shell echo $(BUILD_FORMATS) | sed -e 's/ /,/g' -e 's/"//g') \
				--langs=$(shell echo $(BUILD_LANGS) | sed -e 's/ /,/g' -e 's/"//g') \
					|| exit 1; \
			for build in `find tmp/ -mindepth 2 -maxdepth 2 -type d | sort`; do \
				[ "`basename $$build`" == "xml" ] && continue; \
				[ "`basename $$build`" == "xml_tmp" ] && continue; \
				lang=`echo $$build | awk -F'/' '{print $$2}'`; \
				format=`echo $$build | awk -F'/' '{print $$3}'`; \
				cp -a $$build $(SRCDIR)/builds/$(PRODUCT)-$(VERSION)-$$dir-$$lang.$$format; \
			done; \
			cd ../; \
		fi; \
	done

clean:
	@rm -rf builds
	@for dir in `ls -d */`; do \
		if [ -f "$$dir/publican.cfg" ]; then \
			cd $$dir; \
			publican clean; \
			cd ../; \
		fi; \
	done