% 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


sources = [ "file", "inttable", "strlib", "varrayptr", "err", "llscan" ]

c_files = [ ] 
o_files = [ ] 

foreach s in sources
  c_source (s)
  c_files += format("..%ssrc%s%s%s", SL, SL, s, ".c" )
  o_files += format("%s%s", s, ".o" )
end

if defined ("_all")
  local prog = "llscan"
  local form = format ("-DDEFAULT_FORM=\"%s%sscan.llscan\"", LIB_USE, SL)
  local ret = 0

  % What if CC is "gcc -c"?
  % local compile = [ CC, "-I../src", "-D_BSD", form, "-o", prog, c_files ]
  local compile = [ CC, "-c", "-I../src", "-D_BSD", form, c_files ]
  local link = [ LINK, "-o", prog, o_files ]
  if stale (prog, c_files)
    write(compile, "\n")
    ret = exec (compile)
    if not equal(ret, 0) error("command failed with error code: ", ret) end
    write(link, "\n")
    ret = exec (link)
    if not equal(ret, 0) error("command failed with error code: ", ret) end
  end
  BindExport (prog)
end

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

OtherPackage("llscan")
