From: Wolfram Sang Subject: [patch] Improve makefile to allow cross-compilation Signed-off-by: Wolfram Sang Singed-off-by: Marc Kleine-Budde --- # 20091221 rsc: mailed to info@figlet.org v1: initial patch v2: mkl has added CPP and LDFLAGS Makefile | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) Index: Makefile =================================================================== --- Makefile.orig +++ Makefile @@ -1,4 +1,4 @@ -# Makefile for figlet version 2.2.2 (05 July 2005) +# Makefile for figlet version 2.2.2 (05 July 2005) # adapted from Makefile for figlet version 2.2 (15 Oct 1996) # Copyright 1993, 1994,1995 Glenn Chappell and Ian Chai # Copyright 1996, 1997, 1998, 1999, 2000, 2001 John Cowan @@ -11,19 +11,20 @@ # Don't change this even if your shell is different. The only reason # for changing this is if sh is not in the same place. SHELL = /bin/sh -CC = gcc -CFLAGS = -g +CC ?= gcc +CFLAGS ?= -g -O2 +prefix = /usr/local # Where the executables should be put -DESTDIR = /usr/local/bin +BINDIR = $(prefix)/bin # Where the man page should be put -MANDIR = /usr/local/man/man6 +MANDIR = $(prefix)/man/man6 # Where figlet will search first for fonts (the ".flf" files). -DEFAULTFONTDIR = /usr/local/share/figlet +DEFAULTFONTDIR = $(prefix)/share/figlet # Use this definition if you can't put things in /usr/local/share/figlet -DEFAULTFONTDIR = fonts +#DEFAULTFONTDIR = fonts # The filename of the font to be used if no other is specified # (standard.flf is recommended, but any other can be used). @@ -40,23 +41,23 @@ SOURCES = figlet.c zipio.c crc.c inflate all: figlet chkfont figlet: $(SOURCES) - $(CC) $(CFLAGS) -DDEFAULTFONTDIR=\"$(DEFAULTFONTDIR)\" \ + $(CC) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -DDEFAULTFONTDIR=\"$(DEFAULTFONTDIR)\" \ -DDEFAULTFONTFILE=\"$(DEFAULTFONTFILE)\" \ $(SOURCES) -o figlet chmod a+x figlet chkfont: chkfont.c - $(CC) $(CFLAGS) -o chkfont chkfont.c + $(CC) $(CFLAGS) $(LDFLAGS) -o chkfont chkfont.c clean: rm -f *.o figlet chkfont install: figlet chkfont - mkdir -p $(DEFAULTFONTDIR) - cp figlet $(DESTDIR) - cp figlet.6 $(MANDIR) - cp chkfont $(DESTDIR) - cp figlist $(DESTDIR) - cp showfigfonts $(DESTDIR) - cp fonts/*.flf $(DEFAULTFONTDIR) - cp fonts/*.flc $(DEFAULTFONTDIR) + install -m 755 -D figlet $(DESTDIR)$(BINDIR)/figlet + install -m 644 -D figlet.6 $(DESTDIR)$(MANDIR)/figlet.6 + install -m 755 -D chkfont $(DESTDIR)$(BINDIR)/chkfont + install -m 755 -D figlist $(DESTDIR)$(BINDIR)/figlist + install -m 755 -D showfigfonts $(DESTDIR)$(BINDIR)/showfigfonts + cd fonts && for FILE in *.fl[fc]; do \ + install -m 644 -D $$FILE $(DESTDIR)$(DEFAULTFONTDIR)/$$FILE; \ + done