# Makefile: a makefile 
# Location: $(TOP)/aumc/.
# Executed-By: $(TOP)/Makefile

# parser generator
YACC			=bison -y

# g++ path
PLUSPLUS		=g++

# options for g++
OPTION			=

# top directory of source files
TOP				=/home/csls4/konishi/aum

# a script for 'make depend'
MAKEDEPEND		=csh -f /home/csls4/konishi/aum/pas/etc/makedepend

# a script to make directories
MKDIRP			=sh /home/csls4/konishi/aum/pas/etc/mkdir-p

# directory where aumc is installed
INSTALLBINDIR	=/tmp/aum/bin

# Macro definition to tell g++ that new iostream library is available
STREAMLIB		=-DIOSTREAM_2_0

# Makefile.in: a skelton for a makefile
# Location: $(TOP)/aumc
# Referred-by: $(TOP)/aumc/Makefile.sh

.SUFFIXES:	.lex

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

CC				= $(PLUSPLUS)

PROGRAM			= aumc

MAKEFILE		= Makefile

SUBDIRS			= ./struct ./register ./code ./syntax ./scope

HDR			= lex.h \
		aumc.h \
		parse.h \
		version.h \
		makedate.h

SRC				= y.tab.c \
		aumc.c \
		version.c \
		makedate.c

OBJ				= y.tab.o \
		aumc.o \
		lex.yy.o \
		version.o \
		makedate.o

SYSINCLUDES		= -I/usr/gnu/lib/g++-include

INCLUDES		= -I./scope -I./syntax -I./register -I./code -I./struct

CFLAGS			= $(OPTION) $(STREAMLIB) $(INCLUDES)

SYSLIB			= -lm

AUMLIB			= scope/libSC.a \
				syntax/libSN.a \
				code/libCD.a \
				register/libreg.a \
				struct/libstruct.a

LIB				= $(SYSLIB) $(AUMLIB)

all		:	library $(PROGRAM)

$(PROGRAM)	: $(AUMLIB) $(OBJ)
	touch makedate.sh
	make makedate.o
	$(CC) -o $(PROGRAM) $(OBJ) $(LIB)

library :
	@for i in $(SUBDIRS); \
		do (cd $$i ; make); \
	done

y.tab.c y.tab.h	: parse.y
	$(YACC) -dtv parse.y

lex.yy.o		: lex.yy.c lex.h y.tab.h
	gcc -c $(CFLAGS) lex.yy.c

lex.yy.c		: aumc.lex
	flex -8 -L aumc.lex

makedate.c		: makedate.sh
	sh makedate.sh > makedate.c

depend			: depend_subdirs $(SRC)
	$(MAKEDEPEND) $(INCLUDES) $(SRC)

depend_subdirs	:
	@for i in $(SUBDIRS); do \
		echo "(cd $$i ; make depend)"; \
		(cd $$i ; make depend) \
	done

clean			: clean_subdirs
	rm -f $(PROGRAM) *.o *~ core y.output lex.yy.c y.tab.[ch] \
			.gdbinit makedate.[co]

clean_subdirs	:
	@for i in $(SUBDIRS); do \
		(cd $$i ; make clean) \
	done

install			: all
	$(MKDIRP) $(INSTALLBINDIR)
	install -cs $(PROGRAM) $(INSTALLBINDIR)


# DO NOT DELETE THIS LINE -- make depend depends on it.

y.tab.o : y.tab.c syntax/SNname.h struct/Name.h struct/gList.h struct/List.h \
  syntax/SNunitList.h syntax/SNunit.h struct/freshString.h register/Rind.h \
  syntax/SNclass.h syntax/SNnameList.h syntax/SNmethodList.h syntax/SNmethod.h \
  syntax/SNstream.h struct/OnOff.h syntax/SNstreamList.h struct/gMHList.h \
  struct/MHList.h syntax/SNvolList.h syntax/SNfgnmtd.h struct/numlabel.h \
  syntax/SNstring.h syntax/SNliteral.h code/CDcstring.h code/inst.h struct/cstring.h \
  syntax/SNmessage.h syntax/SNclosed.h syntax/SNdefmsg.h syntax/SNnil.h \
  syntax/SNsymbol.h code/CDcatom.h syntax/SNint.h code/CDcint.h syntax/SNfloat.h \
  code/CDcfloat.h syntax/SNdouble.h code/CDcdouble.h syntax/SNbool.h code/CDcbool.h \
  syntax/SNbnkstr.h syntax/SNlist.h syntax/SNvector.h syntax/SNfvector.h \
  syntax/SNoslot.h syntax/SNislot.h syntax/SNself.h code/CDgetself.h code/instR.h \
  syntax/SNsink.h code/CDcsink.h syntax/SNsend.h syntax/SNsendself.h syntax/SNmsgArray.h \
  struct/gArray.h struct/Array.h syntax/SNconnect.h syntax/SNappend.h \
  syntax/SNnew.h code/PIclassref.h syntax/Classref.h syntax/SNminus.h \
  syntax/SNunop.h syntax/SNunarg.h code/CDminus.h code/inst2R.h syntax/SNinlet.h \
  syntax/SNorder.h syntax/SNplain.h syntax/SNerror.h syntax/SNwho.h syntax/SNcaro.h \
  code/CDcaro.h syntax/SNscaro.h syntax/SNcdro.h code/CDcdro.h syntax/SNscdro.h \
  syntax/SNelto.h syntax/SNbinop.h syntax/SNbinarg.h code/CDelto.h code/inst3R.h \
  syntax/SNseto.h syntax/SNclassof.h code/CDclassof.h syntax/SNissimple.h \
  syntax/SNuncond.h syntax/SNcond.h syntax/Protocol.h code/CDissimple.h \
  code/CDifsimple.h code/instR2L.h code/LabelName.h syntax/SNisbuiltin.h \
  code/CDisbuiltin.h code/CDifbuiltin.h syntax/SNnot.h code/CDnot.h syntax/SNsislot.h \
  syntax/SNsoslot.h syntax/SNsioslot.h syntax/SNlt.h syntax/SNbincond.h \
  code/CDif_gt.h code/inst2R2L.h code/CDgt.h syntax/SNgt.h syntax/SNle.h \
  code/CDif_ge.h code/CDge.h syntax/SNge.h syntax/SNor.h code/CDor.h \
  syntax/SNxor.h code/CDxor.h syntax/SNand.h code/CDand.h syntax/SNequal.h \
  code/CDif_equal.h code/CDequal.h syntax/SNnequal.h code/CDnequal.h syntax/SNshtl.h \
  code/CDshtl.h syntax/SNshtr.h code/CDshtr.h syntax/SNplus.h code/CDadd.h \
  syntax/SNsub.h code/CDsub.h syntax/SNmul.h code/CDmul.h syntax/SNdiv.h \
  code/CDdiv.h syntax/SNmod.h code/CDmod.h syntax/SNanonout.h syntax/SNanonin.h \
  syntax/closePcol.h syntax/defPcol.h syntax/errmsg.h scope/SCclass.h \
  scope/SCimport.h scope/SCvar.h struct/indent.h syntax/SNvolatile.h syntax/SNunitArray.h \
  syntax/SNtcs.h parse.h aumc.h lex.h 
aumc.o : aumc.c syntax/SNunit.h struct/freshString.h register/Rind.h syntax/SNclass.h \
  syntax/SNname.h struct/Name.h struct/gList.h struct/List.h syntax/SNnameList.h \
  syntax/SNmethodList.h syntax/SNtree.h struct/MHList.h syntax/SNerror.h \
  syntax/SNmethod.h syntax/SNunitList.h syntax/SNstream.h struct/OnOff.h \
  syntax/SNstreamList.h struct/gMHList.h syntax/SNvolList.h struct/intMHList.h \
  scope/SCtree.h scope/SCclass.h struct/gArray.h struct/Array.h scope/SCimport.h \
  scope/SCvar.h struct/indent.h syntax/SNvolatile.h syntax/SNunitArray.h \
  syntax/Classref.h code/PIclassref.h code/inst.h syntax/Protocol.h syntax/SNmessage.h \
  y.tab.h version.h makedate.h parse.h aumc.h lex.h 
version.o : version.c version.h 
makedate.o : makedate.c makedate.h 
