# $Id: makefile.in,v 1.14 2007/02/15 00:22:52 tom Exp $
# Makefile-template for 'add'

THIS = add
RELEASE = t20070214
SCREEN = curses

#### Start of system configuration section. ####

srcdir = .

CC		= cc
LINK		= $(CC)
INSTALL		= /usr/bin/install -c -o root -g wheel
INSTALL_PROGRAM	= install  -s -o root -g wheel -m 555
INSTALL_DATA	= install  -o root -g wheel -m 444

LIBS		= -lncurses 
CPPFLAGS	=  -DHAVE_CONFIG_H -DADD_HELPFILE=\"/usr/local/share/add\" -DRELEASE=\"$(RELEASE)\" -I. -I$(srcdir)
CFLAGS		= -fno-common 
LDFLAGS		= 

prefix		= /usr/local
exec_prefix	= ${prefix}

bindir		= $(DESTDIR)${exec_prefix}/bin
mandir		= $(DESTDIR)${prefix}/man/man1
manext		= 1

x		= 

#### End of system configuration section. ####

SHELL		= /bin/sh

.c.o:
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<

OBJ = $(THIS).o $(SCREEN).o

PROG	= $(THIS)$x

all:	$(PROG)

$(PROG): $(OBJ)
	$(LINK) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)

$(OBJ): $(THIS).h screen.h

install: all installdirs
	$(INSTALL_PROGRAM) $(PROG) $(bindir)/$(PROG)
	$(INSTALL_PROGRAM) $(THIS).hlp $(bindir)/$(THIS).hlp
	$(INSTALL_DATA) $(srcdir)/$(THIS).1 $(mandir)/$(THIS).$(manext)

installdirs:
	$(SHELL) ${srcdir}/mkdirs.sh $(bindir) $(mandir)

uninstall:
	rm -f $(bindir)/$(PROG)
	rm -f $(bindir)/$(THIS).hlp
	rm -f $(mandir)/$(THIS).$(manext)

mostlyclean:
	rm -f *.o core *~ *.BAK *.trace *.atac

clean: mostlyclean
	rm -f $(PROG)

distclean: clean
	rm -f makefile config.log config.cache config.status config.h

realclean: distclean
	rm -f tags TAGS # don't remove configure!

tags:
	ctags $(THIS).c $(HDRS)

TAGS:
	etags $(THIS).c $(HDRS)

# I keep my sources in RCS, and assign a symbolic release to the current patch
# level.  The 'manifest' script knows how to build a list of files for a given
# revision.
MANIFEST:
	manifest -r$(RELEASE) \
		$(THIS).man testing/case*.dcl testing/case*.bat

dist: MANIFEST
	- rm -f .fname .files
	echo $(THIS)-$(RELEASE) >.fname
	cat MANIFEST | grep ' ' | egrep -v ' subdirectory$$' | sed -e 's/\ .*//' | uniq >.files
	rm -rf `cat .fname`
	TOP=`cat .fname`; mkdir $$TOP `cat .files | grep / | sed -e 's@/.*@@' | sed -e s@\^@$$TOP/@ | uniq`
	for file in `cat .files`; do \
	  ln $(srcdir)/$$file `cat .fname`/$$file \
	    || { echo copying $$file instead; cp $$file `cat .fname`/$$file; }; \
	done
	tar cf - `cat .fname` | gzip >`cat .fname`.tgz
	rm -rf `cat .fname` .fname .files
	ls -l *.tgz

# Some of the output will be uuencoded because the test scripts include
# <CR><LF> terminated ".bat" files for MS-DOS.
dist-shar: MANIFEST
	- rm -f .fname .files
	echo $(THIS)-$(RELEASE) >.fname
	cat MANIFEST | grep ' ' | egrep -v ' subdirectory$$' | sed -e 's/\ .*//' | uniq >.files
	shar -M -n`cat .fname` -opart -l50 `cat .files`
	- rm -f .fname .files
	ls -l part.*

$(THIS).o:	config.h

check: $(PROG)
	cd testing; sh ./run_test.sh	


syntax highlighted by Code2HTML, v. 0.9.1