#	@(#)Makefile	5.24 (Berkeley) 7/1/91
#
# C Shell with process control; VM/UNIX VAX Makefile
# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
#
# Linux changes by Ken Clark 1/6/93

CFLAGS	= -O3 -s -fstrength-reduce -DFILEC -DNLS \
	  -DSHORT_STRINGS -D__USE_BSD -D__USE_BSD_SIGNAL -I.
# I wanted -fwritable-strings but GCC complained.  Why?  Seems it is not
# needed anyway.

OBJS	= alloc.o char.o const.o csh.o dir.o dol.o err.o exec.o exp.o file.o \
	  func.o glob.o hist.o init.o lex.o misc.o parse.o print.o printf.o \
	  proc.o sem.o set.o str.o time.o

CC	= gcc

csh:	$(OBJS)
	$(CC) -s -o csh $(OBJS)

err.h: 
	@rm -f $@
	@echo '/* Do not edit this file, make creates it. */' > $@
	@echo '#ifndef _h_sh_err' >> $@
	@echo '#define _h_sh_err' >> $@
	egrep 'ERR_' $*.c | egrep '^#define' >> $@
	@echo '#endif /* _h_sh_err */' >> $@

# I have included a const.h and err.h.  It seems my sed is broken
# with the new shared libs.  Don't know why.

const.h: 
	@rm -f $@
	@echo '/* Do not edit this file, make creates it. */' > $@
	${CC} -E ${CFLAGS} $*.c | egrep 'Char STR' | \
	    sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
	    sort >> $@

clean: 
	rm -f csh *.o core
