
#
# This makefile is automatically generated by imake... do not modify
# or you may lose your changes when imake generates makefiles again.
# Ignore this message if you are not using imake.
#

            TOP = /mit/cgw
             AS = as
             CC = cc
            CPP = /lib/cpp
             LD = ld
           LINT = lint
       LINTOPTS = -abchpx
           MAKE = make

    CDEBUGFLAGS = -O
        DESTDIR =

            TOP = /mit/cgw
        INSTALL = install
           TAGS = etags
         CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(DEFINES)
        LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES)
   INSTLIBFLAGS = -c -m 0664
          GWLIB = $(TOP)/"vax"/libexl
      GWLIBINST = $(TOP)/"vax"/lib
         DEVLIB = libdev.a
        FAKELIB = libfake.a
        GATELIB = libgate.a
        PROTLIB = libprot.a
          APLIB = libappl.a
         NETLIB = libnet.a
           CLIB = libc.a
            SCB = scb.o
            CRT = crt.o
         CRTDDT = crtddt.o
         DDTLIB = libddt.a
          DDTST = isymt.o
      FAKEDDTST = fst.o
         SYSLIB = libsys.a
          TOOLS = $(TOP)/src/tools
        TOOLBIN = $(TOP)/"vax"/bin
        TOOLMAN = $(TOP)/man/ManSuffix
         DOCSRC = $(TOP)/doc
         DEPEND = $(TOOLBIN)/makedepend
      DEPENDSRC = $(TOOLS)/makedepend
       IMAKESRC = $(TOOLS)/imake

       INCLUDES = -I$(TOP)/src/gw -I$(TOP)/src/sys/include
      MACROFILE = Vax.macros
          IMAKE = $(TOOLBIN)/imake

      IMAKE_CMD = $(IMAKE) -TImake.tmpl \
			-I$(TOOLS)/imake.includes \
			-s Makefile
         RM_CMD = rm -f *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
			tags TAGS make.log

#
# SUBDIRS is a magic name -- Imake.tmpl uses it if  defined
#
# someday add tftp

     SUBDIRS = gw sys ddt

#
# before doing the depend, be sure that makedepend exists
#
#depend:: $(DEPEND)
#
#$(DEPEND):
#	@echo "making $(DEPENDSRC)"; \
#	cd $(DEPENDSRC); $(MAKE) clean; $(MAKE); $(MAKE) install

#
# before making the makefiles, be sure that imake exists.
#
#Makefiles:: $(IMAKE)
#
#$(IMAKE):
#	@echo "making $(IMAKESRC)"; \
#	cd $(IMAKESRC); $(MAKE) clean; $(MAKE); $(MAKE) install

clean::
	$(RM_CMD) \#*

Makefile:: Imakefile \
	$(TOOLS)/imake.includes/Imake.tmpl \
	$(TOOLS)/imake.includes/Imake.rules \
	$(TOOLS)/imake.includes/$(MACROFILE)
		-rm -f Makefile.bak; mv Makefile Makefile.bak
		$(IMAKE_CMD) -DTOPDIR=$(TOP)

tags::
	$(TAGS) -w *.[ch]
	$(TAGS) -xw *.[ch] > TAGS

all::
	@case '${MFLAGS}' in *[ik]*) set +e;; esac; \
	for i in $(SUBDIRS) ;\
	do \
		(cd $$i ; echo "making $$i"; \
			$(MAKE)  $(MFLAGS)); \
	done

install::
	@case '${MFLAGS}' in *[ik]*) set +e;; esac; \
	for i in $(SUBDIRS) ;\
	do \
		(cd $$i ; echo "installing $$i"; \
			$(MAKE) $(MFLAGS) \
				INSTALL='$(INSTALL)' \
				DESTDIR='$(DESTDIR)' install ); \
	done

clean::
	@case '${MFLAGS}' in *[ik]*) set +e;; esac; \
	for i in $(SUBDIRS) ;\
	do \
		(cd $$i ; echo "cleaning $$i"; \
			$(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean ); \
	done

tags::
	@case '${MFLAGS}' in *[ik]*) set +e;; esac; \
	for i in $(SUBDIRS) ;\
	do \
		(cd $$i ; echo "tagging $$i"; \
			$(MAKE) $(MFLAGS) TAGS='$(TAGS)' tags ); \
	done

Makefiles::
	@case '${MFLAGS}' in *[ik]*) set +e;; esac; \
	for i in $(SUBDIRS) ;\
	do \
		echo "Making Makefiles in $$i..."; \
		case "$$i" in \
		./?*/?*/?*) newtop=../../../ sub=subsubsub;; \
		./?*/?*)    newtop=../../ sub=subsub;; \
		./?*)       newtop=../ sub=sub;; \
		*/?*/?*)    newtop=../../../ sub=subsubsub;; \
		*/?*)       newtop=../../ sub=subsub;; \
		*)	    newtop=../ sub=sub;; \
		esac; \
		$(MAKE) $${sub}dirMakefiles NEWTOP=$$newtop \
			MAKEFILE_SUBDIR=$$i;\
	done

subdirMakefiles:
	rm -f $(MAKEFILE_SUBDIR)/Makefile.bak
	-mv $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak
	cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(TOP)/..; \
	$(MAKE) $(MFLAGS) Makefiles

subsubdirMakefiles:
	rm -f $(MAKEFILE_SUBDIR)/Makefile.bak
	-mv $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak
	cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(TOP)/../..; \
	$(MAKE) $(MFLAGS) Makefiles

subsubsubdirMakefiles:
	rm -f $(MAKEFILE_SUBDIR)/Makefile.bak
	-mv $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak
	cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(TOP)/../../..; \
	$(MAKE) $(MFLAGS) Makefiles

depend::
	@case '${MFLAGS}' in *[ik]*) set +e;; esac; \
	for i in $(SUBDIRS) ;\
	do \
		(cd $$i ; echo "depending $$i"; \
			$(MAKE) $(MFLAGS) depend ); \
	done

