# Makefile for rc.
CC=gcc
LD=ld
CFLAGS=-O

# Uncomment this line if you have defined the NOEXECVE macro in config.h
# EXECVE=execve.o

# Define this macro if you wish to extend rc via locally-defined builtins.
# An interface is provided in addon.[ch]. Note that the author does not
# endorse any such extensions, rather hopes that this way rc will become
# useful to more people.
#ADDON=addon.o

# You may substitute "bison -y" for yacc. (You want to choose the one that
# makes a smaller y_tab.c.)
YACC=bison -y

OBJS=$(ADDON) builtins.o except.o exec.o $(EXECVE) fn.o footobar.o getopt.o \
	glob.o glom.o hash.o heredoc.o input.o lex.o list.o main.o match.o \
	nalloc.o open.o print.o redir.o sigmsgs.o signal.o status.o tree.o \
	utils.o var.o version.o wait.o walk.o which.o y_tab.o

# If rc is compiled with READLINE defined, you must supply the correct
# arguments to ld on this line. Typically this would be something like:
#
#	$(CC) -o $@ $(OBJS) -lreadline -ltermcap

rc: $(OBJS)
	$(CC) -o rc $(OBJS)

# sigmsgs.c: mksignal
#	sh mksignal /usr/include/sys/signal.h

y_tab.c: parse.y
	$(YACC) -d parse.y

trip: rc
	./rc -p < trip.rc

clean:
	rm -f *.o *.tab.*

clobber: clean
	rm -f rc

history:
	cd history; make CC="$(CC)" $(HISTORYMAKEFLAGS)
