/* Copyright (C) 1992, Digital Equipment Corporation                         */
/* All rights reserved.                                                      */
/* See the file COPYRIGHT for a full description.                            */
/*                                                                           */
/* Last modified on Mon Feb  7 09:54:37 PST 2000 by heydon                   */
/*      modified on Wed Aug 27 17:37:58 PDT 1997 by leifer                   */
/*      modified on Wed Aug  2 14:44:54 PDT 1995 by gnelson                  */
/*                                                                           */
/* m3makefile for /proj/m3/pkgs/juno-app/src                                 */

if HasTrestle()

/* imported packages */
import		("libm3")
import		("netobj")
import		("ui")
import		("vbtkit")
import		("formsvbt")
import		("juno-machine")
import		("juno-compiler")
%import         ("pkl-fonts") % explicitly define the dependency

/* build the font pickles first */

proc CanRunTarget() is
  % Assume there is no actual sparc32 host kernel,
  % at least that a sparc64 build is run with.
  local sparc_solaris = { "SOLsun" : 1,
						  "SOLgnu" : 1,
						  "SPARC32_SOLARIS" : 1,
						  "SPARC64_SOLARIS" : 1
						}
  % There are more combinations that always work
  % or work depending on configuration.
  % Cygwin can always run NT386.
  % NT386 can sometimes run Cygwin. etc.
  return (equal(HOST, TARGET)
  		or ((sparc_solaris contains TARGET) and (sparc_solaris contains HOST))
  		or (equal(HOST, "AMD64_SOLARIS") and equal(TARGET, "I386_SOLARIS")))
end

%
% Paper over SOME cross-build scenarios, without affecting native builds.
%
HOST_BUILDDIR = BUILD_DIR
CrossBuild = FALSE
if defined("HOST")
  if not equal(HOST, TARGET) and CanRunTarget()
    HOST_BUILDDIR = HOST
    CrossBuild = TRUE
  end
end

%
% Why doesn't the pkl-fonts package do this itself?
% Why not use the shipped PklFonts? Maybe due to not shipping?
%
exec (".." & SL & "pkl-fonts" & SL & HOST_BUILDDIR & SL & "PklFonts > .." & SL & "pkl-fonts" & SL & BUILD_DIR & SL & "FontData.pkl")

/* private interfaces */
interface       ("EditorUI")
interface	("JunoClosure")
interface	("JunoHandleLexErr")
interface	("JunoVersion")
interface	("PSFont")
interface	("RemoteView")
interface	("View")

/* private modules */
module		("CurrCmd")
module		("Drag")
module		("Drawing")
module		("Editor")
module		("ExternalProc")
module		("FVFilter")
module		("JunoBuild")
module		("JunoConfig")
module		("JunoError")
module          ("JunoUIImpl")
module		("JunoPt")
module		("JunoRect")
module		("JunoRsrc")
module		("JunoWM")
module		("JunoZeus")
module          ("Marquee")
module          ("PrintImpl")
module		("PSImpl")
module		("PublicView")
module		("RandomImpl")
module		("SaveState")
module		("ScrnFontExtras")
module		("Source")
module		("TextImpl")
module		("TimeImpl")
module		("ToolBox")
module		("UnitImpl")
module		("VBTExtras")
module          ("EditorXtra")
implementation	("Juno")

/* include resource files */
include_dir	("rsrc")

/* run stub-generator */
netobj		("RemoteView", "T")

/* extra compiler options */
m3_option	("-times")                      % report compilation times
m3_option	("-O")                          % compile optimized code
% m3_option	("-X0@-copying_struct_assign@") % disable Veach optimizations
% m3_option	("-keep")                       % keep intermediate files
% m3_option	("-v")                          % verbose compiler switch
% m3_option	("-X2@-p@")                     % enable prof(1) profiling
% m3_option	("-X0@-NoChecks@")              % disable array-bounds checking

/* the exported cmon-enable "Juno" executable */
% import	("cmon")
% local etp_args = "-a -M -f ../src/etpprocs"
% local cmon_mips = "-machine newport.pa.dec.com" & " " & etp_args
% local cmon_alpha = "-machine src-server2.pa.dec.com" & " " & etp_args
% Cmon_prog	("Juno", cmon_mips, cmon_alpha)

/* commands to build static executable on PM3 (Linux) */
%if equal(TARGET,"LINUXLIBC6")
%  option("standalone","T")
%end

/* plain old stand-alone Juno */
Program		("Juno")

/* man page */
import		("mtex")
Mtex		("Juno", 1)

end
