packages feed

futhark-0.20.1: docs/man/futhark-wasm.rst

.. role:: ref(emphasis)

.. _futhark-wasm(1):

============
futhark-wasm
============

SYNOPSIS
========

futhark wasm [options...] <program.fut>

DESCRIPTION
===========

``futhark wasm`` translates a Futhark program to sequential
WebAssembly code by first generating C as ``futhark c``, and then
using Emscripten (``emcc``).  This produces a ``.js`` file that allows
the compiled code to be invoked from JavaScript.  Executables
implement the Futhark server protocol and can be run with Node.js.

OPTIONS
=======

-h
  Print help text to standard output and exit.

--entry-point NAME
  Treat this top-level function as an entry point.

--library
  Generate a library instead of an executable.  Appends ``.js``
  to the name indicated by the ``-o`` option to determine output
  file names.

-o outfile
  Where to write the result.  If the source program is named
  ``foo.fut``, this defaults to ``foo``.

--safe
  Ignore ``unsafe`` in program and perform safety checks unconditionally.

--server
  Generate a server-mode executable that reads commands from stdin.
  This is the default.

-v verbose
  Enable debugging output.  If compilation fails due to a compiler
  error, the result of the last successful compiler step will be
  printed to standard error.

-V
  Print version information on standard output and exit.

-W
  Do not print any warnings.

--Werror
  Treat warnings as errors.

ENVIRONMENT VARIABLES
=====================

``CFLAGS``

  Space-separated list of options passed to ``emcc``.  Defaults
  to ``-O3 -std=c99`` if unset.

``EMCFLAGS``

  Space-separated list of options passed to ``emcc``.

EXECUTABLE OPTIONS
==================

The following options are accepted by executables generated by
``futhark wasm``.

-h, --help

  Print help text to standard output and exit.

-D, --debugging

  Perform possibly expensive internal correctness checks and verbose
  logging.  Implies ``-L``.

-L, --log

  Print various low-overhead logging information to stderr while
  running.


SEE ALSO
========

:ref:`futhark-c(1)`, :ref:`futhark-wasm-multicore(1)`