1####
2####	Makefile for Ted
3####	================
4####
5####	No explicit 'configure' is needed as it is done by the 'make' process
6####	for the various targets.
7####
8####	Targets for external use are:
9####	-----------------------------
10####
11####	compile:	Just build an executable in the 'Ted' directory.
12####	private:	Install the Ted executable and the most essential
13####			files for yourself only.
14####	package:	Build a package. Must sometimes be run as root.
15####			Use fakeroot to avoid using root privileges.
16####	sysvpkg:	Build a Unix system V (Solaris) package. On
17####			OpenSolaris this can be run through fakeroot.
18####	deb:		Build a Debian package. This is NOT the official
19####			Debian distribution but just a way to produce a
20####			Debian package. (Must be built with fakeroot)
21####	deb-dependencies: Install the dependencied for debian. Must be run
22####			as root.
23####	pet:		Build a Puppy Linux package.
24####	slackpkg:	Build a Slackware Linux installer package
25####	freebsdpkg:	Build a FreeBSD package. (I tried to do something
26####			similar for OpenBSD but I failed to understand the
27####			rather hermetic documentation and procedures.)
28####	tedPackage/arch-PKGBUILD: Building blocks for an arch linux package.
29####			Refer to the instructions in tedPackage/arch-PKGBUILD.in
30####			for details
31####	install:	Install the package. Must be run as root.
32####	clean:		Cleanup rubbish from previous attempts.
33####
34####	compile.shared:	Compile, do not try to link statically.
35####	package.shared:	Build a package, using the dynamically linked
36####			executable.
37####	install.shared:	Install the package. Must be run as root,
38####			or another user with sufficient privileges to
39####			create the directories and files.
40####			Installs the package just made, does not force
41####			the package to be statically linked. This target
42####			only exists for convenience.
43####
44####	Actively supported 'configure' options are:
45####	-------------------------------------------
46####
47####    Please NOTE that you have to 'make clean' after you have
48####    changed the CONFIGURE_OPTIONS.
49####
50####		--prefix		Use another place than /usr
51####					for installation. E.G.
52####					--prefix=/opt/Ted or --prefix=/usr/local
53####		--with-GTK		Use the Gtk+ gui toolkit. (The
54####					default)
55####		--with-MOTIF		Use the Motif gui toolkit. (Preferable
56####					on traditional UNIX systems like
57####					Solaris, AIX, HP/UX)
58####		--without-FONTCONFIG	In older systems, Fontconfig sometimes
59####					is in a state that makes it better
60####					not to use it. This makes it possible
61####					to avoid it even if the software is
62####					found on the machine.
63####		--without-XFT		In older systems, Xft sometimes
64####					is in a state that makes it better
65####					not to use it. This makes it possible
66####					to avoid it even if the software is
67####					found on the machine.
68####
69####
70####	P.S.	To port to Compaq OpenVMS, use the descrip.mms file
71####		It contains an explanatory note as well.
72####
73####	P.S.	I admit that this makefile is more like a shell script.
74####
75
76CONFIGURE_OPTIONS=--with-GTK
77
78compile:	tedlibs		\
79		Ted/Ted		\
80		Ted/Ted.static
81	:
82	: Static executable Ted/Ted.static ready
83	: *   To make an installation package
84	:     you can now run 'make package'. Depending on the platform,
85	:     it might be that this must be done AS ROOT. Try to
86	:     use 'fakeroot' if possible. Otherwise fall back to 'sudo'
87	: *   To install Ted for yourself only
88	:     you can now run 'make private'
89
90compile.shared:	tedlibs		\
91		Ted/Ted
92	:
93	: Dynamic executable Ted/Ted ready
94	: *   To make an installation package
95	:     you can now run 'make package.shared' AS ROOT
96	: *   To install Ted for yourself only
97	:     you can now run 'make private'
98
99####
100####	Make library directory.
101####
102
103lib:
104	mkdir -p lib
105
106####
107####	Build ted libraries
108####
109
110tedlibs: 	lib			\
111		lib/appUtil.a		\
112		lib/textEncoding.a	\
113		lib/utilPs.a		\
114		lib/bitmap.a		\
115		lib/docFont.a		\
116		lib/docBase.a		\
117		lib/docBuf.a		\
118		lib/ind.a		\
119		lib/drawMeta.a		\
120		lib/docRtf.a		\
121		lib/docEdit.a		\
122		lib/docLayout.a		\
123		lib/docHtml.a		\
124		lib/appFrame.a
125
126####
127lib/bitmap.a: bitmap/makefile
128	cd bitmap && $(MAKE)
129
130bitmap/makefile: bitmap/makefile.in Makefile
131	cd bitmap && ./configure $(CONFIGURE_OPTIONS)
132
133####
134lib/docBuf.a: docBuf/makefile
135	cd docBuf && $(MAKE)
136
137docBuf/makefile: docBuf/makefile.in Makefile
138	cd docBuf && ./configure $(CONFIGURE_OPTIONS)
139
140####
141lib/docBase.a: docBase/makefile
142	cd docBase && $(MAKE)
143
144docBase/makefile: docBase/makefile.in Makefile
145	cd docBase && ./configure $(CONFIGURE_OPTIONS)
146
147####
148lib/docHtml.a: docHtml/makefile
149	cd docHtml && $(MAKE)
150
151docHtml/makefile: docHtml/makefile.in Makefile
152	cd docHtml && ./configure $(CONFIGURE_OPTIONS)
153
154####
155lib/docLayout.a: docLayout/makefile
156	cd docLayout && $(MAKE)
157
158docLayout/makefile: docLayout/makefile.in Makefile
159	cd docLayout && ./configure $(CONFIGURE_OPTIONS)
160
161####
162lib/docRtf.a: docRtf/makefile
163	cd docRtf && $(MAKE)
164
165docRtf/makefile: docRtf/makefile.in Makefile
166	cd docRtf && ./configure $(CONFIGURE_OPTIONS)
167
168####
169lib/docEdit.a: docEdit/makefile
170	cd docEdit && $(MAKE)
171
172docEdit/makefile: docEdit/makefile.in Makefile
173	cd docEdit && ./configure $(CONFIGURE_OPTIONS)
174
175####
176lib/ind.a: ind/makefile
177	cd ind && $(MAKE)
178
179ind/makefile: ind/makefile.in Makefile
180	cd ind && ./configure $(CONFIGURE_OPTIONS)
181
182####
183lib/appUtil.a: appUtil/makefile
184	cd appUtil && $(MAKE)
185
186appUtil/makefile: appUtil/makefile.in Makefile
187	cd appUtil && ./configure $(CONFIGURE_OPTIONS)
188
189####
190lib/textEncoding.a: textEncoding/makefile
191	cd textEncoding && $(MAKE)
192
193textEncoding/makefile: textEncoding/makefile.in Makefile
194	cd textEncoding && ./configure $(CONFIGURE_OPTIONS)
195
196####
197lib/utilPs.a: utilPs/makefile
198	cd utilPs && $(MAKE)
199
200utilPs/makefile: utilPs/makefile.in Makefile
201	cd utilPs && ./configure $(CONFIGURE_OPTIONS)
202
203####
204lib/docFont.a: docFont/makefile
205	cd docFont && $(MAKE)
206
207docFont/makefile: docFont/makefile.in Makefile
208	cd docFont && ./configure $(CONFIGURE_OPTIONS)
209
210####
211lib/appFrame.a: appFrame/makefile
212	cd appFrame && $(MAKE)
213
214appFrame/makefile: appFrame/makefile.in Makefile
215	cd appFrame && ./configure $(CONFIGURE_OPTIONS)
216
217####
218lib/drawMeta.a: drawMeta/makefile
219	cd drawMeta && $(MAKE)
220
221drawMeta/makefile: drawMeta/makefile.in Makefile
222	cd drawMeta && ./configure $(CONFIGURE_OPTIONS)
223
224####
225####	Compile and link Ted
226####
227
228Ted/Ted.static: tedlibs Ted/makefile
229	cd Ted && $(MAKE) Ted.static
230
231Ted/Ted: tedlibs Ted/makefile
232	cd Ted && $(MAKE)
233
234Ted/makefile: Ted/makefile.in Makefile
235	cd Ted && ./configure $(CONFIGURE_OPTIONS)
236
237####
238####	Make a ready to install package
239####	Must be run as root (Or with fakeroot)
240####
241
242package: compile tedPackage/makefile
243	cd tedPackage && $(MAKE)
244	:
245	: Package ready.
246	: To install Ted, you can now run 'make install' AS ROOT
247
248package.shared: compile.shared tedPackage/makefile
249	cd tedPackage && make package.shared
250	:
251	: Dynamically linked package ready.
252	: To install Ted, you can now run 'make install' AS ROOT
253
254tedPackage/makefile: tedPackage/makefile.in Makefile
255	cd tedPackage && ./configure $(CONFIGURE_OPTIONS)
256
257sysvpkg: compile tedPackage/makefile
258	cd tedPackage && $(MAKE) $@
259	:
260	: UNIX system V Package ready.
261	@echo : To install Ted run '(AS ROOT)': pkgadd -d tedPackage/*.pkg
262
263deb-dependencies:
264	apt-get install `grep '^Build-Depends:' tedPackage/debian-control.in | sed -e 's/^Build-Depends://' -e 's/, */ /g'`
265
266deb: compile tedPackage/makefile
267	cd tedPackage && $(MAKE) $@
268	:
269	: Debian Package ready.
270	@echo : To install Ted use: sudo dpkg -i tedPackage/*.deb
271
272pet: compile tedPackage/makefile
273	cd tedPackage && $(MAKE) $@
274	:
275	: Puppy Package ready.
276	@echo : To install Ted use: "cd tedPackage && petget `basename tedPackage/*.pet`"
277
278slackpkg: compile tedPackage/makefile
279	cd tedPackage && $(MAKE) $@
280	:
281	: Slackware Linux Package ready.
282	@echo : To install Ted use: sudo installpkg tedPackage/*-1mdd.tgz
283
284freebsdpkg: compile tedPackage/makefile
285	cd tedPackage && $(MAKE) $@
286	:
287	: FreeBSD Package ready.
288	@echo : To install Ted run '(AS ROOT)': pkg_add tedPackage/*.freebsdpkg.tgz
289
290tedPackage/arch-PKGBUILD: tedPackage/makefile
291	cd tedPackage && make arch-PKGBUILD
292
293####
294####	Install Ted from the package just built
295####
296
297install: package
298	( cd tedPackage && make install )
299
300install.shared: package.shared
301	( cd tedPackage && make install )
302
303####
304####	Install Ted for yourself
305####
306
307private: compile tedPackage/makefile
308	( cd tedPackage && make private )
309
310####
311####	Cleanup
312####
313
314clean:
315	rm -fr	lib
316	rm -f	*/config.cache */config.log */config.status */confdefs.h
317	rm -fr	*/autom4te.cache
318	rm -f	*/*Config.h
319	rm -f	*/makefile
320	rm -f	*/*.o
321	rm -f	Ted/Ted Ted/Ted.static
322	rm -fr	tedPackage/scratch
323	rm -f	tedPackage/*.gz
324	rm -f	tedPackage/*.lsm
325	rm -f	tedPackage/*.deb
326	rm -f	tedPackage/*.pkg
327	rm -f	tedPackage/*.xz
328	rm -f	tedPackage/*.pet
329	rm -f	tedPackage/README
330	rm -f	tedPackage/arch-PKGBUILD
331	rm -f	tedPackage/package
332	rm -f	tedPackage/package.shared
333
334