<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ice-online.com/index.php?action=history&amp;feed=atom&amp;title=BUILD</id>
	<title>BUILD - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ice-online.com/index.php?action=history&amp;feed=atom&amp;title=BUILD"/>
	<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=BUILD&amp;action=history"/>
	<updated>2026-06-13T16:50:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.ice-online.com/index.php?title=BUILD&amp;diff=827&amp;oldid=prev</id>
		<title>ConvertBot: Builds an NeXtMidas command or library</title>
		<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=BUILD&amp;diff=827&amp;oldid=prev"/>
		<updated>2020-04-27T22:05:09Z</updated>

		<summary type="html">&lt;p&gt;Builds an NeXtMidas command or library&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Builds an NeXtMidas command or library&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;NAME&amp;gt;  Name of the command/library (or &amp;quot;ALL&amp;quot;, or a '|' separated list of files&lt;br /&gt;
        in the same area)&lt;br /&gt;
&amp;lt;AREA&amp;gt;  Area of the option tree containing file (or &amp;quot;ALL&amp;quot;)&lt;br /&gt;
&amp;lt;OPT&amp;gt;   Option tree containing file [DEFAULT=SYS]&lt;br /&gt;
&lt;br /&gt;
This command is used to compile a command or library under the NeXtMidas&lt;br /&gt;
framework. It looks for .java, .c, .clib, .cpplib, or .flib extensions and&lt;br /&gt;
compiles the routines found using the appropriate compiler.&lt;br /&gt;
&lt;br /&gt;
If AREA=&amp;quot;ALL&amp;quot; or &amp;quot;*&amp;quot; then all of the following areas will be included in the&lt;br /&gt;
build (since 3.1.2: this list is read from the build.codeareas.libs and&lt;br /&gt;
build.codeareas.other properties in the build.props file):&lt;br /&gt;
    inc,lib,libg,libm,net,  intr,prim,host,test,mcr&lt;br /&gt;
&lt;br /&gt;
For .java, .c, .clib .cpplib, and .flib files, the name &amp;quot;ALL&amp;quot; or &amp;quot;*&amp;quot; can be used&lt;br /&gt;
to compile all of the routines found in the specified &amp;lt;AREA&amp;gt;. Note that if using&lt;br /&gt;
XBC to compile host primitives &amp;quot;ALL&amp;quot; will not include those host primitives not&lt;br /&gt;
in the commands.cnf file (this is done for compatibility with X-Midas).&lt;br /&gt;
&lt;br /&gt;
If only &amp;lt;NAME&amp;gt; is specified then the command with the given name will be built.&lt;br /&gt;
This provided a quick way to rebuild a primitive that has been modified.&lt;br /&gt;
&lt;br /&gt;
The build.props File&lt;br /&gt;
--------------------&lt;br /&gt;
  Default definitions for compiler defaults used by BUILD can be found in&lt;br /&gt;
  $NMROOT/nxm/sys/cfg/build.props. This file is defined as a normal Java&lt;br /&gt;
  properties file and contains values for specific compiler options for each of&lt;br /&gt;
  the supported environments. Additional properties can be added either to this&lt;br /&gt;
  file (to change build behavior for SYS) or to &amp;lt;OPT&amp;gt;/cfg/build.props. Property&lt;br /&gt;
  values defined in an option_tree build.props will override the defaults in SYS&lt;br /&gt;
  (this is the preferred way of changing the flags used for a given option&lt;br /&gt;
  tree).&lt;br /&gt;
&lt;br /&gt;
  The .append operator can also be used to add any existing properties&lt;br /&gt;
  definitions (since NeXtMidas 2.9.2). A properties file in&lt;br /&gt;
  &amp;lt;OPT&amp;gt;/cfg/build.props containing:&lt;br /&gt;
&lt;br /&gt;
      cflags.UNIX.append      = -DFOO&lt;br /&gt;
&lt;br /&gt;
  will append the &amp;quot;-DFOO&amp;quot; compiler definition to the existing Unix CFLAGS&lt;br /&gt;
  (cflags.UNIX) compiler flags, but before the native.UNIX.cflags property.&lt;br /&gt;
&lt;br /&gt;
  The .append.&amp;lt;machine_arch&amp;gt;bit (e.g. .append.32bit or .append.64bit) operator&lt;br /&gt;
  allows additional flags to be added for 32-bit or 64-bit machines. E.g.&lt;br /&gt;
&lt;br /&gt;
      ifort.comp.append.32bit = -i-static&lt;br /&gt;
&lt;br /&gt;
  will append the &amp;quot;i-static&amp;quot; Intel compiler flag only on 32-bit machines for the&lt;br /&gt;
  &amp;quot;ifort.comp&amp;quot; property (i.e. the Intel Fortran compiler and flags).&lt;br /&gt;
&lt;br /&gt;
  The .prepend operator can also be used to prepend any existing properties&lt;br /&gt;
  definitions (since NeXtMidas 2.9.2). This is useful to override the default&lt;br /&gt;
  native libraries to link against (since the linkers link libraries in the&lt;br /&gt;
  order they are specified on the command line).&lt;br /&gt;
&lt;br /&gt;
  The fflags.host property in build.props can be used by an option tree's&lt;br /&gt;
  build.props to provide additional compile and link flags to for their Fortran&lt;br /&gt;
  HOST primitives (when using XBC).&lt;br /&gt;
&lt;br /&gt;
  Reminder: When you use -l&amp;lt;libname&amp;gt; the linker looks for lib&amp;lt;libname&amp;gt;.[a|so].&lt;br /&gt;
  The linker searches and processes libraries and object files in the order they&lt;br /&gt;
  are specified.&lt;br /&gt;
&lt;br /&gt;
Building Native Code&lt;br /&gt;
--------------------&lt;br /&gt;
  Classes with native components (e.g. NTerminal.java, NTerminal.c in SYS) are&lt;br /&gt;
  automatically compiled and linked into a shared object library by the name&lt;br /&gt;
  &amp;lt;NAME&amp;gt;_&amp;lt;ostag&amp;gt;&amp;lt;osarch&amp;gt;.&amp;lt;so|dll&amp;gt; to be loaded by the java class when&lt;br /&gt;
  instantiated. The &amp;lt;ostag&amp;gt; is &amp;quot;lin&amp;quot; for Linux, &amp;quot;win&amp;quot; for Windows, etc. (view&lt;br /&gt;
  the build.props file for a more complete list of these tags). The &amp;lt;osarch&amp;gt; is&lt;br /&gt;
  32 for 32-bit and 64 for 64-bit systems. The addition of the OS tag and&lt;br /&gt;
  &amp;lt;osarch&amp;gt; are intended to allow versions of the libraries for different&lt;br /&gt;
  platforms to coexist on a shared drive. Some examples: &amp;quot;Native_lin32.so,&lt;br /&gt;
  Native_lin64.so, Native_win64.dll, NTerminal_sol32.so&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  The linker stage also automatically looks for a&lt;br /&gt;
  lib&amp;lt;NAME&amp;gt;_&amp;lt;ostag&amp;gt;&amp;lt;osarch&amp;gt;.&amp;lt;so|a|dll&amp;gt; or a libAll_&amp;lt;ostag&amp;gt;&amp;lt;osarch&amp;gt;.&amp;lt;so|a|dll&amp;gt;&lt;br /&gt;
  and adds them to the linker stage if found.&lt;br /&gt;
  These libraries are typically created by an option tree specific buildopt.mm&lt;br /&gt;
  macro or through the use of a .clib, .cpplib, or .flib file (see below).&lt;br /&gt;
&lt;br /&gt;
Building Native Libraries Using .clib, .cpplib, and .flib (.[c|cpp|f]lib) Files&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
  This feature allows easy creation of shared object libraries without the need&lt;br /&gt;
  for a complicated build script or Makefile (since NeXtMidas 2.1.1).&lt;br /&gt;
  The .[c|cpp|f]lib file simply list the names of the native files to be&lt;br /&gt;
  included in the library. A typical file will look similar to this:&lt;br /&gt;
&lt;br /&gt;
    # Defines the files included in the libMyLib library,&lt;br /&gt;
    # files are listed one-per-line.&lt;br /&gt;
    file1.c&lt;br /&gt;
    file2.c&lt;br /&gt;
    preCompiled.a&lt;br /&gt;
&lt;br /&gt;
  Any blank lines or lines that start with a pound sign ('#') are treated as&lt;br /&gt;
  comments and ignored. All other lines are expected to list each of the&lt;br /&gt;
  component files one-pre-line. Files with a typical source code&lt;br /&gt;
  extension (e.g. &amp;quot;.c&amp;quot;, &amp;quot;.for&amp;quot;) are compiled automatically before linking them&lt;br /&gt;
  into the shared object. Any other files (e.g. &amp;quot;.a&amp;quot;) are assumed to be pre-&lt;br /&gt;
  compiled libraries that will be linked in. The resulting shared object will&lt;br /&gt;
  be named &amp;lt;fname&amp;gt;_&amp;lt;ostag&amp;gt;&amp;lt;osarch&amp;gt;.&amp;lt;so|dll&amp;gt; where &amp;lt;fname&amp;gt; matches the name of&lt;br /&gt;
  the .[c|cpp|f]lib file.&lt;br /&gt;
&lt;br /&gt;
  Wildcards (* and ?) are supported for the files in the .[c|cpp|f]lib file.&lt;br /&gt;
  The * (star) wildcard is use to match any character zero or more times.&lt;br /&gt;
  The ? (question mark) wildcard is use to match any character exactly one time.&lt;br /&gt;
  Files with sub-directories (e.g. mylib/xyzlib.c, mylib/*.for) and even files&lt;br /&gt;
  with relative references to sibling directories (e.g. ../lib/abc*.c)&lt;br /&gt;
&lt;br /&gt;
  Absolute paths to files are supported (e.g. /path/to/alib/mystaticlib.a) and&lt;br /&gt;
  BETA support for references to other .[c|cpp|f]lib files was also added&lt;br /&gt;
  (e.g. libxyz.flib) (since NeXtMidas 2.7.0).&lt;br /&gt;
&lt;br /&gt;
  The difference between .clib, .cpplib and .flib files is that the C compiler&lt;br /&gt;
  is used to link .clib files, the C++ compiler is used to link the .cpplib&lt;br /&gt;
  files, and the Fortran compiler is used to link .flib files.&lt;br /&gt;
  The .flib files are only intended for use with XBC.&lt;br /&gt;
&lt;br /&gt;
  Warning: For static libraries (*.a), only functions that are referenced in&lt;br /&gt;
  your listed files will be included into the shared object by the linker. One&lt;br /&gt;
  trick to get the necessary functions into your shared object is to have a&lt;br /&gt;
  dummy module (e.g. refs_to_funcs_in_staticlib.c) that calls all the functions&lt;br /&gt;
  from the static libraries and include that in your .[c|cpp|f]lib file.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;opt&amp;gt;/cfg/primitives.cfg File (BETA)&lt;br /&gt;
----------------------------------------&lt;br /&gt;
  Support for the primitives.cfg file in the cfg area of an option tree for host&lt;br /&gt;
  primitives (i.e. X-Midas style build configuration) (since NeXtMidas 2.7.0).&lt;br /&gt;
  The &amp;lt;opt&amp;gt;/cfg/libraries.cfg is also parsed (BUT NOT BUILT) to resolve all the&lt;br /&gt;
  library names for the specified option tree (via the libdepend directive). All&lt;br /&gt;
  valid primitives.cfg and libraries.cfg directives and conditionals are parsed.&lt;br /&gt;
&lt;br /&gt;
  Here are the valid directives and their description:&lt;br /&gt;
    cflags       - Compile flags for the compiler.&lt;br /&gt;
    comment line - Lines starting with a &amp;quot;!&amp;quot; character are ignored&lt;br /&gt;
    conditionals - Targets or directives intended to build conditionally based&lt;br /&gt;
                   on the current OSNAME or OSTYPE using the &amp;quot;-&amp;gt;&amp;quot; arrow syntax.&lt;br /&gt;
                   Can also use &amp;quot;NEXTMIDAS&amp;quot; as a conditional value.&lt;br /&gt;
                   Can also use existences of OS environment variables as a&lt;br /&gt;
                   conditional (since NeXtMidas 3.1.2).&lt;br /&gt;
    lflags       - Link flags for linker.&lt;br /&gt;
    libdepend    - Libraries from other option trees to link the target against.&lt;br /&gt;
    headers      - Associates header files with a particular target.&lt;br /&gt;
                   This does not effect build. For documentation only.&lt;br /&gt;
    optdepend    - (primitives.cfg only) Indicates what the PATH should be when&lt;br /&gt;
                   CONVERT MSGCFG2INC generates the configured messages&lt;br /&gt;
                   C/C++/Fortran include files.&lt;br /&gt;
                   This does not effect build. For documentation only.&lt;br /&gt;
    libname      - (libraries.cfg only) parsed but ignored&lt;br /&gt;
    modules      - Associates code files with a particular target.&lt;br /&gt;
                   (parsed BUT NOT supported yet)&lt;br /&gt;
    &amp;lt;targets&amp;gt;    - host primitive or library target&lt;br /&gt;
&lt;br /&gt;
  Directives that are not indented below a &amp;lt;target&amp;gt; are considered global to all&lt;br /&gt;
  targets that follow them.&lt;br /&gt;
&lt;br /&gt;
  See $NMROOT/nxm/sys/hlp/using_libraries.doc for a copy of X-Midas's docs for&lt;br /&gt;
  a detailed description, syntax, and examples usages of primitives.cfg and&lt;br /&gt;
  libraries.cfg (NOT SUPPORTED yet).&lt;br /&gt;
&lt;br /&gt;
  Note: OS environment variables (preceded with '$') are automatically&lt;br /&gt;
        expanded in the following directives: cflags, lflags and libdepend for&lt;br /&gt;
        third party libraries (since NeXtMidas 3.1.2).&lt;br /&gt;
&lt;br /&gt;
Things to Note&lt;br /&gt;
--------------&lt;br /&gt;
  - The /DEBUG flag will show numerous messages about the compile arguments used&lt;br /&gt;
    which might be helpful in debugging any potential problems.&lt;br /&gt;
&lt;br /&gt;
  - By default the nm shell will be restarted at the end of a compilation to&lt;br /&gt;
    ensure that the new classes are reloaded correctly. To prevent this&lt;br /&gt;
    (especially inside a macro) use the /NOEXIT flag.&lt;br /&gt;
&lt;br /&gt;
  - When building with XBC support (support for host primitives in Fortran/C++)&lt;br /&gt;
    the XBC option tree must be on the path. BUILD will automatically check for&lt;br /&gt;
    the XM_FORTRAN or NM_FORTRAN environment variable to specify the Fortran&lt;br /&gt;
    compiler to use. Please read the &amp;quot;XBC&amp;quot; section in the &amp;quot;NeXtMidas User's&lt;br /&gt;
    Guide&amp;quot; for more details.&lt;br /&gt;
&lt;br /&gt;
    The NM_CC and NM_CXX environment variables can be used to override the&lt;br /&gt;
    configured C or C++ compilers specified in build.props, respectively&lt;br /&gt;
    (since NeXtMidas 2.9.2). E.g. to use Intel's icc over gcc and g++ without&lt;br /&gt;
    having to update build.props, setenv NM_CC icc and setenv NM_CXX icc.&lt;br /&gt;
&lt;br /&gt;
    The NM_CC_OPTIONS and NM_CXX_OPTIONS environment variables can also be used&lt;br /&gt;
    to add additional C or C++ compiler flags/options to append to end of&lt;br /&gt;
    compile flags, respectively (since NeXtMidas 2.9.2).&lt;br /&gt;
&lt;br /&gt;
    WARNING: Native (C, C++, Fortran) libraries (*.so for dynamic or *.a static)&lt;br /&gt;
    built in X-Midas and/or other versions of NeXtMidas SHOULD NOT be mixed and&lt;br /&gt;
    matched and/or linked into your library or host primitive(s). Doing so will&lt;br /&gt;
    result in random segmentation faults or errors. The reason for this&lt;br /&gt;
    is that different version of X-Midas and NeXtMidas have different link level&lt;br /&gt;
    API binding that are not necessarily compatible. Your code may seem to work&lt;br /&gt;
    on occasions but don't count on it working in a production environment.&lt;br /&gt;
    Be careful NOT mix and match these libraries, e.g. adding&lt;br /&gt;
    -l&amp;lt;name_of_xm_built_lib&amp;gt; link flags or including anXmidasBuiltlib.[a|so]&lt;br /&gt;
    in your .[c|cpp|f]lib. Independent libraries without any X-Midas/NeXtMidas&lt;br /&gt;
    dependency are normally safe to link against via the -l&amp;lt;libnam&amp;gt; link flag&lt;br /&gt;
    or in a .[c|cpp|f]lib file.&lt;br /&gt;
&lt;br /&gt;
  - Users who are building files that are on a shared NFS mount will need to&lt;br /&gt;
    verify file permissions before and after the build. NeXtMidas will always&lt;br /&gt;
    use the file system's default file visibility flags for files it creates.&lt;br /&gt;
    Those flags may or may not match the ones required for other users to read&lt;br /&gt;
    (or write, in the case of developers) the files.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
  1. Build the class $NMROOT/nxm/sys/lib/DataOp.java:&lt;br /&gt;
        nM&amp;gt; build DataOp lib&lt;br /&gt;
&lt;br /&gt;
  2. Build the classes Layer1D and Layer2D in the LIBG area of SYS:&lt;br /&gt;
        nM&amp;gt; build Layer1D|Layer2D libg sys&lt;br /&gt;
&lt;br /&gt;
  3. Build all of the primitives in the ICE option tree:&lt;br /&gt;
        nM&amp;gt; build all prim ice&lt;br /&gt;
&lt;br /&gt;
  4. Build the class $NMROOT/nxm/sys/libg/MPlot.java:&lt;br /&gt;
        nM&amp;gt; build MPlot libg sys&lt;br /&gt;
&lt;br /&gt;
  5. Show all the compile time flags and other information to track the&lt;br /&gt;
      build process (useful for debugging build issues):&lt;br /&gt;
        nM&amp;gt; build/debug NTerminal lib&lt;br /&gt;
&lt;br /&gt;
  6. Build an area not in the default list of those automatically built:&lt;br /&gt;
        nM&amp;gt; build all myarea myoption&lt;br /&gt;
&lt;br /&gt;
  7. Build all of the files in the LIB area of MYOPT but include some extra&lt;br /&gt;
      compiler flags when building any C libraries and turning on XLint warning.&lt;br /&gt;
        nM&amp;gt; results FLAGS {CFLAGS_UNIX=&amp;quot;-DHEADLESS -DNOSPECIAL -Wall&amp;quot;,&amp;amp;&lt;br /&gt;
                           LFLAGS_UNIX=&amp;quot;-I/home/smith/clibs&amp;quot;,&amp;amp;&lt;br /&gt;
                           JAVA_FLAGS=&amp;quot;-Xlint -Xlint:-rawtypes&amp;quot;}&lt;br /&gt;
        nM&amp;gt; build/BLDFLAGS=^FLAGS/keep * lib myopt&lt;br /&gt;
&lt;br /&gt;
  8. Build all the files, in all areas of the DSP option tree:&lt;br /&gt;
        nM&amp;gt; build all all dsp&lt;br /&gt;
&lt;br /&gt;
  9. Build nxm.sys.test.junit.lib.FileUtilTest.java unit test:&lt;br /&gt;
        nM&amp;gt; build FileUtilTest test/junit/lib sys&lt;br /&gt;
     -OR-&lt;br /&gt;
        nM&amp;gt; build junit/lib/FileUtilTest.java test sys&lt;br /&gt;
&lt;br /&gt;
  10. Build just the native (C/C++) files for SYS:&lt;br /&gt;
        nM&amp;gt; build/bldtypes=native * * sys&lt;br /&gt;
&lt;br /&gt;
Switches:&lt;br /&gt;
  /BLDFLAGS=  - Extra build flags to use. This is a table of values matching&lt;br /&gt;
                the names in build.props (except the names in the table use '_'&lt;br /&gt;
                in place of '.' and are in upper case) where the values are&lt;br /&gt;
                extra compiler/linker options to prepend to the build.props&lt;br /&gt;
                value. (Since 2.1.0).&lt;br /&gt;
  /BLDTYPES=  - Types of files to build (Java,Native,Host). Takes precedence&lt;br /&gt;
                over /DOHOST and /DONATIVE. (Since 3.3.1) [DEF=ALL]&lt;br /&gt;
  /COUNT=&amp;lt;res&amp;gt; - INTERNAL USE ONLY: Store a count of the number of files&lt;br /&gt;
                explicitly built/compiled. A negative count generally means&lt;br /&gt;
                there is an error.                                 (Since 3.3.1)&lt;br /&gt;
  /DEBUG      - Turn on debugging.&lt;br /&gt;
  /DOGENERATE - Generate new system math libraries. [DEF=TRUE]&lt;br /&gt;
  /DOHOST     - Compiles the host (C++/Fortran) files [DEF=FALSE, TRUE when XBC&lt;br /&gt;
                is in PATH or when &amp;lt;AREA&amp;gt;=HOST].&lt;br /&gt;
                Note: /DOHOST and /DONATIVE should usually be used together.&lt;br /&gt;
  /DONATIVE   - Compiles the native (C/C++) files. [DEF=TRUE]&lt;br /&gt;
  /KEEP       - Keep intermediate files when building. Keeps the function&lt;br /&gt;
                prototypes nxm_&amp;lt;opt&amp;gt;_&amp;lt;area&amp;gt;.h, .o files&lt;br /&gt;
  /NOEXIT     - Prevent class reloading via shell restart. [DEF=TRUE in macro,&lt;br /&gt;
                FALSE at command prompt]&lt;br /&gt;
  /WARN=OFF   - Suppress warning messages (e.g. when there are no java/native&lt;br /&gt;
                source files to build). (Since 3.3.0). [DEF=TRUE]&lt;br /&gt;
&lt;br /&gt;
See Also: MAKE, BUILDOPT, BLD&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:NXM_Explain]]&lt;/div&gt;</summary>
		<author><name>ConvertBot</name></author>
		
	</entry>
</feed>