#! /bin/make -f
#
# Makefile - rather obvious isn't it
#
# This file is part of zsh, the Z shell.
#
# zsh is free software; no one can prevent you from reading the source
# code, or giving it to someone else.
# 
# This file is copyrighted under the GNU General Public License, which
# can be found in the file called COPYING.
# 
# Copyright (C) 1990, 1991 Paul Falstad
#
# zsh is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY.  No author or distributor accepts
# responsibility to anyone for the consequences of using it or for
# whether it serves any particular purpose or works at all, unless he
# says so in writing.  Refer to the GNU General Public License
# for full details.
# 
# Everyone is granted permission to copy, modify and redistribute
# zsh, but only under the conditions described in the GNU General Public
# License.   A copy of this license is supposed to have been given to you
# along with zsh so you can know your rights and responsibilities.
# It should be in a file named COPYING.
# 
# Among other things, the copyright notice and this notice must be
# preserved on all copies.
#

OBJS=builtin.o cond.o exec.o glob.o hist.o init.o jobs.o lex.o loop.o \
math.o mem.o params.o parse.o subst.o table.o text.o utils.o watch.o \
zle_bindings.o zle_hist.o zle_main.o zle_misc.o zle_move.o zle_refresh.o \
zle_tricky.o zle_utils.o zle_vi.o zle_word.o

BINDIR=/usr/local/bin
MANDIR=/usr/local/man/man1

# debugging flags
#CFLAGS=-g -Wreturn-type -Wunused -Wpointer-arith -DQDEBUG
#CC=gcc -traditional

CC=cc
CFLAGS= -O
LIBS= -lcurses

ZSHPATH=zsh

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

all: $(ZSHPATH)

$(ZSHPATH): $(OBJS)
	$(CC) -o $(ZSHPATH) $(OBJS) $(LIBS) $(LFLAGS)
	
tags: /tmp
	ctags *.[cy]

# I hate this next line
$(OBJS): config.h zsh.h zle.h signals.h ztype.h funcs.h

clean:
	rm -f *.o zsh core 

cleanall:
	rm -f *.o zsh core Makefile signals.h config.h

install: zsh
	install -s -m 755 zsh $(BINDIR)
	install -m 444 ../man/man1/zsh.1 $(MANDIR)
