libm3/src/bundleintf/bundle.tmpl


% Copyright (C) 1994, Digital Equipment Corporation
% All rights reserved.
% See the file COPYRIGHT for a full description.
%
% Last modified on Mon Apr 15 08:11:51 CDT 1996 by kalsow
%

%---------------------------------------------------------------- resources ---

RESOURCES = {} % list of resources to bundle

readonly rsrc_extensions = [ ".i3", ".ic", ".is", ".io", "_i.o",
                             ".m3", ".mc", ".ms", ".mo", "_m.o" ]

if defined("M3BUNDLE")
  _M3BUNDLE = M3BUNDLE
else
  _M3BUNDLE = BIN_USE & SL & "m3bundle"
end

readonly proc resource_named(rd, x) is
  RESOURCES{rd} = path_of(x)
end

readonly proc resource(x) is
  resource_named(x, x)
end

proc derived_resource(x) is
  RESOURCES{x} = x
  deriveds("", [x])
end

readonly proc bundle(m) is
  local intf = m & ".i3"
  local elements = []
  local anystale = ""

  % The generated sources are in the build directory

  derived_interface (m, VISIBLE)
  derived_implementation (m)

  if defined("_all")
    foreach r in RESOURCES
      local p = RESOURCES{r}
      elements += ["-element", r, p]
      if not anystale
        if stale(intf, p) anystale = "true"  end
      end
    end
    if anystale
      exec(_M3BUNDLE, "-name", m, arglist("-F", elements))
    end
    RESOURCES = {} % so we don't keep capturing the same ones...
  end

  deriveds(m, rsrc_extensions)
end