# Makefile for tty2html
# Copyright (c) 2005 Ian Piumarta
#
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the 'Software'), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, provided
# that the above copyright notice(s) and this permission notice appear
# in all copies of the Software and that both the above copyright
# notice(s) and this permission notice appear in supporting
# documentation.
#
# THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.
# last edited: 2005-11-03 02:58:15 by piumarta on emilia.local
CFLAGS = -g -O
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/man
MAN1DIR = $(MANDIR)/man1
all : tty2html
tty2html : tty2html.c
clean : .FORCE
rm -f tty2html *~
.FORCE :
# ----------------------------------------------------------------
INSTALLDIRS = $(BINDIR) $(MANDIR) $(MAN1DIR)
BINFILES = $(BINDIR)/tty2html
MANFILES = $(MAN1DIR)/tty2html.1
MKDIR = install -d
RMDIR = rmdir
INSTALL = install -c
RM = rm -f
$(INSTALLDIRS) :
$(MKDIR) $@
$(BINDIR)/% $(MAN1DIR)/% : %
$(INSTALL) $< $@
install : $(INSTALLDIRS) $(BINFILES) $(MANFILES)
uninstall : .FORCE
-$(RM) $(BINFILES) $(MANFILES)
# ----------------------------------------------------------------
PACKAGE_VERSION = 1.0
PACKAGE_TARNAME = tty2html
TARNAME= $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
DISTFILES = \
$(TARNAME)/ChangeLog \
$(TARNAME)/COPYING \
$(TARNAME)/README \
$(TARNAME)/Makefile \
$(TARNAME)/BSDmakefile \
$(TARNAME)/config.h \
$(TARNAME)/tty2html.c \
$(TARNAME)/tty2html.1 \
$(TARNAME)/test.in \
$(TARNAME)/test.out
dist : .FORCE
rm -f $(TARNAME)
ln -s . $(TARNAME)
tar -cf $(TARNAME).tar $(DISTFILES)
gzip -v9 $(TARNAME).tar
rm -f $(TARNAME)
dist-test : .FORCE
rm -rf $(TARNAME)
tar -xz -f $(TARNAME).tar.gz
ln -s ../images $(TARNAME)/images
$(MAKE) -C $(TARNAME) test
rm -rf $(TARNAME)
# ----------------------------------------------------------------
test : tty2html
./tty2html -p < test.in > test.log
cmp test.log test.out
@echo
@echo SUCCESS
@echo
# ----------------------------------------------------------------
BSDmakefile : .FORCE
$(MAKE)
rm -rf /tmp/bsd
echo '# THIS FILE WAS GENERATED AUTOMATICALLY' > BSDmakefile
echo '# EDIT AT YOUR OWN RISK' >> BSDmakefile
echo '# ' >> BSDmakefile
sed '/# -/,$$d' < Makefile >> BSDmakefile
echo 'install : .FORCE' >> BSDmakefile
$(MAKE) install PREFIX=/tmp/bsd | \
sed 's,/tmp/bsd/man/man1,$$(MAN1DIR),g' | \
sed 's,/tmp/bsd/man,$$(MANDIR),g' | \
sed 's,/tmp/bsd/bin,$$(BINDIR),g' | \
sed 's,^, ,g' >> BSDmakefile
echo >> BSDmakefile
echo 'uninstall : .FORCE' >> BSDmakefile
$(MAKE) uninstall PREFIX=/tmp/bsd | \
sed 's,/tmp/bsd/man/man1,$$(MAN1DIR),g' | \
sed 's,/tmp/bsd/man,$$(MANDIR),g' | \
sed 's,/tmp/bsd/bin,$$(BINDIR),g' | \
sed 's,^, ,g' >> BSDmakefile
rm -f BSDtemp
rm -rf /tmp/bsd