#!/usr/bin/make -f
#
#   Mash -- MAke SHell
#   Copyright (c) 1997  Salvatore Valente <svalente@mit.edu>
#
#   This program is free software.  You can modify and distribute it under
#   the terms of the GNU General Public License.  There is no warranty.
#   See the file "COPYING" for more information.
#
#   $Revision: 1.6 $
#
#   Makefile for Mash
#   Sort of a contradicition.  Oh well, maybe this will be the last
#   Makefile that I ever write...
#

VPATH=		@srcdir@
srcdir=		@srcdir@
prefix=		@prefix@
exec_prefix=	@exec_prefix@
bindir=		@bindir@
etcdir=		@sysconfdir@
datadir=	@datadir@

PROG=		mash
OBJS=		mash.o getopt.o hash.o list.o tklist.o lex.o compile.o \
		interp.o glob.o exec.o rule.o test.o function.o
CC=		gcc -Wall
CFLAGS=		@CFLAGS@
ALL_CFLAGS=	$(CFLAGS) -I$(srcdir)
LDFLAGS=	@LDFLAGS@
INSTALL=	@INSTALL@
config=		$(etcdir)/mash.conf

all: $(PROG)

$(PROG): $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

mash.o: mash.c
	$(CC) $(ALL_CFLAGS) -DCONFIG_FILE=\"$(config)\" -c $<

.c.o:
	$(CC) $(ALL_CFLAGS) -c $<

install: all
	$(INSTALL) -s $(PROG) $(bindir)
	$(INSTALL) -m 644 mash.conf $(config)

clean:
	rm -f $(PROG) *.o *~ core

distclean: clean
	rm -f Makefile Mashfile TAGS config.cache config.log config.status
	rm -f mash.conf
