#
# Copyright (c) 1987 Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# distribution and use acknowledge that the software was developed
# by the University of California, Berkeley.  The name of the
# University may not be used to endorse or promote products derived
# from this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
#	@(#)Makefile	5.9 (Berkeley) 9/15/88
#

#
# Currently set up for Lattice C 5.02 with Mike Meyer's version of Fred
# Fish's cc command, and Mike Meyer's version of Steve Walton's Amiga
# port of a PD make from comp.sources.misc.
#

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

CFLAGS  = -DUSG -Apr -O

SRCS     = indent.c io.c lexi.c parse.c pr_comment.c args.c globs.c getenv.c
OBJS     = indent.o io.o lexi.o parse.o pr_comment.o args.o globs.o getenv.o
HEADERS  = indent_globs.h version.h
MAN      = indent.texinfo ChangeLog Projects
TARFILES = ${SRCS} Makefile ${MAN} ${HEADERS} indent.gperf

# -g is here rather than in CFLAGS since many versions of cc do not
# allow -g with -O
#CC=gcc -g

CC       = cc

all: indent

indent: ${OBJS}
	${CC} -o $@ ${CFLAGS} ${OBJS}

#
# Lattice C 5.02 can't optimize indent.  It runs out of memory on my 2.5 Meg
# amiga.
#
indent.o : indent.c
	${CC} -DUSG -Ap -c indent.c

indent.tar.Z: ${TARFILES}
	rm -f indent.tar.Z
	mkdir dist-indent
	cd dist-indent ; for i in ${TARFILES} ; do ln -s ../$$i . ; done
# Note: requires GNU tar
	tar -c -h -z -f indent.tar.Z dist-indent
	rm -rf dist-indent

${OBJS}: indent_globs.h
args.o: version.h

clean:
	rm -f ${OBJS} core indent

cleandir: clean
	rm -f ${MAN} tags .depend

depend: ${SRCS}
	mkdep ${CFLAGS} ${SRCS}

lint: ${SRCS}
	lint ${CFLAGS} ${SRCS}

tags: ${SRCS}
	ctags ${SRCS} ${HEADERS}
