source: trunk/manual/airboot-manual.gmk@ 242

Last change on this file since 242 was 207, checked in by Ben Rietbroek, 8 years ago

Added the build-files for the Manual [v1.1.1-testing]

Note the 'fc.mnu' file which contains a detailed build-menu.
Pressing F2 from within file-commander in the 'manual' directory will
present this build-menu.

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.0-manual.pdf

File size: 10.4 KB
Line 
1###############################################################################
2# airboot-manual.gmk :: Create the airboot.inf OS/2 Help File #
3# --------------------------------------------------------------------------- #
4# The manual itself is maintained with Apache Open Office Writer for OS/2. #
5# This implies the Open Document Format, which in turn implies ZIP compressed #
6# files. With ODF, the content and markup is separated, so it is possible to #
7# get the structure and content of the ODF-document use that as the base for #
8# a Manual in the familiar OS/2 INF format that can be read with (New) View. #
9# #
10# This Makefile extracts the 'content.xml' and uses XSLT to create an IPF #
11# source 'airboot.ipf'. This is then compiled with 'wipfc' to create the #
12# 'airboot.inf' file. #
13# #
14###############################################################################
15gnumake.project.name := airboot-manual
16gnumake.project.target := default
17gnumake.project.uuid := a84e63e6-8929-11e7-ac7d-dfa0c5e47662
18
19# Get the name of this Makefile
20SELF:=$(lastword $(MAKEFILE_LIST))
21
22# Delegate to target 'default' which can specify more than one dependency
23.DEFAULT_GOAL:=$(gnumake.project.target)
24
25#
26# Global Variables
27#
28doctitle=AiR-BOOT User Manual
29toclevels=123
30infname=airboot.inf
31basename=airboot-manual
32odt.docin=$(basename).odt
33explode.dir=$(odt.docin:odt=odtx)
34imgdirprefix=$(explode.dir)
35transform.sheet=odt2ipf.xsl
36
37# =============================================================================
38# Virtual default target using dependency to invoke other targets
39# =============================================================================
40default: info
41#~ default: all
42#~ default: build
43#~ default: rebuild
44#~ default: package
45#~ default: clean
46
47# =============================================================================
48# Show information about this sub-project
49# =============================================================================
50info:
51 $(info )
52 $(info [$@])
53 @less $(gnumake.project.name).info
54 @echo
55
56# =============================================================================
57# Build everything
58# -----------------------------------------------------------------------------
59# When building everything, we want to exclude side effects of incremental
60# actions. So we delegate to 'rebuild' which does a clean first.
61# =============================================================================
62all: rebuild
63
64# =============================================================================
65# Perform all steps to create the AiR-BOOT Manual (incremental)
66# =============================================================================
67build::
68 $(info )
69 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
70 $(info :: BUILDING AiR-BOOT MANUAL ::)
71 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
72build:: inf.create
73 $(info )
74 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
75 $(info :: BUILDING AiR-BOOT MANUAL FINISHED ::)
76 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
77
78# =============================================================================
79# Perform all steps to create the AiR-BOOT Manual
80# =============================================================================
81rebuild::
82 $(info )
83 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
84 $(info :: COMPLETELY REBUILDING AiR-BOOT MANUAL ::)
85 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
86rebuild:: clean build
87
88# =============================================================================
89# Reconstruct the AiR-BOOT Manual from the Exploded Directory
90# =============================================================================
91reconstruct::
92 $(info )
93 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
94 $(info :: RECONSTRUCTING THE AiR-BOOT OPEN-OFFICE DOCUMENT FOR EDITING ::)
95 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
96reconstruct::
97 rm -f -v reconstructed.odt
98 bash -c "cd $(explode.dir) && rm -f Pictures/*.bmp && zip -r ../reconstructed.odt . && cd -"
99
100
101# =============================================================================
102# Clean all generated files
103# =============================================================================
104clean::
105 $(info )
106 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
107 $(info :: REMOVING ALL GENERATED FILES ::)
108 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
109clean::
110 $(info )
111 $(info [$@])
112 @rm -r -f -v $(explode.dir)
113 @rm -f -v $(basename).ipf $(basename).inf
114 @rm -f -v content.xml styles.xml meta.xml
115
116
117
118#~ .SECONDEXPANSION:
119
120# =============================================================================
121# Explode the Open Office Writer document
122# =============================================================================
123odt.explode: $(explode.dir)/content.xml
124 $(info )
125 $(info [$@] -- [$?])
126
127# =============================================================================
128# Virtual target to translate ODT to IPF using XSLT
129# =============================================================================
130ipf.create: $(basename).ipf
131 $(info )
132 $(info [$@] -- [$?])
133
134# =============================================================================
135# Convert the extracted PNG images to OS/2 BMP format
136# -----------------------------------------------------------------------------
137# OpenOffice uses the PNG format for embedded images, which are present in the
138# 'Pictures' directory of the exploded ODT document. The OS/2 INF format can
139# only handle the OS/2 BMP format, so we convert to PNG images to OS/2 BMP.
140# This is done using 'gbmconv' from the GBM imaging tools.
141#
142# When the ODT is not yet exploded, there are no images yet, so things like
143# $(wildcard) cannot be used because it would return an empty set. So it is not
144# directly possible to have the images as dependencies because all macros are
145# evaluated before they are present.
146#
147# To solve this, this 'png.convert' is recursively invoked from the target that
148# explodes the ODT. Now the images are present and $(wildcard) can be used as
149# a dependency to invoke the PNG => BMP conversion rule.
150# =============================================================================
151png.convert::
152 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
153 $(info :: CONVERTING PNG IMAGES TO OS/2 BMP FORMAT ::)
154 $(info :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
155png.convert:: $(patsubst %.png,%.png.bmp,$(wildcard $(explode.dir)/Pictures/*.png))
156
157
158# =============================================================================
159# Virtual target for INF file creation
160# =============================================================================
161inf.create: $(basename).inf
162 $(info )
163 $(info [$@] -- [$?])
164
165# -----------------------------------------------------------------------------
166# Local formatted copy -- forces explode
167# -----------------------------------------------------------------------------
168meta.xml: $(explode.dir)/meta.xml $(odt.docin)
169 $(info )
170 $(info [$@] -- [$?])
171 cat $(explode.dir)/$@ | xsltproc format.xsl - > $@
172
173# -----------------------------------------------------------------------------
174# Local formatted copy -- forces explode
175# -----------------------------------------------------------------------------
176styles.xml: $(explode.dir)/styles.xml $(odt.docin)
177 $(info )
178 $(info [$@] -- [$?])
179 cat $(explode.dir)/$@ | xsltproc format.xsl - > $@
180
181# -----------------------------------------------------------------------------
182# Local formatted copy -- forces explode
183# -----------------------------------------------------------------------------
184content.xml: $(explode.dir)/content.xml $(odt.docin) styles.xml meta.xml
185 $(info )
186 $(info [$@] -- [$?])
187 cat $(explode.dir)/$@ | xsltproc format.xsl - > $@
188
189# -----------------------------------------------------------------------------
190# Explode the OpenOffice document to a directory -- also converts PNG => BMP
191# -----------------------------------------------------------------------------
192$(explode.dir)/content.xml: $(odt.docin)
193 $(info )
194 $(info [$@] -- [$?])
195 unzip -o $(odt.docin) -d $(explode.dir)
196 $(MAKE) -f $(SELF) png.convert
197 touch -r $< $@
198 @cp -a $< $<.bu
199
200# -----------------------------------------------------------------------------
201# Translate the content of the ODT file to IPF using XSLT
202# -----------------------------------------------------------------------------
203$(basename).ipf:
204$(basename).ipf: $(explode.dir)/content.xml $(transform.sheet) content.xml
205 $(info )
206 $(info [$@] -- [$?])
207#~ cat $< | xsltproc $(transform.sheet) - > $@
208 xsltproc \
209 --stringparam basename "$(basename)" \
210 --stringparam doctitle "$(doctitle)" \
211 --stringparam toclevels "$(toclevels)" \
212 --stringparam imgdirprefix "$(imgdirprefix)" \
213 --stringparam default-font "WarpSans" \
214 $(transform.sheet) $< > $@
215
216# -----------------------------------------------------------------------------
217# Create the AiR-BOOT Manual in INF format
218# -----------------------------------------------------------------------------
219$(basename).inf: $(basename).ipf
220 $(info )
221 $(info [$@] -- [$?])
222 $(call owc.env)
223 wipfc -q -i $< -o $@
224 cp -a $@ $(infname)
225
226
227# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
228# Rule to convert PNG images to OS/2 BMP format
229# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
230%.png.bmp: %.png
231ifdef OS2_SHELL
232 $(info $(notdir $<) => $(notdir $@))
233 @gbmconv $< $@
234else
235 $(info $(notdir $<) => $(notdir $@))
236 @./gbmconv $< $@
237endif
238
239#
240# Open Watcom Environment (Linux)
241#
242ifndef OS2_SHELL
243define owc.env
244$(call owc19.env)
245endef
246define owc19.env
247$(eval export WATCOM:=/vol/devtools/owc19)
248$(eval export PATH:=$(WATCOM)/binl:$(PATH))
249$(eval export INCLUDE:=$(WATCOM)/lh:$(INCLUDE))
250$(eval export EDPATH:=$(WATCOM)/eddat)
251$(eval export WIPFC:=$(WATCOM)/wipfc)
252$(eval CC=owcc)
253endef
254endif
Note: See TracBrowser for help on using the repository browser.