#
# Makefile for BtYacc.
#

VERSION       = 3-0

DEST	      = .

HDRS	      = defs.h mstring.h

# Keep this as simple as possible. It's desirable that btyacc be portable
# across all of our supported compilers/platforms.

# Vanilla CFLAGS
CFLAGS=

# No LDFLAGS
#LDFLAGS=

LIBS=

# For GNU environment, gmake will set $CC to gcc
# Other environments will have different values, maybe no GNU installed!
#CC	      = gcc

MAKEFILE      = Makefile

OBJS	      = closure.o error.o lalr.o lr0.o main.o mkpar.o output.o	\
		mstring.o reader.o readskel.o skeleton.o symtab.o verbose.o warshall.o

PRINT	      = pr -f -l88

PROGRAM	      = btyacc

SRCS	      = closure.c error.c lalr.c lr0.c main.c mkpar.c output.c	\
		mstring.c reader.c readskel.c skeleton.c symtab.c verbose.c warshall.c

OTHERS	      = README README.BYACC \
		Makefile btyaccpa.ske push.skel empty.y skel2c manpage makefile.dos \
		skeleton.c

all:		$(PROGRAM)

$(PROGRAM):     $(OBJS) $(LIBS)
		$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)

clean:;		rm -f $(OBJS)

clobber:;	rm -f $(OBJS) $(PROGRAM)

distclean:;	rm -f $(OBJS) $(PROGRAM) *.zip *.gz

depend:;	mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST)

index:;		ctags -wx $(HDRS) $(SRCS)

install:	$(PROGRAM)
		cp $(PROGRAM).exe /bin

oldinstall:	$(PROGRAM)
		@echo Installing $(PROGRAM) in $(DEST)
		install -s $(PROGRAM) $(DEST)

listing:;	$(PRINT) Makefile $(HDRS) $(SRCS) | lpr

lint:;		lint $(SRCS)

program:        $(PROGRAM)

tags:           $(HDRS) $(SRCS)
		ctags $(HDRS) $(SRCS)

dist:		tar zip

tar:
		rm -f btyacc.tar btyacc.tar.gz
		tar cvf btyacc.tar $(OTHERS) $(SRCS) $(HDRS) test/*.y
		gzip -9 btyacc.tar
		mv btyacc.tar.gz btyacc-$(VERSION).tar.gz

zip:
		zip btyacc.zip $(OTHERS) $(SRCS) $(HDRS) test/*.y
		mv btyacc.zip btyacc-$(VERSION).zip

# skeleton.c now stored in CVS, not generated by build
#skeleton.c: btyaccpa.ske skel2c
#		awk -f skel2c btyaccpa.ske >skeleton.c

etags TAGS:
		etags *.c *.h

###
closure.o: defs.h
error.o: defs.h
lalr.o: defs.h
lr0.o: defs.h
main.o: defs.h
mkpar.o: defs.h
mstring.o: mstring.h
output.o: defs.h
reader.o: defs.h mstring.h
skeleton.o: defs.h
symtab.o: defs.h
verbose.o: defs.h
warshall.o: defs.h
