# Generated automatically from Makefile.in by configure.
TOP = .
srcdir = .

CMP_INSTALL_DIR = /usr/local/bin

# We want the top-level Makefile to work even if we have not
# configured the system.  So, the top-level Makefile just
# includes commondefs.

include $(srcdir)/config/commondefs

SUBDIRS = config bin common fe or client
ISUBDIRS = config bin common fe or

# Do not blow away top-level Makefile
CLOBBER = config/config.h config/Makedefs config.status .depend .configured\
	  config.log config.cache

# XXX
# We could depend on the rule for building config.status in commondefs,
# but that keeps sticking an extra "./" into srcdir every time.

config.status: $(srcdir)/configure
	if test -f config.status; then\
		config.status --recheck;\
	else\
		$(srcdir)/configure -no-create;\
	fi

$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/config/acaux.m4
	cd $(srcdir); autoconf 

save-prebuilt:
	@if [ ! -d pre-built ]; then mkdir pre-built; fi
	mv fe/fe pre-built/fe
	mv or/or pre-built/or

save-cmp:
	@if [ ! -d cmp-exe ]; then mkdir cmp-exe; fi
	mv fe/fe cmp-exe/cmpfe
	mv client/C++/theta_compiler/theta cmp-exe/theta
	mv or/or cmp-exe/cmpor

install-cmp:
	cp cmp-exe/theta $(CMP_INSTALL_DIR)
	cp cmp-exe/cmpfe $(CMP_INSTALL_DIR)
	cp cmp-exe/cmpor $(CMP_INSTALL_DIR)

boot:
	echo Beginning init
	$(MAKE) init
	echo Beginning initial-depend
	$(MAKE) initial-depend
	echo Beginning initial-build
	$(MAKE) initial-build
	echo Building veneer
	cd client/C++/veneer ; $(MAKE)
	echo Beginning global depend
	$(MAKE) depend
	echo Beginning global build
	$(MAKE)

init:
	cd config ; $(MAKE) depend ; cd .. ; \
	cd fe ; $(MAKE) init; cd .. ; \
	cd fe/runtime ; $(MAKE) special_methods.h ; cd ../.. ; \
	cd fe ; $(MAKE) specs.c

initial-build:
	@sub="$(ISUBDIRS)";                             \
	for d in $$sub; do if test -d $$d; then         \
		(cd $$d; $(MAKE) CUR=$(CUR)/$$d);       \
	else $(ECHO) "WARNING: subdirectory $$d is absent."; fi; done
	@$(ECHO) making in $(CUR)

initial-depend:
	@sub="$(ISUBDIRS)";				 \
	for d in $$sub; do if test -d $$d; then		 \
		(cd $$d; $(MAKE) CUR=$(CUR)/$$d depend); \
	else $(ECHO) "WARNING: subdirectory $$d is absent."; fi; done
	$(ECHO) depending in $(CUR)

depend: Makefile
	@sub="$(SUBDIRS)";				 \
	for d in $$sub; do if test -d $$d; then		 \
		(cd $$d; $(MAKE) CUR=$(CUR)/$$d depend); \
	else $(ECHO) "WARNING: subdirectory $$d is absent."; fi; done
	$(ECHO) depending in $(CUR)
