1ifeq ($(SRCDIR)x,x)
2  SRCDIR = $(CURDIR)/../..
3  BUILDDIR = $(SRCDIR)
4endif
5SUBDIR = converter/pbm
6VPATH=.:$(SRCDIR)/$(SUBDIR)
7
8include $(BUILDDIR)/config.mk
9
10PORTBINARIES =	atktopbm brushtopbm cistopbm cmuwmtopbm \
11		ddbugtopbm g3topbm escp2topbm \
12		macptopbm mdatopbm mgrtopbm mrftopbm \
13		pbmto10x pbmto4425 pbmtoascii pbmtoatk \
14		pbmtobbnbg pbmtocis pbmtocmuwm pbmtodjvurle \
15		pbmtoepsi pbmtoepson pbmtoescp2 \
16		pbmtog3 pbmtogem pbmtogo pbmtoibm23xx pbmtosunicon pbmtolj \
17		pbmtoln03 pbmtolps \
18		pbmtomacp pbmtomatrixorbital pbmtomda pbmtomgr pbmtomrf \
19		pbmtonokia \
20		pbmtopi3 pbmtoplot pbmtopsg3 pbmtoptx pbmtowbmp \
21		pbmtoxbm pbmtoybm pbmtozinc \
22		pi3topbm pktopbm \
23		wbmptopbm xbmtopbm ybmtopbm
24
25ifneq ($(LEX)x,x)
26  PORTBINARIES += thinkjettopbm
27endif
28
29#pbmpage uses sqrt(), which is sometimes in libc, not libm.  Is it ever
30#in libm?
31MATHBINARIES =	pbmtopk
32BINARIES =	$(PORTBINARIES) $(MATHBINARIES)
33SCRIPTS =       pbmtox10bm
34EXTRA_OBJECTS = g3ttable.o g3prefab.o
35
36OBJECTS = $(BINARIES:%=%.o) $(EXTRA_OBJECTS)
37
38MERGEBINARIES = $(BINARIES)
39MERGE_OBJECTS = $(MERGEBINARIES:%=%.o2) $(EXTRA_OBJECTS)
40
41HAVE_MERGE_COMPAT=YES
42
43SUBDIRS=pbmtoppa
44
45.PHONY: all
46all: $(BINARIES) $(SUBDIRS:%=%/all)
47
48include $(SRCDIR)/common.mk
49
50ifneq ($(LEX)x,x)
51thinkjettopbm.c1:%.c1:%.l
52	$(LEX) -t $< >$@
53endif
54
55thinkjettopbm.c:%.c:%.c1 $(SRCDIR)/lib/util/lexheader
56# Different versions of Lex produce subtly different output, from the
57# same .l source file.  The .c1 file contains the raw output from Lex.
58# We now massage it so it will compile.  We must add some definitions
59# at the top (the lexheader file).  We must remove any yylex and
60# yywrap prototype, as our .l file already contains one.  The Lex
61# version "Software Generation Utilities (SGU) Solaris-ELF (4.0)"
62# puts declarations for yylex and yywrap, as external symbols,
63# into its output, causing a duplicate declaration error at compile time.
64#
65# Schwarb Manfred reports that it compiles OK, but with warnings, on
66# Solaris.  Solaris Lex has a -e option that eliminates the lex
67# warnings, but causes compiler warnings.  AIX and Flex don't have a
68# -e option.  -Bryan 2001.05.16.
69#
70# But Peter Weisz reported on 2002.12.11 that on Solaris, compile
71# failed due to a duplicate declaration of yylex and yywrap with Netpbm
72# 10.12, which does not remove those declarations as the current version
73# does.
74	cat $(SRCDIR)/lib/util/lexheader $< | \
75	  grep -v "^[[:space:]]*int yylex(void);" | \
76	  grep -v "^[[:space:]]*int yywrap(void);" \
77	  >$@
78
79install.bin install.merge: install.bin.local
80.PHONY: install.bin.local
81install.bin.local: $(PKGDIR)/bin
82# Remember that $(SYMLINK) might just be a copy command.
83# In December 2010 (Actually January 2011), pbmtosunicon replaced pbmtoicon
84	cd $(PKGDIR)/bin ; \
85	$(SYMLINK) pbmtosunicon$(EXE) pbmtoicon$(EXE)
86
87mergecomptrylist:
88	cat /dev/null >$@
89	echo "TRY(\"pbmtoicon\",   main_pbmtosunicon);"     >>$@
90
91thisdirclean: localclean
92.PHONY: localclean
93localclean:
94	-rm -f thinkjettopbm.c
95
96pbmtog3: g3ttable.o g3prefab.o
97pbmtog3: ADDL_OBJECTS = g3ttable.o g3prefab.o
98
99g3topbm: g3ttable.o
100g3topbm: ADDL_OBJECTS = g3ttable.o
101