1##############################################################################
2#                                                                            #
3# Makefile.org: default XmHTML makefile.                                     #
4# Adjust at will                                                             #
5#                                                                            #
6##############################################################################
7#                                                                            #
8# (C)Copyright 1995-1997 Ripley Software Development                         #
9# All Rights Reserved                                                        #
10#                                                                            #
11# This file is part of the XmHTML Widget Library.                            #
12#                                                                            #
13# This library is free software; you can redistribute it and/or              #
14# modify it under the terms of the GNU Library General Public                #
15# License as published by the Free Software Foundation; either               #
16# version 2 of the License, or (at your option) any later version.           #
17#                                                                            #
18# This library is distributed in the hope that it will be useful,            #
19# but WITHOUT ANY WARRANTY; without even the implied warranty of             #
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU          #
21# Library General Public License for more details.                           #
22#                                                                            #
23# You should have received a copy of the GNU Library General Public          #
24# License along with this library; if not, write to the Free                 #
25# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.         #
26##############################################################################
27#
28# The defaults in this Makefile are for Linux.
29
30# Don't change these numbers! (only exception: the maintainer of the library if making a new release)
31VERSION = 1110
32ARCHIVE = 1.1.10
33#The SONAME has to be increased when incompatible changes are made to the API.
34#The Versionnumber ( in variables VERSION and ARCHIVE above ) has to start with the SONAME.
35SONAME= libXmHTML.so.1.1
36
37# OS platform
38# OS=Linux
39# OS=IRIX
40
41# Target toolkit
42# Possible choices: Motif, gtk
43# Both targets might require you to adjust the LIBS and LIBDIR directives.
44TOOLKIT=Motif
45
46# XFT-Support?
47ifeq ($(OS),IRIX)
48HAVE_XFT=0
49else
50HAVE_XFT=1
51endif
52
53# XPM-Support
54# If you switch that off, you'll have no builtin icons
55HAVE_XPM=1
56
57# Directories in which to build. If you don't want the examples build,
58# remove the examples directory from this line.
59# If you want to build the XmHTML tutorial examples, add the book directory.
60
61ifeq ($(OS),IRIX)
62SUBDIRS= lib http
63else
64SUBDIRS= lib http
65endif
66
67# some common definitions
68#
69CP    = cp
70RM    = rm -f
71MV    = mv
72LN    = ln -sf
73
74# for building the library.
75AR    = ar cq
76# replace with echo or /bin/true if you system doesn't have/need ranlib
77ifeq ($(OS),IRIX)
78RANLIB = /bin/true
79else
80RANLIB = ranlib
81endif
82
83SHELL = /bin/sh
84#MAKE  = make
85# change this to makedepend if your system doesn't have gcc
86MAKEDEPEND= gccmakedep
87
88
89#####################
90# OS-Specific compiler flags
91#####################
92
93ifeq ($(OS),IRIX)
94OS_CFLAGS	= -O2 -DIRIX_65
95endif
96
97#####################
98#                   #
99# Compiler Settings #
100#                   #
101#####################
102#CC       	= gcc
103#CFLAGS   	= -funroll-loops -Wall -pipe -ansi -fPIC $(OS_CFLAGS) $(EXTRA_CFLAGS)
104#LDFLAGS  	=
105
106# The following flags are *very* usefull if you are getting unresolved
107# references to functions in libraries that you *know* to exist.
108# When used, they cause ld to list its search for libraries, the object
109# files it is considering for linking and a bunch of other information.
110# It helped me to track down an incorrect version of libz that was
111# lingering around in a directory where I never expected it to be.
112# Note: these flags are for gcc!
113# LDFLAGS  = -Wl,-t -Wl,--verbose
114
115# Image Support
116# XPM images (libXpm)                          => -DHAVE_XPM
117# JPEG images (jpeglib.h and libjpeg)          => -DHAVE_LIBJPEG
118# PNG images  (png.h, zlib.h, libz and libpng) => -DHAVE_LIBPNG
119# GZF images  (zlib.h and libz)                => -DHAVE_LIBZ or -DHAVE_LIBPNG
120#
121#
122#
123# You can configure the Progressive Image Loading to use either timeouts or
124# work procedures. The default is to use timeouts (XmHTML will cycle through
125# each image that is to be loaded progressively using a dynamically computed
126# polling interval). If you want XmHTML to use work procedures, you need to
127# define PLC_WORKPROCS
128# The differences between the two methods are:
129# timeouts:  XmHTML is quite responsive to user-input, image loading not
130#            really fast (but neither really slow). Polling interval is
131#            computed dynamically depending on the state of each PLC (suspended
132#            versus active);
133# workprocs: XmHTML not really responsive, image loading quite fast.
134#
135# Dithering: there are two algorithms available that allow XmHTML to construct
136# a default palette if none has been specified.
137# default: the default algorithm constructs an evenly distributed palette in
138#          RGB space but is not always able to match the requested number of
139#          colors and requires a minumum of 8 colors.
140# simple:  this is the alternative, which always creates a palette with the
141#          requested number of colors but does not always succeed in creating
142#          an evenly distributed palette. It is selected by defining
143#          DITHER_SIMPLE_COLORMAP.
144
145IMAGEDEFINES = -DHAVE_LIBJPEG -DHAVE_LIBPNG
146
147ifeq ($(HAVE_XPM),1)
148IMAGEDEFINES += -DHAVE_XPM
149endif
150
151ifeq ($(HAVE_XFT),1)
152XFT_DEFINES = -DHAVE_XFT
153endif
154
155# Header file locations. Add path to xpm.h if it isn't in the X11 include
156# directory. Depending on the selected image support, the compiler needs to
157# be able to find the following header files:
158# HAVE_LIBJPEG => jpeglib.h
159# HAVE_LIBPNG  => png.h and zlib.h
160# HAVE_LIBZ => zlib.h
161
162ZLIBINC       =
163IMAGEINCLUDES = `libpng-config --cflags` -I${LOCALBASE}/include $(ZLIBINC)
164
165# Image libraries
166# No need to add -lXpm if you need to include it with LIBS below
167# Depending on selected image support your linker needs to find the following
168# libraries:
169# HAVE_LIBJPEG => libjpeg
170# HAVE_LIBPNG  => libpng and libz (and possibly libm)
171# HAVE_LIBZ => libz (and possibly libm)
172
173ZLIBLIB   = -lz -lm
174IMAGELIBS = `libpng-config --libs` -L${LOCALBASE}/lib -ljpeg $(LDFLAGS)
175
176# It might be troublesome to know what the correct defines are for your
177# system. A possible set of defines for some OS's is given below. Pick
178# your choice.
179#
180# HPUX:
181# 	-D_HPUX_SOURCE -D_POSIX_SOURCE
182#
183# Linux:
184#	-D_BSD_SOURCE -D_GNU_SOURCE -D_POSIX_SOURCE -DHAVE_REGEX_H
185#
186# AIX 4.1.5:
187#	-DHAVE_STRINGS_H -DHAVE_REGEX_H
188#
189#	(AIX 4.1.5 has str[n]casecmp, but it's defined in strings.h)
190#
191# Unixware 1.1.2
192#	-DNEED_STRCASECMP -DNEED_STRERROR -DSVR4 -DHAVE_MEMCPY
193#
194# Unixware 2.1.1
195#	-DNEED_STRCASECMP -D_POSIX_SOURCE
196#
197# LynxOS
198#	-DNEED_STRCASECMP
199#
200# SCO 3.2
201#	-DNEED_STRCASECMP -D_POSIX_SOURCE
202#
203# If you have dmalloc, you might wish to add -DDMALLOC
204#
205# If your system does not have str[n]casecmp, add -DNEED_STRCASECMP (unixware)
206# If your system does not have strerror, add -DNEED_STRERROR
207# If your system has POSIX regex.h, add -DHAVE_REGEX_H
208#
209# Add -DI18N for internationalization and multilingual support.
210# Add -DPEDANTIC to get warnings about bad html and unsupported features.
211# Add -DDEBUG to enable selective debug output (see the file DEBUGGING for more
212# info).
213#
214CPPFLAGS = -DHAVE_REGEX_H \
215	$(EXTRA_CPPFLAGS) \
216	$(IMAGEDEFINES) \
217	$(XFT_DEFINES)
218
219# Various include directories
220LIBINC=-I. -I../include -I../include/common -I../../include -I../../include/common
221
222# Toolkit specific includes
223ifeq ($(TOOLKIT),Motif)
224ifeq ($(OS),IRIX)
225TOOLKITINC=-I../../include/XmHTML -I/usr/include
226else
227TOOLKITINC=-I../../include/XmHTML `pkg-config --cflags xft`
228endif
229else
230ifeq ($(TOOLKIT),gtk)
231TOOLKITINC=\
232	-I../../include/gtk-xmhtml -I/usr/local/include -I/usr/include/freetype2 \
233	-I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include \
234	-I/usr/include/cairo -I/usr/include/pango-1.0 \
235	-I/usr/lib/gtk-2.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0
236endif
237endif
238
239# include directories
240# If using dmalloc, add the path where the dmalloc.h include file can be
241# found. On my system it's in /usr/local/include
242INCLUDES = $(LIBINC) $(TOOLKITINC) $(IMAGEINCLUDES) $(EXTRA_INCLUDES)
243
244# linker flags
245# Uncomment if you're building libXmHTML with dmalloc support
246# DMALLOCLIB = -ldmalloc
247
248# Motif version (default)
249ifeq ($(TOOLKIT),Motif)
250ifeq ($(OS),IRIX)
251LIBDIR = -L/usr/lib32
252else
253LIBDIR = -L${LOCALBASE}/lib
254endif
255# This is what is required under Linux (Motif 2.0.1).
256# Your mileage may vary.
257LIBS   = -lXm -lXmu -lXt -lXext -lX11 -lSM -lICE
258
259else
260
261# gtk version (only supported port for now)
262ifeq ($(TOOLKIT),gtk)
263
264LIBDIR = -L/usr/local/lib -L
265LIBS   = -lgdk-x11-2.0 -lgtk-x11 -lX11
266
267# endif gtk
268endif
269endif
270
271ifeq ($(HAVE_XPM),1)
272LIBS += -lXpm
273endif
274
275ifeq ($(HAVE_XFT),1)
276LIBS += -lXft -lfontconfig
277endif
278
279# Uncomment if you're building libXmHTML with dmalloc support
280# DMALLOCLIB = -ldmalloc
281
282# final line fed to the linker
283LOADLIBES = $(LIBDIR) $(LIBS) $(IMAGELIBS)
284
285### End of User configurable section ###
286
287pass_flags = SHELL='$(SHELL)' \
288	VERSION='$(VERSION)' \
289	ARCHIVE='$(ARCHIVE)' \
290	SONAME='$(SONAME)' \
291	CC='$(CC)' \
292	RM='$(RM)' \
293	AR='$(AR)' \
294	MV='$(MV)' \
295	CP='$(CP)' \
296	LN='$(LN)' \
297	RANLIB='$(RANLIB)' \
298	MAKEDEPEND='$(MAKEDEPEND)' \
299	CFLAGS='$(CFLAGS)' \
300	LDFLAGS='$(LDFLAGS)' \
301	CPPFLAGS='$(CPPFLAGS) -D$(TOOLKIT)' \
302	INCLUDES='$(INCLUDES)' \
303	LOADLIBES='$(LOADLIBES)' \
304	DMALLOCLIB='$(DMALLOCLIB)' \
305	ZLIBLIB='$(ZLIBLIB)' \
306	TOOLKIT='$(TOOLKIT)'
307
308all::
309	@( for dir in $(SUBDIRS) ; do \
310		(set -x ; cd $$dir ; $(MAKE) all $(pass_flags) ) ; \
311	done)
312
313# Separate rules for all targets
314lib::
315	@(set -x; cd lib; $(MAKE) all $(pass_flags) )
316
317http::
318	@(set -x; cd http; $(MAKE) all $(pass_flags) )
319
320examples::
321	@(set -x; cd lib; $(MAKE) all $(pass_flags) )
322	@(set -x; cd http; $(MAKE) all $(pass_flags) )
323	@(set -x; cd examples; $(MAKE) all $(pass_flags) )
324
325tools::
326	@(set -x; cd http; $(MAKE) all $(pass_flags) )
327	@(set -x; cd tools; $(MAKE) all $(pass_flags) )
328
329contrib::
330	@(set -x; cd lib; $(MAKE) all $(pass_flags) )
331	@(set -x; cd contrib; $(MAKE) all $(pass_flags) )
332
333book::
334	@(set -x; cd lib; $(MAKE) all $(pass_flags) )
335	@(set -x; cd book; $(MAKE) all $(pass_flags) )
336
337# Global target for building everything
338World::
339	$(MAKE) clean
340	$(MAKE) includes
341	$(MAKE) depend
342	$(MAKE) lib
343	$(MAKE) http
344	$(MAKE) examples
345	$(MAKE) tools
346	$(MAKE) book
347
348# Global target for building everything with Imake
349#imake::
350#	xmkmf
351#	$(MAKE) World
352
353depend::
354	@( for dir in $(SUBDIRS) ; do \
355		(set -x ; cd $$dir ; $(MAKE) depend $(pass_flags)) ; \
356	done)
357
358clean::
359	@( for dir in $(SUBDIRS) ; do \
360		(set -x ; cd $$dir ; $(MAKE) clean $(pass_flags) ) ; \
361	done)
362
363distclean::
364	@( for dir in $(SUBDIRS) ; do \
365		(set -x ; cd $$dir ; $(MAKE) distclean $(pass_flags) ) ; \
366	done)
367	@(set -x; cd book; $(MAKE) distclean $(pass_flags) )
368	@(set -x; cd contrib; $(MAKE) distclean $(pass_flags) )
369	$(RM) docs/sources.desc
370	$(RM) core *.out *.log make.world *.bak *.last *.auto *.rej *.orig
371	#$(CP) Makefile.org Makefile
372
373dist:: distclean
374	$(LN) . XmHTML-$(ARCHIVE)
375	tar cvf - XmHTML-$(ARCHIVE)/* | gzip -c > XmHTML-$(ARCHIVE).tar.gz
376
377docs::
378	tools/scansrc.sh ./lib/common > docs/sources.desc
379	tools/scansrc.sh ./lib/Motif >> docs/sources.desc
380	tools/scansrc.sh ./lib/gtk >> docs/sources.desc
381