!
! Makefile to build MAKE
!

%ifdef PMDF
%ifdef __VAX
SYSDIR = [vax_exe]
OBJDIR = [vax_obj]
%else
SYSDIR = [alpha_exe]
OBJDIR = [alpha_obj]
%endif
DOCDIR = [doc]
%else
SYSDIR = []
OBJDIR = []
DOCDIR = []
%endif

DISTDIR = [.dist]

%ifdef __VAX
CC = cc/obj=$(OBJDIR) 'ccflags
OPTFILE = []make.opt
%else
CC = cc/standard=vaxc/extern_model=common_block/obj=$(OBJDIR) 'ccflags
OPTFILE = []make-a.opt
%endif

LINK = link/exe=$(SYSDIR) 'lflags

OBJS = $(OBJDIR)make.obj,-
       $(OBJDIR)mstring.obj,-
       $(OBJDIR)cmdline.obj,-
       $(OBJDIR)makecmd.obj,-
       $(OBJDIR)dates.obj,-
       ${OPTFILE}/opt

make: ${SYSDIR}make.exe ${DOCDIR}make.hlb(make) # This is the executable.

# the backslash '\' is the continuation character if it occurs as
# the last non-white character on the line.
# the hyphen '-' is the DCL continuation character, so if it occurs
# as the last non-white character on the line, the next line will
# not have the dollar sign '$' prepended.

${SYSDIR}make.exe: ${OBJS}
  ${LINK} ${OBJS}

${DOCDIR}make.hlb(make): make.hlp
  lib/help ${DOCDIR}make.hlb make.hlp

${DOCDIR}*.hlb:
  lib/cre/help ${DOCDIR}$*

$(OBJDIR)makecmd.obj: makecmd.cld
  set command/obj=$(OBJDIR) makecmd

$(OBJDIR)make.obj: make.c make.h functions.h cmdline.h strings.h simple.h clidef.h
  $(CC) make

$(OBJDIR)mstring.obj: mstring.c make.h functions.h simple.h
  $(CC) mstring

$(OBJDIR)cmdline.obj: cmdline.c cmdline.h strings.h
  $(CC) cmdline

$(OBJDIR)dates.obj: dates.c simple.h strings.h cmdline.h
  $(CC) dates

debug:
  ccflags := /debug/nooptimize
  lflags := /debug

${DISTDIR}make.exe: make.exe
  copy make.exe ${DISTDIR}/log

${SYSDIR}make.ini: make.ini
  copy make.ini ${SYSDIR}/log

clean:
  purge/log
  purge/log ${DISTDIR}

test_$:	# the dollar sign at the end of the line
	# means don't put a dollar sign at the beginning of the line in the
	# command file.
 type sys$input:
	Now is the time for all good men to come to the aid of their $ #test
	countrymen. $ !test

EXAMPLES = makefile.,make.ini
DOCS = release.v34,make.hlp
SOURCES = make.c,mstring.c,cmdline.c,dates.c,makecmd.cld,-
          make.h,functions.h,cmdline.h,strings.h,simple.h,clidef.h,-
          ${OPTFILE}
DISTLIST =  ${DOCS},${EXAMPLES},make.exe,${SOURCES}

dist: dist.dir ${DISTDIR}make.bck
  purge/log ${DISTDIR}

${DISTDIR}make.bck: ${DISTLIST}
  purge/log
  backup/list/buffer=5 ${DISTLIST} ${DISTDIR}make.bck/save
