Stadard targets added to Makefile. New targets:

* install
 * install-*
 * uninstall
This commit is contained in:
Mateusz Hromada 2009-06-12 00:31:39 +02:00
parent 9a36761661
commit c7ecbc244d
4 changed files with 258 additions and 25 deletions

View File

@ -7,6 +7,7 @@ DEFAULT_PROJECT_VERSION='0.9.3'
DEFAULT_PROJECT_PAGE='http://utt.wmi.amu.edu.pl'
DEFAULT_PROJECT_MAIL='utt@wmid.amu.edu.pl'
DEFAULT_INSTALL='/usr/bin/install'
DEFAULT_SHELL='/bin/sh'
DEFAULT_CC='/usr/bin/gcc'
DEFAULT_BISON='/usr/bin/bison'
@ -38,9 +39,38 @@ DEFAULT_prefix='/usr/local'
DEFAULT_exec_prefix='$(prefix)'
DEFAULT_bindir='$(exec_prefix)/bin'
DEFAULT_sbindir='$(exec_prefix)/sbin'
DEFAULT_libexecdir='$(exec_prefix)/libexec'
DEFAULT_datarootdir='$(prefix)/share'
DEFAULT_datadir='$(datarootdir)'
DEFAULT_sysconfdir='$(prefix)/etc'
DEFAULT_sharedstatedir='$(prefix)/com'
DEFAULT_localstatedir='$(prefix)/var'
DEFAULT_docdir='$(datarootdir)/doc/$(PROJECT_NAME)'
DEFAULT_infodir='$(datarootdir)/info'
DEFAULT_htmldir='$(docdir)'
DEFAULT_dvidir='$(docdir)'
DEFAULT_pdfdir='$(docdir)'
DEFAULT_psdir='$(docdir)'
DEFAULT_libdir='$(exec_prefix)/lib'
DEFAULT_localedir='$(datarootdir)/locale'
DEFAULT_mandir='$(datarootdir)/man'
DEFAULT_man1dir='$(mandir)/man1'
DEFAULT_man2dir='$(mandir)/man2'
DEFAULT_man3dir='$(mandir)/man3'
DEFAULT_man4dir='$(mandir)/man4'
DEFAULT_man5dir='$(mandir)/man5'
DEFAULT_man6dir='$(mandir)/man6'
DEFAULT_man7dir='$(mandir)/man7'
DEFAULT_man8dir='$(mandir)/man8'
DEFAULT_man9dir='$(mandir)/man9'
DEFAULT_manext='.1'
DEFAULT_man1ext='.1'
DEFAULT_man2ext='.2'
DEFAULT_man3ext='.3'
DEFAULT_man4ext='.4'
DEFAULT_man5ext='.5'
DEFAULT_man6ext='.6'
DEFAULT_man7ext='.7'
DEFAULT_man8ext='.8'
DEFAULT_man9ext='.9'

View File

@ -10,6 +10,7 @@ if [ -z "$PROJECT_VERSION" ]; then PROJECT_VERSION=$DEFAULT_PROJECT_VERSION;
if [ -z "$PROJECT_PAGE" ]; then PROJECT_PAGE=$DEFAULT_PROJECT_PAGE; fi
if [ -z "$PROJECT_MAIL" ]; then PROJECT_MAIL=$DEFAULT_PROJECT_MAIL; fi
if [ -z "$INSTALL" ]; then INSTALL=$DEFAULT_INSTALL; fi
if [ -z "$SHELL" ]; then SHELL=$DEFAULT_SHELL; fi
if [ -z "$CC" ]; then CC=$DEFAULT_CC; fi
if [ -z "$BISON" ]; then BISON=$DEFAULT_BISON; fi
@ -41,11 +42,41 @@ if [ -z "$prefix" ]; then prefix=$DEFAULT_prefix;
if [ -z "$exec_prefix" ]; then exec_prefix=$DEFAULT_exec_prefix; fi
if [ -z "$bindir" ]; then bindir=$DEFAULT_bindir; fi
if [ -z "$sbindir" ]; then sbindir=$DEFAULT_sbindir; fi
if [ -z "$libexecdir" ]; then libexecdir=$DEFAULT_libexecdir; fi
if [ -z "$datarootdir" ]; then datarootdir=$DEFAULT_datarootdir; fi
if [ -z "$datadir" ]; then datadir=$DEFAULT_datadir; fi
if [ -z "$sysconfdir" ]; then sysconfdir=$DEFAULT_sysconfdir; fi
if [ -z "$sharedstatedir" ]; then sharedstatedir=$DEFAULT_sharedstatedir; fi
if [ -z "$localstatedir" ]; then localstatedir=$DEFAULT_localstatedir; fi
if [ -z "$docdir" ]; then docdir=$DEFAULT_docdir; fi
if [ -z "$infodir" ]; then infodir=$DEFAULT_infodir; fi
if [ -z "$htmldir" ]; then htmldir=$DEFAULT_htmldir; fi
if [ -z "$dvidir" ]; then dvidir=$DEFAULT_dvidir; fi
if [ -z "$pdfdir" ]; then pdfdir=$DEFAULT_pdfdir; fi
if [ -z "$psdir" ]; then psdir=$DEFAULT_psdir; fi
if [ -z "$libdir" ]; then libdir=$DEFAULT_libdir; fi
if [ -z "$localedir" ]; then localedir=$DEFAULT_localedir; fi
if [ -z "$mandir" ]; then mandir=$DEFAULT_mandir; fi
if [ -z "$man1dir" ]; then man1dir=$DEFAULT_man1dir; fi
if [ -z "$man2dir" ]; then man2dir=$DEFAULT_man2dir; fi
if [ -z "$man3dir" ]; then man3dir=$DEFAULT_man3dir; fi
if [ -z "$man4dir" ]; then man4dir=$DEFAULT_man4dir; fi
if [ -z "$man5dir" ]; then man5dir=$DEFAULT_man5dir; fi
if [ -z "$man6dir" ]; then man6dir=$DEFAULT_man6dir; fi
if [ -z "$man7dir" ]; then man7dir=$DEFAULT_man7dir; fi
if [ -z "$man8dir" ]; then man8dir=$DEFAULT_man8dir; fi
if [ -z "$man9dir" ]; then man9dir=$DEFAULT_man9dir; fi
if [ -z "$manext" ]; then manext=$DEFAULT_manext; fi
if [ -z "$man1ext" ]; then man1ext=$DEFAULT_man1ext; fi
if [ -z "$man2ext" ]; then man2ext=$DEFAULT_man2ext; fi
if [ -z "$man3ext" ]; then man3ext=$DEFAULT_man3ext; fi
if [ -z "$man4ext" ]; then man4ext=$DEFAULT_man4ext; fi
if [ -z "$man5ext" ]; then man5ext=$DEFAULT_man5ext; fi
if [ -z "$man6ext" ]; then man6ext=$DEFAULT_man6ext; fi
if [ -z "$man7ext" ]; then man7ext=$DEFAULT_man7ext; fi
if [ -z "$man8ext" ]; then man8ext=$DEFAULT_man8ext; fi
if [ -z "$man9ext" ]; then man9ext=$DEFAULT_man9ext; fi
for option
do
@ -59,16 +90,47 @@ do
--help) help=yes ;;
--quiet) quiet=yes ;;
DESTDIR=*) DESTDIR="$value" ;;
--prefix=*) prefix="$value" ;;
--exec-prefix=*) exec_prefix="$value" ;;
--bindir=*) bindir="$value" ;;
--sbindir=*) sbindir="$value" ;;
--libexecdir=*) libexecdir="$value" ;;
--datarootdir=*) datarootdir="$value" ;;
--datadir=*) datadir="$value" ;;
--sysconfdir=*) sysconfdir="$value" ;;
--sharedstatedir=*) sharedstatedir="$value" ;;
--localstatedir=*) localstatedir="$value" ;;
--docdir=*) docdir="$value" ;;
--infodir=*) infodir="$value" ;;
--htmldir=*) htmldir="$value" ;;
--dvidir=*) dvidir="$value" ;;
--pdfdir=*) pdfdir="$value" ;;
--psdir=*) psdir="$value" ;;
--libdir=*) libdir="$value" ;;
--localedir=*) localedir="$value" ;;
--mandir=*) mandir="$value" ;;
--man1dir=*) man1dir="$value" ;;
--man2dir=*) man2dir="$value" ;;
--man3dir=*) man3dir="$value" ;;
--man4dir=*) man4dir="$value" ;;
--man5dir=*) man5dir="$value" ;;
--man6dir=*) man6dir="$value" ;;
--man7dir=*) man7dir="$value" ;;
--man8dir=*) man8dir="$value" ;;
--man9dir=*) man9dir="$value" ;;
--manext=*) manext="$value" ;;
--man1ext=*) man1ext="$value" ;;
--man2ext=*) man2ext="$value" ;;
--man3ext=*) man3ext="$value" ;;
--man4ext=*) man4ext="$value" ;;
--man5ext=*) man5ext="$value" ;;
--man6ext=*) man6ext="$value" ;;
--man7ext=*) man7ext="$value" ;;
--man8ext=*) man8ext="$value" ;;
--man9ext=*) man9ext="$value" ;;
INSTALL=*) INSTALL="$value" ;;
SHELL=*) SHELL="$value" ;;
CC=*) CC="$value" ;;
BISON=*) BISON="$value" ;;
@ -88,7 +150,6 @@ do
TEXI2PDF=*) TEXI2PDF="$value" ;;
DVIPS=*) DVIPS="$value" ;;
CFLAGS=*) CFLAGS="$value" ;;
LDFLAGS=*) LDFLAGS="$value" ;;
LDLIBS=*) LDLIBS="$value" ;;
@ -123,14 +184,44 @@ Fine tuning of the installation directories:
--bindir=PATH user executables
--sbindir=PATH system admin executables
--libexecdir=PATH program executables
--datarootdir=PATH read-only arch.-independent data root
--datadir=PATH read-only architecture-independent data
--sysconfdir=PATH read-only single-machine data
--sharedstatedir=PATH modifiable architecture-independent data
--localstatedir=PATH modifiable single-machine data
--docdir=DIR documentation root
--infodir=DIR info documentation
--htmldir=DIR html documentation
--dvidir=DIR dvi documentation
--pdfdir=DIR pdf documentation
--psdir=DIR ps documentation
--libdir=DIR object code libraries
--localedir=DIR locale-dependent data
--mandir=DIR man documentation
--man1dir=DIR section 1 man documentation
--man2dir=DIR section 2 man documentation
--man3dir=DIR section 3 man documentation
--man4dir=DIR section 4 man documentation
--man5dir=DIR section 5 man documentation
--man6dir=DIR section 6 man documentation
--man7dir=DIR section 7 man documentation
--man8dir=DIR section 8 man documentation
--man9dir=DIR section 9 man documentation
--manext=EXT man extension
--man1ext=EXT section 1 man extension
--man2ext=EXT section 2 man extension
--man3ext=EXT section 3 man extension
--man4ext=EXT section 4 man extension
--man5ext=EXT section 5 man extension
--man6ext=EXT section 6 man extension
--man7ext=EXT section 7 man extension
--man8ext=EXT section 8 man extension
--man9ext=EXT section 9 man extension
Some influential environment variables:
INSTALL install command
SHELL shell command
CC C compiler command
BISON Bison compiler command

View File

@ -4,6 +4,18 @@ cat << EOF > Makefile
# Default target
.DEFAULT_GOAL = all
PROJECT_NAME = $PROJECT_NAME
PROJECT_FULLNAME = $PROJECT_FULLNAME
PROJECT_COPYRIGHT = $PROJECT_COPYRIGHT
PROJECT_VERSION = $PROJECT_VERSION
PROEJCT_PAGE = $PROJECT_PAGE
PROJECT_MAIL = $PROJECT_MAIL
INSTALL = $INSTALL
INSTALL_PROGRAM = \$(INSTALL)
INSTALL_PROGRAM_STRIP = \$(INSTALL) -s
INSTALL_DATA = \$(INSTALL) -m 644
INSTALL_DIR = \$(INSTALL) -d
SHELL = $SHELL
CC = $CC
BISON = $BISON
@ -35,11 +47,40 @@ prefix = $prefix
exec_prefix = $exec_prefix
bindir = $bindir
sbindir = $sbindir
libexecdir = $libexecdir
datarootdir = $datarootdir
datadir = $datadir
sysconfdir = $sysconfdir
sharedstatedir = $sharestatedir
sharedstatedir = $sharedstatedir
localstatedir = $localstatedir
docdir = $docdir
infodir = $infodir
htmldir = $htmldir
dvidir = $dvidir
pdfdir = $pdfdir
psdir = $psdir
libdir = $libdir
localedir = $localedir
mandir = $mandir
man1dir = $man1dir
man2dir = $man2dir
man3dir = $man3dir
man4dir = $man4dir
man5dir = $man5dir
man6dir = $man6dir
man7dir = $man7dir
man8dir = $man8dir
man9dir = $man9dir
manext = $manext
man1ext = $man1ext
man2ext = $man2ext
man3ext = $man3ext
man4ext = $man4ext
man5ext = $man5ext
man6ext = $man6ext
man7ext = $man7ext
man8ext = $man8ext
man9ext = $man9ext
ALL_CFLAGS = \$(CFLAGS)
ALL_LDFLAGS = \$(LDFLAGS)
@ -49,12 +90,15 @@ ALL_FFLAGS = -t \$(FFLAGS)
vpath %.c ./src
vpath %.l ./src
vpath %.ggo ./src
vpath %.pl ./src
vpath %.sed ./src
vpath %.sh ./src
vpath %.texinfo ./doc
PROGRAMS = tok sen fla gph kot unfla grp mar ser kon rm12 rs12
PROGRAMS_SCRIPT = gph kot unfla grp mar ser kon rm12
PROGRAMS_EXEC = tok sen fla rs12
PROGRAMS = \$(PROGRAMS_SCRIPT) \$(PROGRAMS_EXEC)
DOC_FILES = utt.info utt.dvi utt.html utt.pdf utt.ps
TOK_OBJ_FILES = tok.o tok_cmdline.o
@ -109,58 +153,96 @@ rs12.o: rs12.c
CONFIG_FILES = src/config.h Makefile
.SUFFIXES:
.SUFFIXES: .l .y .h .c .pl .o
.SUFFIXES: .l .y .h .c .pl .o .texinfo .info .dvi .html .pdf .ps
.PHONY: help
help:
@\$(MAKE) --print-data-base --question | \\
@\$(MAKE) --print-data-base --question | \\
\$(GREP) '^[^.%][-A-Za-z0-9_]*:' | \\
\$(CUT) -f 1 -d : | \\
\$(GREP) -v '^Makefile$$' | \\
\$(GREP) -v '^Makefile\$\$' | \\
\$(SORT) | \\
\$(PR) --omit-pagination --width=80 --columns=4
.PHONY: all
all: \$(PROGRAMS)
.PHONY: install
install: all
.PHONY: install-strip
install:
.PHONY: doc
doc: info dvi html pdf ps
.PHONY: info
info: utt.info
.PHONY: install-info
install-info:
.PHONY: dvi
dvi: utt.dvi
.PHONY: install-dvi
install-dvi:
.PHONY: html
html: utt.html
.PHONY: install-html
install-html:
.PHONY: pdf
pdf: utt.pdf
.PHONY: install-pdf
install-pdf:
.PHONY: ps
ps: utt.ps
.PHONY: install-all
install-all: install install-doc
.PHONY: installdirs
installdirs:
\$(INSTALL_DIR) \$(DESTDIR)\$(prefix) \\
\$(DESTDIR)\$(exec_prefix) \\
\$(DESTDIR)\$(bindir) \\
\$(DESTDIR)\$(datarootdir) \\
\$(DESTDIR)\$(datadir) \\
\$(DESTDIR)\$(docdir) \\
\$(DESTDIR)\$(infodir) \\
\$(DESTDIR)\$(htmldir) \\
\$(DESTDIR)\$(dvidir) \\
\$(DESTDIR)\$(pdfdir) \\
\$(DESTDIR)\$(psdir) \\
.PHONY: install
install: installdirs
\$(INSTALL_PROGRAM) \$(PROGRAMS) \$(DESTDIR)\$(bindir)
.PHONY: install-strip
install-strip: installdirs
\$(INSTALL_PROGRAM) \$(PROGRAMS_SCRIPT) \$(DESTDIR)\$(bindir)
\$(INSTALL_PROGRAM_STRIP) \$(PROGRAMS_EXEC) \$(DESTDIR)\$(bindir)
.PHONY: install-doc
install-doc: install-info install-dvi install-html install-pdf install-ps
.PHONY: install-info
install-info: installdirs
\$(INSTALL_DATA) utt.info \$(DESTDIR)\$(infodir)
.PHONY: install-dvi
install-dvi: installdirs
\$(INSTALL_DATA) utt.dvi \$(DESTDIR)\$(dvidir)
.PHONY: install-html
install-html: installdirs
\$(INSTALL_DATA) utt.html \$(DESTDIR)\$(htmldir)
.PHONY: install-pdf
install-pdf: installdirs
\$(INSTALL_DATA) utt.pdf \$(DESTDIR)\$(pdfdir)
.PHONY: install-ps
install-ps:
install-ps: installdirs
\$(INSTALL_DATA) utt.ps \$(DESTDIR)\$(psdir)
.PHONY: uninstall
uninstall:
\$(RM) \$(foreach file,\$(PROGRAMS),\$(DESTDIR)\$(bindir)/\$(file))
\$(RM) \$(DESTDIR)\$(infodir)/utt.info
\$(RM) \$(DESTDIR)\$(dvidir)/utt.dvi
\$(RM) \$(DESTDIR)\$(htmldir)/utt.html
\$(RM) \$(DESTDIR)\$(pdfdir)/utt.pdf
\$(RM) \$(DESTDIR)\$(psdir)/utt.ps
\$(RMDIR) \$(DESTDIR)\$(docdir)
.PHONY: clean
clean:

View File

@ -19,12 +19,42 @@ Configuration summary
exec_prefix : $exec_prefix
bindir : $bindir
sbindir : $sbindir
libexecdir : $libexecdir
datarootdir : $datarootdir
datadir : $datadir
sysconfdir : $sysconfdir
sharedstatedir : $sharedstatedir
localstatedir : $localstatedir
docdir : $docdir
infodir : $infodir
htmldir : $htmldir
dvidir : $dvidir
pdfdir : $pdfdir
psdir : $psdir
libdir : $libdir
localedir : $localedir
mandir : $mandir
man1dir : $man1dir
man2dir : $man2dir
man3dir : $man3dir
man4dir : $man4dir
man5dir : $man5dir
man6dir : $man6dir
man7dir : $man7dir
man8dir : $man8dir
man9dir : $man9dir
manext : $manext
man1ext : $man1ext
man2ext : $man2ext
man3ext : $man3ext
man4ext : $man4ext
man5ext : $man5ext
man6ext : $man6ext
man7ext : $man7ext
man8ext : $man8ext
man9ext : $man9ext
INSTALL : $INSTALL
SHELL : $SHELL
CC : $CC
BISON : $BISON