1#
2# Imakefile for xpaint 2.7.4
3#
4# $Id: Imakefile,v 1.21 2005/03/20 20:15:32 demailly Exp $
5
6#include "./.version"
7
8#include "./Local.config"
9#include "./Local.xawdefs"
10
11DEFINES = $(ARCH_DEFINES) $(EXTRA_DEFINES) \
12          $(XAWLIB_DEFINES) $(XPM_INCLUDE) $(XFT_INCLUDE) \
13          "-DEDITOR=\"$(EDITOR)\"" \
14          "-DSHAREDIR=\"$(SHAREDIR)\"" \
15          "-DXAPPLOADDIR=\"$(XAPPLOADDIR)\"" \
16	  "-DXPAINT_VERSION=\"$(VERSION)\"" \
17
18#ifdef LPCCMD
19DEFINES += "-DLPCCMD=\"$(LPCCMD)\""
20#endif
21
22#ifdef PRINTCAP
23DEFINES += "-DPRINTCAP=\"$(PRINTCAP)\""
24#endif
25
26#########################
27# Nothing to change below here
28
29XPSRC = chroma.c color.c colorEdit.c dialog.c fatBitsEdit.c \
30	fileBrowser.c fontSelect.c grab.c graphic.c hash.c help.c \
31	image.c imageComp.c iprocess.c magnifier.c main.c menu.c misc.c \
32	operation.c palette.c pattern.c print.c protocol.c readRC.c \
33	screenshot.c text.c texture.c typeConvert.c
34
35XPOBJ = chroma.o color.o colorEdit.o dialog.o fatBitsEdit.o \
36	fileBrowser.o fontSelect.o grab.o graphic.o hash.o help.o \
37	image.o imageComp.o iprocess.o magnifier.o main.o menu.o misc.o \
38	operation.o palette.o pattern.o print.o protocol.o readRC.o \
39	screenshot.o text.o texture.o typeConvert.o
40
41OPSRC = arcOp.c freehandOp.c boxOp.c brushOp.c circleOp.c fillOp.c \
42	fontOp.c lineOp.c pencilOp.c polygonOp.c splineOp.c selectOp.c \
43	sprayOp.c dynPenOp.c
44
45OPOBJ = arcOp.o freehandOp.o boxOp.o brushOp.o circleOp.o fillOp.o \
46	fontOp.o lineOp.o pencilOp.o polygonOp.o splineOp.o selectOp.o \
47	sprayOp.o dynPenOp.o
48
49XPWIDSRC = Colormap.c Paint.c PaintEvent.c PaintRegion.c PaintUndo.c
50XPWIDOBJ = Colormap.o Paint.o PaintEvent.o PaintRegion.o PaintUndo.o
51
52RWSRC =	rw/libpnmrw.c rw/readGIF.c rw/readJPEG.c rw/readTIFF.c \
53	rw/readWritePNM.c rw/readWriteSGI.c rw/readWriteXBM.c \
54	rw/readWriteXPM.c rw/readWriteXWD.c rw/rwTable.c \
55	rw/writeGIF.c rw/writeJPEG.c rw/writePS.c rw/writeTIFF.c \
56	rw/libpnmrw.h rw/rwTable.h
57RWOBJ =	rw/libpnmrw.o rw/readGIF.o rw/readJPEG.o rw/readTIFF.o \
58	rw/readWritePNM.o rw/readWriteSGI.o rw/readWriteXBM.o \
59	rw/readWriteXPM.o rw/readWriteXWD.o rw/rwTable.o \
60	rw/writeGIF.o rw/writePS.o rw/writeTIFF.o
61
62SRCS = $(XPSRC) $(OPSRC) $(XPWIDSRC)
63OBJS = $(XPOBJ) $(OPOBJ) $(XPWIDOBJ)
64
65HDRS =	Colormap.h ColormapP.h hash.h Paint.h \
66	PaintP.h palette.h xpaint.h menu.h \
67	text.h region.h image.h patchlevel.h \
68	misc.h rc.h ops.h color.h graphic.h operation.h protocol.h
69
70OPBDIR = bitmaps/tools
71OPBITMAPS = $(OPBDIR)/brokenlineOp.xpm $(OPBDIR)/rayOp.xpm \
72	$(OPBDIR)/arcOp.xpm $(OPBDIR)/boxOp.xpm $(OPBDIR)/brushOp.xpm \
73	$(OPBDIR)/pencilOp.xpm $(OPBDIR)/dotPenOp.xpm $(OPBDIR)/dynPenOp.xpm \
74	$(OPBDIR)/lineOp.xpm $(OPBDIR)/eraseOp.xpm $(OPBDIR)/ellipseOp.xpm \
75	$(OPBDIR)/smearOp.xpm $(OPBDIR)/sprayOp.xpm $(OPBDIR)/textOp.xpm \
76	$(OPBDIR)/polygonOp.xpm $(OPBDIR)/freehandOp.xpm \
77	$(OPBDIR)/filledBoxOp.xpm $(OPBDIR)/filledEllipseOp.xpm \
78	$(OPBDIR)/filledFreehandOp.xpm $(OPBDIR)/filledPolygonOp.xpm \
79	$(OPBDIR)/filledSplineOp.xpm $(OPBDIR)/fillOp.xpm \
80	$(OPBDIR)/fractalFillOp.xpm $(OPBDIR)/gradientFillOp.xpm \
81	$(OPBDIR)/selectBoxOp.xpm $(OPBDIR)/selectEllipseOp.xpm \
82	$(OPBDIR)/selectPolygonOp.xpm \
83	$(OPBDIR)/selectFreehandOp.xpm $(OPBDIR)/selectSplineOp.xpm
84
85XBMDIR = bitmaps/xbm
86
87XAWDEPENDS = \
88	brushOp.o chroma.o fileBrowser.o fontSelect.o graphic.o help.o \
89	iprocess.o main.o menu.o misc.o operation.o pattern.o print.o size.o
90
91#ifdef SGIArchitecture
92SGI_LIB = -limage
93#endif
94
95DEPLIBS = always xpaint.1 XPaint.ad
96
97#if ! defined(__NetBSD__) && !defined(__FreeBSD__)
98LOCAL_LIBRARIES = -Lrw -lrw -ldl -rdynamic \
99  $(XPM_LIB) $(XFT_LIB) $(TIFF_LIB) $(SGI_LIB) \
100  $(JPEG_LIB) $(JP2K_LIB) $(PNG_LIB)
101#else
102LOCAL_LIBRARIES = -Lrw -lrw \
103  $(XPM_LIB) $(XFT_LIB) $(TIFF_LIB) $(SGI_LIB) \
104  $(JPEG_LIB) $(JP2K_LIB) $(PNG_LIB)
105#endif
106
107SUBDIRS = rw
108
109ComplexProgramTarget(xpaint)
110# InstallAppDefaults(XPaint)
111
112NamedMakeSubdirs(always, $(SUBDIRS))
113MakefileSubdirs($(SUBDIRS) bitmaps Doc)
114CleanSubdirs($(SUBDIRS))
115
116# Other targets...
117
118start::
119	@if ! [ -d xaw_incdir ] ; then ./configure.old ; make ; fi
120
121install::
122	mkdir -p $(DESTDIR)$(BINDIR)
123	cp -f share/bin/imgmerge $(DESTDIR)$(BINDIR)
124	mkdir -p $(DESTDIR)$(SHAREDIR)/bin
125	cp -f share/bin/xpaint_ocr $(DESTDIR)$(SHAREDIR)/bin
126	mkdir -p $(DESTDIR)$(SHAREDIR)/bitmaps
127	cp -p -r bitmaps/brushbox.cfg bitmaps/brushes bitmaps/elec \
128		 $(DESTDIR)$(SHAREDIR)/bitmaps
129	mkdir -p $(DESTDIR)$(SHAREDIR)/include
130	cp -f *.h $(DESTDIR)$(SHAREDIR)/include
131	cp -f XPaintIcon.xpm $(DESTDIR)$(SHAREDIR)
132	mkdir -p $(DESTDIR)$(SHAREDIR)/c_scripts
133	cp -r share/c_scripts $(DESTDIR)$(SHAREDIR)
134	./substads -single share/include/Xpaint.h \
135		$(DESTDIR)$(SHAREDIR)/include/Xpaint.h \
136		"XPAINT_SHAREDIR" $(SHAREDIR)
137	cp -f share/include/Xpaint3d.h $(DESTDIR)$(SHAREDIR)/include
138	cd app-defaults/out ; cp -f * $(DESTDIR)$(XAPPLOADDIR)
139	mkdir -p $(DESTDIR)$(SHAREDIR)/help
140	cd share/help ; $(RM) -f *~ ; cp -f Help* $(DESTDIR)$(SHAREDIR)/help
141	mkdir -p $(DESTDIR)$(SHAREDIR)/messages
142	cd share/messages ; $(RM) -f *~ ; cp -f Messages* $(DESTDIR)$(SHAREDIR)/messages
143	chmod -R a+r $(DESTDIR)$(SHAREDIR)/
144	cd util ; make install
145
146strip::
147	if [ -x $(DESTDIR)$(BINDIR)/xpaint ] ; \
148		then strip $(DESTDIR)$(BINDIR)/xpaint ; fi
149	if [ -x $(DESTDIR)$(BINDIR)/pdfconcat ] ; \
150		then strip $(DESTDIR)$(BINDIR)/pdfconcat ; fi
151	if [ -x $(DESTDIR)$(BINDIR)/pgf2pnm ] ; \
152		then strip $(DESTDIR)$(BINDIR)/pgf2pnm ; fi
153	if [ -x $(DESTDIR)$(BINDIR)/ppmtopsm ] ; \
154		then strip $(DESTDIR)$(BINDIR)/ppmtops ; fi
155
156xaw::
157	-$(RM) $(XAWDEPENDS)
158	./configure.old xaw ; make
159	@echo ""
160	@echo "'xpaint' compiled with Xaw widgets (old and ugly)"
161	@echo "You should rather use Xaw3d, neXtaw or Xaw95 !!"
162	@echo "Type 'make xaw3d(g)' or 'make nextaw' or 'make xaw95'"
163	@echo ""
164
165xaw3d::
166	-$(RM) $(XAWDEPENDS)
167	./configure.old xaw3d ; make
168	@echo ""
169	@echo "'xpaint' compiled with Xaw3d widgets"
170	@echo "Variants are 'make xaw3dg' and 'make nextaw' and 'make xaw95'"
171	@echo ""
172
173xaw3dg::
174	-$(RM) $(XAWDEPENDS)
175	./configure.old xaw3dg ; make
176	@echo ""
177	@echo "'xpaint' compiled with Xaw3d(g) widgets"
178	@echo "Variants are 'make xaw3d', 'make nextaw' and 'make xaw95'"
179	@echo ""
180
181xaw3dxft::
182	-$(RM) $(XAWDEPENDS)
183	./configure.old xaw3dxft ; make
184	@echo ""
185	@echo "'xpaint' compiled with Xaw3dxft widgets"
186	@echo "Variants are 'make xaw3dg' and 'make nextaw' and 'make xaw95'"
187	@echo ""
188
189nextaw::
190	-$(RM) $(XAWDEPENDS)
191	./configure.old nextaw ; make
192	@echo ""
193	@echo "'xpaint' compiled with neXtaw widgets"
194	@echo "Variants are 'make xaw3d' and 'make xaw95'"
195	@echo ""
196
197xaw95::
198	-$(RM) $(XAWDEPENDS)
199	./configure.old xaw95 ; make
200	@echo ""
201	@echo "'xpaint' compiled with Xaw95 widgets"
202	@echo "Another alternative is to use the Xaw3d widgets :"
203	@echo "Type 'make xaw3d' or 'make xaw3dg'"
204	@echo ""
205
206clean::
207	-$(RM) preproc substads pdfconcat msgedit
208	-$(RM) XPaint.ad XPaint.ad.h DefaultRC.txt.h PGP.*
209	-$(RM) -rf share/out xaw_incdir xpaint.man xpaint.1
210	cd share/help ; $(RM) *~
211	cd share/messages ; $(RM) *~
212	cd app-defaults ; $(RM) core *~ substads
213	cd app-defaults/out ; $(RM) -f XPaint*
214	cd util ; make clean
215
216cleandir::
217	-$(RM) version.h bitmaps/Makefile* Doc/Makefile*
218	-$(RM) -f rw/Makefile
219
220includes:: XPaint.ad.h DefaultRC.txt.h messages.h
221	cd bitmaps; $(RM) tools; \
222	if test "$(TOOLFLAGS)" != "" ; \
223	then ln -s big_tools tools ; else ln -s small_tools tools ; fi
224
225XPaint.ad: app-defaults
226	$(CC) substads.c -o substads
227	cd app-defaults ; \
228	../substads -appdefs \
229	            XPAINT_VERSION $(VERSION) \
230		    XPAINT_SHAREDIR $(SHAREDIR) \
231		    XPAINT_PRINT_COMMAND "$(PRINT_COMMAND)" \
232		    XPAINT_POSTSCRIPT_VIEWER "$(POSTSCRIPT_VIEWER)" \
233		    XPAINT_EXTERN_VIEWER "$(EXTERN_VIEWER)"
234	cp -p app-defaults/out/XPaint XPaint.ad
235
236XPaint.ad.h:	XPaint.ad
237	./substads -ad2c $? $@
238
239messages.h:	preproc.c share/messages/Messages
240	$(CC) preproc.c -o preproc
241	./preproc > messages.h
242
243DefaultRC.txt.h: DefaultRC
244	./substads -ad2c $? $@
245
246xpaint.1:	xpaint.1.in .version
247	./substads -single xpaint.1.in xpaint.1 XPAINT_VERSION $(VERSION)
248
249Colormap.o: ColormapP.h Colormap.h
250Paint.o: PaintP.h Paint.h xpaint.h misc.h
251PaintEvent.o: PaintP.h Paint.h xpaint.h
252PaintRegion.o: PaintP.h Paint.h protocol.h
253PaintUndo.o: xpaint.h misc.h PaintP.h Paint.h
254freehandOp.o: xpaint.h misc.h Paint.h ops.h
255boxOp.o: xpaint.h misc.h Paint.h ops.h
256brushOp.o: xpaint.h misc.h Paint.h palette.h \
257	graphic.h protocol.h ops.h
258circleOp.o: xpaint.h misc.h Paint.h ops.h
259chroma.o: start xpaint.h Paint.h palette.h protocol.h color.h messages.h \
260	 misc.h operation.h ops.h
261color.o: messages.h palette.h protocol.h color.h xpaint.h misc.h image.h
262colorEdit.o: misc.h palette.h color.h protocol.h
263dialog.o: misc.h xpaint.h protocol.h
264fatBitsEdit.o: Paint.h xpaint.h messages.h palette.h menu.h misc.h region.h \
265	protocol.h graphic.h
266fileBrowser.o: Paint.h messages.h misc.h image.h rw/rwTable.h graphic.h \
267	protocol.h
268fontSelect.o: xpaint.h messages.h misc.h operation.h ops.h graphic.h protocol.h
269grab.o: image.h
270graphic.o: xpaint.h palette.h messages.h misc.h menu.h text.h graphic.h \
271	image.h region.h operation.h rc.h protocol.h color.h rw/rwTable.h
272hash.o: misc.h hash.h
273help.o: Paint.h misc.h protocol.h
274image.o: image.h hash.h palette.h misc.h protocol.h
275imageComp.o: image.h hash.h protocol.h misc.h
276iprocess.o: xpaint.h image.h misc.h protocol.h
277lineOp.o: xpaint.h misc.h Paint.h ops.h
278main.o: XPaint.ad.h messages.h misc.h graphic.h protocol.h \
279	rw/rwTable.h XPaintIcon.xpm .version
280menu.o: menu.h $(XBMDIR)/checkmark.xbm $(XBMDIR)/pullright.xbm
281misc.o: $(XBMDIR)/background.xbm xpaint.h misc.h messages.h
282operation.o: $(OPBITMAPS) Local.config operation.c ops.h xpaint.h misc.h \
283	menu.h Paint.h text.h graphic.h image.h operation.h protocol.h \
284	region.h messages.h
285	$(CC) -c -I./$(OPBDIR) $(CFLAGS) $*.c
286palette.o: messages.h palette.h hash.h misc.h image.h xpaint.h
287pattern.o: Colormap.h Paint.h palette.h xpaint.h menu.h misc.h image.h \
288	region.h text.h graphic.h operation.h color.h protocol.h messages.h
289pencilOp.o: xpaint.h Paint.h misc.h ops.h
290print.o: xpaint.h menu.h image.h messages.h misc.h region.h text.h \
291	graphic.h operation.h color.h protocol.h
292protocol.o: xpaint.h messages.h misc.h protocol.h \
293	$(XBMDIR)/wait1.xbm $(XBMDIR)/wait2.xbm \
294	$(XBMDIR)/wait3.xbm $(XBMDIR)/wait4.xbm
295readRC.o: image.h rc.h misc.h DefaultRC.txt.h
296size.o: Paint.h messages.h misc.h text.h
297screenshot.o: Paint.h image.h messages.h
298text.o: misc.h protocol.h text.h
299typeConvert.o: palette.h misc.h
300fontOp.o: xpaint.h Paint.h graphic.h misc.h ops.h
301arcOp.o: xpaint.h Paint.h misc.h ops.h
302polygonOp.o: xpaint.h misc.h Paint.h ops.h
303fillOp.o: Paint.h protocol.h xpaint.h ops.h image.h misc.h palette.h
304selectOp.o: xpaint.h Paint.h protocol.h palette.h color.h misc.h \
305	operation.h ops.h
306sprayOp.o: xpaint.h Paint.h misc.h ops.h
307
308TEXT =	README README.old README.PNG INSTALL DefaultRC ChangeLog \
309	xpaint.1.in TODO .version Imakefile Local.config
310MISC = XPaintIcon.xpm Filelist preproc.c substads.c
311
312makelist::
313	-$(RM) Filelist
314	@touch Filelist
315
316makelist::
317	sh -c 'for i in '"$(TEXT) $(SRCS) $(MISC) $(LANGFILES) $(HDRS)"' ; \
318	do echo $(CURRENT_DIR)/$$i >> $(TOP)/Filelist ; done '
319	share/bin/make_list
320
321NamedTargetSubdirs(makelist, $(SUBDIRS) bitmaps Doc, , , makelist)
322
323kit: makelist
324	sh -c 'sum="`cat Filelist`" ; makekit -oMANIFEST MANIFEST $$sum'
325
326msgedit:
327	gcc -Wall msgedit.c -o msgedit
328
329targz: makelist
330	make realclean
331	cd .. ; tar cvfz xpaint-$(VERSION).tar.gz xpaint-$(VERSION)
332
333tarbz2: makelist
334	make realclean ;
335	cd .. ; tar cvfj xpaint-$(VERSION).tar.bz2 xpaint-$(VERSION)
336
337TAGS:	$(SRCS) $(HDRS) $(RWSRC)
338	etags -t -o ./TAGS $(XPSRC) $(OPSRC) $(XPWIDSRC) $(RWSRC) $(HDRS)
339
340realclean: clean
341	-$(RM) messages.h \
342	Makefile bitmaps/Makefile Doc/Makefile rw/Makefile \
343	xpaint.man xpaint._man
344
345distclean:: realclean
346
347certification:	makelist
348	-$(RM) $(CERTIFICATION)
349	certify `cat Filelist`
350
351
352