1###########################################################################
2#    Copyright (c) 1991 - 1994 Heinz W. Werntges.  All rights reserved.
3#    Distributed by Free Software Foundation, Inc.
4#
5# This file is part of HP2xx.
6#
7# HP2xx is distributed in the hope that it will be useful, but
8# WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
9# to anyone for the consequences of using it or for whether it serves any
10# particular purpose or works at all, unless he says so in writing.  Refer
11# to the GNU General Public License, Version 2 or later, for full details
12#
13# Everyone is granted permission to copy, modify and redistribute
14# HP2xx, but only under the conditions described in the GNU General Public
15# License.  A copy of this license is supposed to have been
16# given to you along with HP2xx so you can know your rights and
17# responsibilities.  It should be in a file named COPYING.  Among other
18# things, the copyright notice and this notice must be preserved on all
19# copies.
20###########################################################################
21#
22# Generic Makefile for misc. versions of hp2xx; strong emphasis on UNIXes
23#
24
25# Utilities etc.:
26#
27SHELL    = /bin/sh
28
29CHMOD    = chmod
30CP       = cp
31MKINFO   = makeinfo
32RMCMD    = rm -f
33STRIP    = strip
34
35# Installation sites (GNU conventions):
36#
37prefix   = /usr/local
38bindir   = $(prefix)/bin
39includedir = $(prefix)/include
40mandir   = $(prefix)/man
41man1dir  = $(mandir)/man1
42infodir  = $(prefix)/info
43
44# CC and CFLAGS set for gcc, but any ANSI-C compiler should work.
45# For non-gcc compilers, simply set CFLAGS = -O (to start with)
46#
47CC       = gcc
48CFLAGS   = -O2 -Wall -finline-functions
49
50LFLAGS   =                # only sometimes needed; see below for examples
51CPPFLAGS = -I.            # only sometimes needed; see below for examples
52BINDCMD  =                # only needed for EMX and DJGPP DOS extenders
53
54
55
56#############################################################################
57# MAIN CONFIGURATION TASK:
58# Define the target machine / OS by uncommenting the appropriate lines below.
59# Remember to comment-out the defaults (a) if they do not apply!
60#
61# Generic UNIX + X11 previewer (default)
62#
63DEFINES   = -DUNIX -DHAS_UNIX_X11
64PREVIEWER = to_x11
65ALL_LIBS  = -lX11 -lm     #  Maybe -lX instead of -lX11 is needed?
66#
67# Generic UNIX, no previewer
68#
69# DEFINES   = -DUNIX
70# PREVIEWER = no_prev
71# ALL_LIBS  = -lm
72#
73# use something like this for experimental truetype font support
74#
75#DEFINES   = -DUNIX -DHAS_UNIX_X11 \
76# -DSTROKED_FONTS=\"/usr/X11R6/lib/X11/fonts/truetype/VeraMono.ttf\" `freetype-config --cflags`
77#ALL_LIBS  = `freetype-config --libs` -L/usr/lib/X11R6 -lX11 -lm
78#
79# HP-UX, CC compiler
80#
81# CC = cc
82# CFLAGS   = +O1 -Aa -D_HPUX_SOURCE -DSYSV -I/usr/include/X11R5 -I/usr/include/X11R4 $(DEFINES) $(EX_DEFS)
83# DEFINES = -DUNIX -DHAS_UNIX_X11
84# PREVIEWER = to_x11
85#
86# Convex-OS
87#
88# DEFINES   = -DUNIX -DHAS_UNIX_X11
89# PREVIEWER = to_x11
90# ALL_LIBS  = -lX11 -lm
91# CC        = cc
92# CFLAGS    = -O
93#
94# SGI IRIX 6.5 with tiff and png support (declare EX_SRC.. below)
95# CC=cc
96# CFLAGS = -O -I/usr/freeware/include $(DEFINES) $(EX_DEFS)
97# LFLAGS = -L/usr/freeware/lib32
98# CPPFLAGS = -I/usr/freeware/include
99# DEFINES = -DUNIX -DHAS_UNIX_X11
100# PREVIEWER = to_x11
101# ALL_LIBS = -L/usr/lib/X11R6 -lX11 -lm -lpng -lz -ltiff
102#
103# Solaris /SunOS >5.x
104# LFLAGS    = -L$(OPENWINHOME)/lib -R$(OPENWINHOME)/lib
105# CPPFLAGS  = -I$(OPENWINHOME)/include
106# DEFINES   = -DUNIX -DHAS_UNIX_X11
107# PREVIEWER = to_x11
108# ALL_LIBS  = -lX11 -lm -lnsl -lsocket
109#
110# older SunOS + X11 previewer
111#
112# LFLAGS    = -L$(OPENWINHOME)/lib
113# CPPFLAGS  = -I$(OPENWINHOME)/include
114# DEFINES   = -DUNIX -DHAS_UNIX_X11
115# PREVIEWER = to_x11
116# ALL_LIBS  = -lX11 -lm
117#
118# SunOS + Sunview previewer
119#
120# DEFINES   = -DUNIX -DHAS_UNIX_SUNVIEW
121# PREVIEWER = to_sunvw
122# ALL_LIBS  = -lsunwindow -lsuntool -lpixrect -lm
123#
124# OS/2 2.x + PM previewer, gcc/emx
125#
126# SHELL     =
127# DEFINES   = -DOS2 -DHAS_OS2_PM
128# PREVIEWER = to_pm
129# ALL_LIBS  = -los2 -lm
130# BINDCMD   = emxbind -p c:/emx/bin/emxl.exe $(PROGRAM)
131#
132# OS/2 2.x + EMX full-screen previewer
133#
134# SHELL     =
135# DEFINES   = -DOS2 -DHAS_OS2_EMX
136# PREVIEWER = to_os2
137# ALL_LIBS  = -los2 -lm
138# BINDCMD   = emxbind -f c:/emx/bin/emxl.exe $(PROGRAM) -ac
139#
140#
141#--------------------------------------------------------------------------
142# Below find *fragments* of how to augment this makefile for other systems.
143# Note that I simply collected all definitions I am currently aware of,
144# but that this collection is still subject to change.
145#
146# You are welcome to improve it!
147#
148# Note also that most of the systems listed below are already supported
149# by special makefiles, though I'd like to make these obsolete by a
150# future version of this file. Currently, use the special makefile!
151#
152# I could not test the settings below, lacking a well-behaved DOS make.exe:
153# DOS/DJGPP + DJ previewer		# Use dosdjgpp.mak !
154#
155# DEFINES   = -DDOS -DGNU -DHAS_DOS_DJGR
156# PREVIEWER = to_dj_gr
157# ALL_LIBS  = -lgr -lm
158# BINDCMD   = copy /b c:\djgpp\bin\stub.exe+$(PROGRAM) $(PROGRAM).exe
159#
160# DOS / Borland bcc			# Use borland.mak !
161#
162# DEFINES   = -DDOS -DHAS_DOS_VGA
163# PREVIEWER = to_vga
164# ALL_LIBS  = -lm
165#
166# DOS / Borland bcc and Hercules previwer	# Patch and use borland.mak !
167#
168# DEFINES   = -DDOS -DHAS_DOS_HGC
169# PREVIEWER = to_hgc
170# ALL_LIBS  = -lm
171#
172# ATARI ST/TT
173#
174# DEFINES   = -DATARI			# Use atari.mak !
175# PREVIEWER = to_atari
176# ALL_LIBS  = -lm 	# Add whatever may be needed for Ataris
177#
178# AMIGA
179#
180# DEFINES   = -DAMIGA			# Use amiga.mak !
181# PREVIEWER = to_amiga
182# ALL_LIBS  = -lm 	# Add whatever may be needed for Amigas
183#
184# VAX/VMS	# Use VMS-MAKE.COM !
185#
186# DEFINES   = -DVAX
187# PREVIEWER = to_uis
188# ALL_LIBS  = -lm 	# Add whatever may be needed for VMS
189#
190#############################################################################
191# Decide below if you want to include some extra modes:
192#	Recommendation: Add PIC & PAC only for ATARI
193#
194# Standard setting: No extras:
195EX_SRC	=
196EX_OBJ	=
197EX_DEFS	=
198#
199# PNG support (requires -lpng and -lz on the ALL_LIBS line)
200#EX_SRC	= png.c to_png.c
201#EX_OBJ	= png.o to_png.o
202#EX_DEFS= -DPNG
203#
204# TIFF support (requires -ltiff and possibly -lz on the ALL_LIBS line)
205#EX_SRC	= to_tif.c
206#EX_OBJ	= to_tif.o
207#EX_DEFS	= -DTIF
208#
209# JPEG support (requires -ljpeg)
210#EX_SRC = to_jpg.c
211#EX_OBJ = to_jpg.o
212#EX_DEFS = -DJPG
213#
214# PDF support (requires -lpdf)
215#EX_SRC = to_pdf.c
216#EX_OBJ = to_pdf.o
217#EX_DEFS = -DUSEPDF
218#
219# Include extras:
220# EX_SRC	= to_pic.c to_pac.c
221# EX_OBJ	= to_pic.o to_pac.o
222# EX_DEFS	= -DPIC_PAC
223#
224#############################################################################
225# No user-serviceable parts below!
226#############################################################################
227
228COMMON_INCS	= hp2xx.h bresnham.h murphy.h pendef.h lindef.h
229ALL_INCS	= $(COMMON_INCS) chardraw.h charset0.h getopt.h x11.h ilbm.h iff.h
230ALL_CFLAGS	= -c $(CFLAGS)
231
232
233# $(SRCS) NOT USED YET:
234SRCS	= hp2xx.c hpgl.c picbuf.c bresnham.c chardraw.c getopt.c getopt1.c \
235	  $(ALL_INCS)\
236	  to_vec.c to_pcx.c to_pcl.c to_eps.c to_img.c to_pbm.c to_rgip.c \
237	  std_main.c to_fig.c clip.c fillpoly.c pendef.c lindef.c murphy.c \
238	  $(PREVIEWER).c $(EX_SRC)
239
240OBJS	= hp2xx.o hpgl.o picbuf.o bresnham.o chardraw.o getopt.o getopt1.o \
241	  to_vec.o to_pcx.o to_pcl.o to_eps.o to_img.o to_pbm.o to_rgip.o \
242	  std_main.o to_fig.o clip.o fillpoly.o pendef.o lindef.o murphy.o \
243	  $(PREVIEWER).o $(EX_OBJ)
244
245PROGRAM	= hp2xx
246
247default:
248	@echo "This makefile needs manual configuration! Edit it now!
249	@echo "After configuration, you may use the following commands:
250	@echo   ""
251	@echo   "make all             Compile everything"
252	@echo   "make check           Run a color application in preview mode"
253	@echo   "make install-bin     Install the binary file"
254	@echo   "make install-man     Install the manual page"
255	@echo   "make install-info    Create and install the info file"
256	@echo   "make install         Install everything"
257	@echo   "make mostlyclean"
258	@echo   "make clean"
259	@echo   "make realclean"
260
261
262
263#########################################################################
264#									#
265# 			Implicit Rules					#
266#									#
267#########################################################################
268
269all: $(OBJS)
270	$(CC) $(LFLAGS) $(OBJS) $(ALL_LIBS) -o $(PROGRAM)
271	$(BINDCMD)
272
273
274.c.o:	$< $(COMMON_INCS)
275	-$(RMCMD) $@
276	$(CC) $(DEFINES) $(EX_DEFS) $(ALL_CFLAGS) $(CPPFLAGS) $<
277
278
279#########################################################################
280#									#
281# 			Explicit Rules					#
282#									#
283#########################################################################
284
285hp2xx.info:	../doc/hp2xxinf.tex
286		$(CP) ../doc/hp2xxinf.tex hp2xx.texinfo
287		$(MKINFO) hp2xx.texinfo
288
289bresnham.o:	$< bresnham.h
290
291murphy.o:	$< murphy.h
292
293chardraw.o:	$< $(COMMON_INCS) chardraw.h charset0.h
294
295getopt.o:	$< getopt.h
296
297getopt1.o:	$< getopt.h
298
299hp2xx.o:	$< $(COMMON_INCS) getopt.h
300
301hpgl.o:		$< $(COMMON_INCS) chardraw.h
302
303ilbm.o:		$< $(COMMON_INCS) ilbm.h iff.h
304
305to_x11.o:	$< $(COMMON_INCS) x11.h
306
307#########################################################################
308
309check:
310	./$(PROGRAM) -m pre -c1234567 -h150 -w150 ../hp-tests/colors.hp
311
312clean:
313	-make mostlyclean
314	-$(RMCMD) core a.out ./hp2xx.texinfo ./hp2xx.info
315
316distclean:
317	@echo make distclean -- not supported yet.
318
319dist:
320	@echo make dist -- not supported yet.
321
322mostlyclean:
323	-$(RMCMD) *.o
324
325realclean:
326	-make clean
327	-$(RMCMD) $(PROGRAM)
328
329TAGS:
330	@echo make TAGS -- not supported nor needed.
331
332install:	install-bin install-info install-man
333
334install-bin:	$(PROGRAM)
335		-$(STRIP) $(PROGRAM)
336		$(CP) $(PROGRAM) $(bindir)
337		$(CHMOD) 755 $(bindir)/$(PROGRAM)
338
339install-info:	hp2xx.info
340		$(CP) hp2xx.info $(infodir)
341		$(CHMOD) 644 $(infodir)/hp2xx.info
342
343install-man:	../doc/hp2xx.1
344		$(CP) ../doc/hp2xx.1 $(man1dir)
345		$(CHMOD) 644 $(man1dir)/hp2xx.1
346
347