1# Makefile for figlet version 2.2.4 (26 Jan 2011)
2# adapted from Makefile for figlet version 2.2.2 (05 July 2005)
3# adapted from Makefile for figlet version 2.2 (15 Oct 1996)
4# Copyright 1993, 1994,1995 Glenn Chappell and Ian Chai
5# Copyright 1996, 1997, 1998, 1999, 2000, 2001 John Cowan
6# Copyright 2002 Christiaan Keet
7# Copyright 2011 Claudio Matsuoka
8
9# Please notice that to follow modern standards and ease third-party
10# package creation, binaries are now installed under BINDIR, and DESTDIR
11# is reserved for the installation pathname prefix.
12#
13# Please make sure BINDIR, MANDIR, DEFAULTFONTDIR and
14#   DEFAULTFONTFILE are defined to reflect the situation
15#   on your computer.  See README for details.
16
17# Don't change this even if your shell is different. The only reason
18# for changing this is if sh is not in the same place.
19SHELL = /bin/sh
20
21# The C compiler and linker to use
22#CC	= gcc
23#CFLAGS	= -g -O2 -Wall
24LD	= gcc
25LDFLAGS =
26
27# Feature flags:
28#   define TLF_FONTS to use TOIlet TLF fonts
29XCFLAGS	= -DTLF_FONTS
30
31# Where to install files
32#prefix	= /usr/local
33
34# Where the executables should be put
35BINDIR	= $(prefix)/bin
36
37# Where the man page should be put
38MANDIR	= $(prefix)/man
39
40# Where figlet will search first for fonts (the ".flf" files).
41DEFAULTFONTDIR = $(datadir)
42# Use this definition if you can't put things in $(prefix)/share/figlet
43#DEFAULTFONTDIR = fonts
44
45# The filename of the font to be used if no other is specified,
46#   without suffix.(standard is recommended, but any other can be
47#   used). This font file should reside in the directory specified
48#   by DEFAULTFONTDIR.
49DEFAULTFONTFILE = standard
50
51##
52##  END OF CONFIGURATION SECTION
53##
54
55VERSION	= 2.2.5
56DIST	= figlet-$(VERSION)
57OBJS	= figlet.o zipio.o crc.o inflate.o utf8.o
58BINS	= figlet chkfont figlist showfigfonts
59MANUAL	= figlet.6 chkfont.6 figlist.6 showfigfonts.6
60DFILES	= Makefile Makefile.tc $(MANUAL) $(OBJS:.o=.c) chkfont.c getopt.c \
61	  figlist showfigfonts CHANGES FAQ README LICENSE figfont.txt \
62	  crc.h inflate.h zipio.h utf8.h run-tests.sh figmagic
63
64.c.o:
65	$(CC) -c $(CFLAGS) $(XCFLAGS) -DDEFAULTFONTDIR=\"$(DEFAULTFONTDIR)\" \
66		-DDEFAULTFONTFILE=\"$(DEFAULTFONTFILE)\" -o $*.o $<
67
68all: $(BINS)
69
70figlet: $(OBJS)
71	$(LD) $(LDFLAGS) -o $@ $(OBJS)
72
73chkfont: chkfont.o
74	$(LD) $(LDFLAGS) -o $@ chkfont.o
75
76clean:
77	rm -f *.o *~ core figlet chkfont
78
79install: all
80	mkdir -p $(DESTDIR)$(BINDIR)
81	mkdir -p $(DESTDIR)$(MANDIR)/man6
82	mkdir -p $(DESTDIR)$(DEFAULTFONTDIR)
83	cp $(BINS) $(DESTDIR)$(BINDIR)
84	cp $(MANUAL) $(DESTDIR)$(MANDIR)/man6
85	cp fonts/*.flf $(DESTDIR)$(DEFAULTFONTDIR)
86	cp fonts/*.flc $(DESTDIR)$(DEFAULTFONTDIR)
87
88dist:
89	rm -Rf $(DIST) $(DIST).tar.gz
90	mkdir $(DIST)/
91	cp $(DFILES) $(DIST)/
92	mkdir $(DIST)/fonts
93	cp fonts/*.fl[fc] $(DIST)/fonts
94	mkdir $(DIST)/tests
95	cp tests/*txt tests/emboss.tlf $(DIST)/tests
96	tar cvf - $(DIST) | gzip -9c > $(DIST).tar.gz
97	rm -Rf $(DIST)
98	tar xf $(DIST).tar.gz
99	(cd $(DIST); make all check vercheck)
100	@rm -Rf $(DIST)
101	@echo
102	@ls -l $(DIST).tar.gz
103
104check:
105	@echo -n "Run tests in "
106	@pwd
107	@./run-tests.sh fonts
108	@echo
109
110vercheck:
111	@echo -n "Infocode: "; ./figlet -I1
112	@./figlet -v|sed -n '/Version/s/.*\(Version\)/\1/p'
113	@echo -n "README: "; head -1 < README|sed 's/.*) //'
114	@echo -n "FAQ: "; grep latest FAQ|sed 's/ and can.*//'
115	@grep -h "^\.TH" *.6
116
117$(OBJS) chkfont.o getopt.o: Makefile
118chkfont.o: chkfont.c
119crc.o: crc.c crc.h
120figlet.o: figlet.c zipio.h
121getopt.o: getopt.c
122inflate.o: inflate.c inflate.h
123zipio.o: zipio.c zipio.h inflate.h crc.h
124