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