summaryrefslogtreecommitdiff
path: root/manual/Makefile
blob: e1d3c1fb8103099388a3d9e683ebf275939ab788 (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
#             __________               __   ___.
#   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
#   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
#   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
#   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
#                     \/            \/     \/    \/            \/
# $Id$
#

ifndef V
SILENT=@
endif

# Needed to build the features list.
INCLUDES= $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR)	\
 -I$(BUILDDIR)/bitmaps -I$(OBJDIR)

.PHONY: all buildmanual clean objdir-check
MANFILE := rockbox-build

VERSION ?= $(shell $(TOOLSDIR)/version.sh $(ROOTDIR))

.PHONY: $(OBJDIR)/version.tex $(OBJDIR)/$(MANFILE).tex

all: manual-pdf 

features: $(OBJDIR)/features.tex

objdir-check:
	@if [ "$(OBJDIR)" = "" ]; then echo Run make in you build directory!; false; fi


manual-prep: objdir-check rockbox.tex $(OBJDIR)/CREDITS.tex $(OBJDIR)/version.tex $(OBJDIR)/$(MANFILE).tex
	$(SILENT)mkdir -p $(OBJDIR)
	$(SILENT)find * -type d \! -regex '.*\.svn.*' -exec mkdir -p $(OBJDIR)/{} \;
	$(SILENT)find -L * -type f \! -regex '.*\.svn.*' -exec cp {} $(OBJDIR)/{} \;
	$(SILENT)mv $(OBJDIR)/Makefile.pdflatex $(OBJDIR)/Makefile

$(OBJDIR)/$(MANFILE).tex:
	@echo "creating $(notdir $@)"
	$(SILENT)printf "\\\\newcommand{\\\\platform}{${MANUALDEV}}\n" > $@
	$(SILENT)printf "\\\\newcommand{\\\\buildversion}{$(VERSION)}\n" >> $@
	$(SILENT)printf "\\\\input{rockbox.tex}\n" >> $@

$(OBJDIR)/CREDITS.tex: $(DOCSDIR)/CREDITS
	@echo "processing $(notdir $^)"
	$(SILENT)mkdir -p $(OBJDIR)
	$(SILENT)perl credits.pl < $(DOCSDIR)/CREDITS  > $@

$(OBJDIR)/version.tex:
	@echo "creating $(notdir $@)"
	$(SILENT)mkdir -p $(OBJDIR)
	$(SILENT)printf "%s%%" $(VERSION) > $@

$(OBJDIR)/features.tex: $(ROOTDIR)/apps/features.txt
	@echo "processing $(notdir $^)"
	$(SILENT)mkdir -p $(OBJDIR)
	$(SILENT)mkdir -p `dirname $@`
	$(SILENT) for f in \
	    $$(cat $< | $(HOSTCC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \
	       $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -imacros "config.h" \
	       -imacros "button.h" - | grep -v "^\#" | grep -v "^$$"); \
	    do feat="$$feat\\n\\\\edef\\\\UseOption{\\\\UseOption,$$f}"; done ; \
	printf "$$feat" > $@

manual-pdf: objdir-check features manual-prep rockbox.tex
	$(SILENT)$(MAKE) -C $(OBJDIR) buildmanual

manual-html: objdir-check features manual-prep rockbox.tex
	$(SILENT)$(MAKE) -C $(OBJDIR) buildhtml

manual-txt: manual-html
	$(SILENT)$(MAKE) -C $(OBJDIR) buildtxt

manual-txt-zip: manual-txt
	$(SILENT)$(MAKE) -C $(OBJDIR) txtzip

manual-zip: manual-html
	$(SILENT)$(MAKE) -C $(OBJDIR) htmlzip

clean: objdir-check
	$(SILENT)rm -rf $(OBJDIR)/manual $(OBJDIR)/*.pdf
	$(SILENT)rm -rf $(OBJDIR)/html $(OBJDIR)/txt