build: replace build/mk{config,myocamlbuild_config}.sh.

(Patch by Adrien Nader!)

These scripts sed config/Makefile in order to create shell script and
ocaml code that define the same values as the Makefile but in the
corresponding language.
The sed stuff is very difficult to understand, very brittle and
impossible to change.
Remove that altogether and use a Makefile to run commands like
[ echo FOO=$(FOO) ]. There is still some sed involved (to get the list
of variables in the config and to put rewrite the lists into a list of
commands) but much less and all the expressions are put into variables
with meaningful names with lots of comments.

For config.sh, mkconfig.sh generated lines like :
  if [ -z "${FOO}" ]; then FOO=bar; fi
The new script sets the value without checking anything.
I haven't found a reason to do things differently: if there is anything
to override, the right place to do it is after sourcing the shell
script. In any case, I haven't seen any such use.

The mkconfig.sh file also set "WINDOWS=true/false" but the only use is
in the parallel build-system which is implemented in build/ and uses
ocamlbuild as much as possible, and it's going away so it's useless to
set it too.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14167 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
build: replace ocamlcomp*.sh.

This script was built from ocamlcomp.sh.in through sed and is called
instead of "ocamlc" (for instance).
It makes it possible to switch from "ocamlc" to "ocamlc.opt" without
changing anything in the Makefiles, only calling sed.

I couldn't cleanly make it handle both a compiler for the target and for
the build. Instead I'm replacing it and doing as much as possible
directly in the Makefiles.
I hoped it would reduce the number of shell invocations, which would
speed things up quite a lot on Windows but I still had to have at least
one since it's not possible to update a make variable from inside a make
rule: i.e. it's not possible to do X=a, build a.opt and update X to be
a.opt.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14168 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
build: remove warning 32 (unused variable) in tools.

(Patch by Adrien Nader!)

Among other files, myocamlbuild_config.ml is built in this directory.
This file defines many variables, most of which are not used and
therefore trigger this warning which is then turned into an error
through -warn-error A.
build: remove warning 32 (unused variable) in tools.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14169 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Simplify type_structure.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14170 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
build: skip $(IFLEXDIR) in mk_shell_and_ocamlbuild_config.sh.

(Patch by Adrien Nader!)

On Windows, IFLEXDIR is defined as -I"$(FLEXDIR)". The new
mk_shell_and_ocamlbuild_config script outputs:
  echo IFLEXDIR="\"$(IFLEXDIR)\""

However, becauses $(IFLEXDIR) contains quotation marks, this becomes:
  echo IFLEXDIR="\"-I"$(FLEXDIR)"\""

This unquotes $(FLEXDIR) and breaks the program.

Simply exclude IFLEXDIR from the variables that are handled by the
script. This is actually what the previous scripts were doing: the
exclude list was .*FLEXDIR and matched both IFLEXDIR and FLEXDIR while
the one I made only had \<FLEXDIR\> in it.

I've tried to handle it but there are at least three competing languages
and quoting rules: makefile (both gnu make and several bsd makes), shell
script and ocaml.
There's no human way to do string processing given the portability
constraints: both gnu make and pmake (and its descendants) have powerful
string processing functions but they're not the same.
The only sane way would be to store the configuration in a more evolved
language that is portable, has arrays and powerful string handling
routines in standard like C or awk. From there it would be possible to
output make, shell script and OCaml code easily.

One day. Maybe.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14171 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
build: fix "make clean" failure when ./configure hasn't been run again.

(Patch by Adrien Nader!)

The "make clean" rules were relying on the $(ROOTDIR) variable.
However this variable is only defined when ./configure runs. This broke the
usual "make clean ; ./configure && make world.opt":
  < use old trunk >
  ./configure            # config/Makefile doesn't define ROOTDIR
  make world.opt
  < move to new trunk >
  make clean             # Fails early and doesn't clean all files
  ./configure            # config/Makefile now defines ROOTDIR
  make world.opt         # This fails because of left-over files

An easy solution was to run "make clean" again after configure but this is
not how everyone does and in particular, this is not how the jenkins build
bot seem to do.

The recipes for "make clean" should never rely on values defined by
configure for this exact reason.
As a simple solution, only run the commands that rely on $(ROOTDIR) if
$(ROOTDIR) is set.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14172 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
build: don't use make's -C; it's not available everywhere.

(Patch by Adrien Nader!)

-C doesn't work on at least openbsd's make so don't use it.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14173 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
bootstrap ocamlbuild again (needed for the cross-compilation patches)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14174 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
build: ocamlmklib on Windows expect a Windows-style path, not a UNIX one.

(Patch by Adrien Nader!)

Rev 14168 (build: replace ocamlcomp*.sh.) broke "make world" (but
surprisingly, not "world.opt") because the argument to ocamlmklib's -ocamlc
has to be a Windows path, i.e. C:\...\ocamlc. Instead it gave a UNIX one,
i.e. /home/foo/ocaml/ocamlc.

Call cygpath in otherlibs/Makefile.nt to fix that.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14175 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
build: typo on config/Makefile.mingw64, msvc and msvc64.

(Patch by Adrien Nader!)

While trying to come up with the previous commit, I noticed that the
various Windows config files had diverged: all but config/Makefile.mingw
were lacking a '%' in a pattern and this prevents the pattern from matching
anything.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14176 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Typo (#6190).

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14177 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Switch to a record-based API for Ast_mapper, so that it can be used within the compiler itself (where objects are banned).  The class-based version will be shipped as part of the ppx_tools package.  Only the ifdef example has been adapted in experimental/frisch.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14178 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Cleanup ppx API.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14180 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Adapt js example.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14181 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Functions to close the open recursion in Ast_mapper.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14182 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Adapt one more example.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14183 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Adapt one more example.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14184 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Adapt one more example.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14185 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Get rid of recursion closing functions, being more explicit on the recursion does not hurt.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14186 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Cleanup.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14187 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02