% Copyright (C) 1994, Digital Equipment Corporation
% All rights reserved.
% See the file COPYRIGHT for a full description.
%
% Last modified on Fri Apr  7 12:04:02 PDT 1995 by kalsow
%      modified on Tue May 10 11:00:22 PDT 1994 by wobber
%      modified on Tue Feb  2 19:10:04 1993 by hisgen
%      modified on Tue Nov 14 08:29:56 1989 by roberts
%      modified on Fri Nov 28 09:37:24 1986 by mcvl


% c_source ("file")
% c_source ("inttable")
% c_source ("strlib")
% c_source ("varrayptr")
% c_source ("err")
% c_source ("llscan")

% if defined ("_all")
%   local prog = "llscan"
%   local form = format ("-DDEFAULT_FORM=\\\"%s%sscan.llscan\\\"", LIB_USE, SL)
%   if stale (prog, COMPILE_SOURCES)
%     exec (CC, "-I../src -D_BSD", form, "-o", prog, COMPILE_SOURCES)
%   end
%   BindExport (prog)
% end

readonly proc simple_c_program(nm, c_sources) is
  local toss = 0
  local pgm = program_name (nm)
  local objects = []
  local sources = []
  local options = [ "-I" & path_of (""), "-D_BSD",
    format ("-DDEFAULT_FORM=\\\"%s%sscan.llscan\\\"", LIB_USE, SL) ]

  foreach f in c_sources
    sources += path_of (f & ".c")
    objects += f & ".o"
  end

  if defined ("_all")
    if stale (pgm, sources)
      toss = compile_c (sources, [], options, FALSE, FALSE)
      GCWRAPFLAGS=""
      toss = m3_link (pgm, [], objects, SYSTEM_LIBS {"LIBC"}, FALSE)
    end
  end

  deriveds("", [ objects, pgm ])
  BindExport (pgm)
end

simple_c_program ("llscan", [ "file", "inttable", "strlib",
                              "varrayptr", "err", "llscan" ])

ManPage ("llscan", 1)
LibExport ("scan.llscan")

