docs
[pspp] / doc / doc-make.in
1 # -*- makefile -*-
2 ## PSPP - a program for statistical analysis.
3 ## Copyright (C) 2020 Free Software Foundation, Inc.
4 ##
5 ## This program is free software: you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, either version 3 of the License, or
8 ## (at your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # This makefile is used to generate the artifacts needed by the
19 # user manual.
20
21
22 # In order to get this makefile to work there are several programs
23 # which need to be found on $PATH.  Using debian 10.5 you can install
24 # these with:
25 #  apt-get install xdotool xvfb imagemagick x11-apps
26 # and optionally:
27 #  apt-get install xserver-xephyr
28
29
30 MKDIR_P=%MKDIR_P%
31 top_srcdir=%top_srcdir%
32 abs_builddir=%abs_builddir%
33 src_ui_gui_psppiredir=%src_ui_gui_psppiredir%
34
35 IMAGES=%IMAGES%
36
37 UI_FILES=%UI_FILES%
38
39 all: $(IMAGES)
40
41 ## The ui files must be installed in order for screenshots to succeed
42 installed_ui_files=${subst src/ui/gui,$(src_ui_gui_psppiredir),$(UI_FILES)}
43
44 src/ui/gui/psppire:
45         $(MAKE) -f Makefile $@
46
47 XSERVER?=xvfb
48
49 # Generate a X11 window dump based on a .grab file
50
51 # Default theme for web pages
52 $(top_srcdir)/doc/screenshots/%-ad.xwd: src/ui/gui/psppire $(top_srcdir)/doc/screengrab $(top_srcdir)/doc/screenshots/%.grab $(installed_ui_files)
53         @$(MKDIR_P) ${dir $@}
54         bash ${word 2,$^} --application=$< --topsrcdir=$(top_srcdir) --x-server=$(XSERVER) --theme=Adwaita --payload=${word 3,$^} $@
55
56 # High Contrast theme for printed manuals
57 $(top_srcdir)/doc/screenshots/%-hc.xwd: src/ui/gui/psppire $(top_srcdir)/doc/screengrab $(top_srcdir)/doc/screenshots/%.grab $(installed_ui_files)
58         @$(MKDIR_P) ${dir $@}
59         bash ${word 2,$^} --application=$< --topsrcdir=$(top_srcdir) --x-server=$(XSERVER) --theme=HighContrast --payload=${word 3,$^} $@
60
61 .PRECIOUS: $(top_srcdir)/doc/screenshots/%-ad.xwd $(top_srcdir)/doc/screenshots/%-hc.xwd
62
63
64 %.png: %.xwd
65         convert -strip $< $@
66
67 %.eps: %.xwd
68         convert -strip $< $@,tmp.eps
69         sed -e '/^%%CreationDate: /d' -e '/^%%Title: /s|$(top_srcdir)/||'  $@,tmp.eps > $@
70
71 $(src_ui_gui_psppiredir)/%.ui: $(top_srcdir)/src/ui/gui/%.ui
72         @$(MKDIR_P) ${dir $@}
73         cp $< $@
74
75
76 # Syntax examples
77
78 src/ui/terminal/pspp:
79         $(MAKE) -f Makefile $@
80
81 .PHONY: md5
82 md5:
83         (cd $(top_srcdir)/doc/screenshots; md5sum *.xwd)
84
85 .PHONY: clean
86 clean:
87         $(RM) $(IMAGES)
88         $(RM) $(top_srcdir)/doc/screenshots/*.xwd