Commit Graph

145 Commits (master)

Author SHA1 Message Date
Gabriel Scherer fab58a938a makefiles: move the inclusion of Makefile.build_config in Makefile.common 2020-05-06 12:10:02 +02:00
David Allsopp 3a40b2fd94 Introduce Makefile.build_config.in
This moves the configure-generated parts of Makefile.common to a
separate (generated) Makefile, allowing Makefile.common to be a normal
Makefile.

OCaml's build system Makefile's now include Makefile.build_config (which
itself includes Makefile.config) but Makefile.config is still installed
as before. This allows configure to generate variables which are
specific to the build process and are not intended to be exported to the
installation.
2020-04-17 13:53:49 +01:00
David Allsopp 13786d7d12 Ensure make distclean works on an unconfigured tree 2019-10-15 11:46:36 +01:00
David Allsopp d4a566573f Allow make to be invoked before configure
This should be improved to give better warnings for when Makefile.config
and Makefile.common are required.
2018-12-04 10:28:36 +00:00
Pieter Goetschalckx 99224a96b7
Quoted extensions in comments, ocamllex and ocamlyacc (#9166)
* Support quoted extensions in comments
* Support quoted extensions in ocamllex
* Support quoted extensions in ocamlyacc
* Fix copying of comments in ocamlyacc
2020-02-03 10:55:28 +01:00
Andreas Abel 0d97917cd2 Make sure ocamlyacc can handle 255 entry points (#9210)
The previous promised limit of ocamlyacc was 256 entry points, but
on some platforms (x86 at least) the actual limit was 127 due to representation of 
bucket->entry as char.  Switching to unsigned char extends the limit to 255.

I introduced a constant MAX_ENTRY_POINT as a synonym of MAXCHAR to
handle checks against the limit consistently over the different modules
of ocamlyacc.

Extensions beyond 255 entry points would require a bit more work (which
looks unrewarding) since entry points are currently identified by a single byte
at the beginning of the input stream.

Fixes: #9207
2019-12-26 11:02:13 +01:00
David Allsopp 7f96c82fda Windows Unicode handling for ocamlyacc
This deals with the command line processing only (i.e. filenames) -
ocamlyacc continues to process .mly files as before.
2019-04-16 17:37:17 +01:00
David Allsopp fd9e7b2ee8 Convert line_format to a #define
Using an extern disables error checking of the parameters in "modern"
compilers.
2019-04-16 17:30:57 +01:00
David Allsopp dd851027b1 Remove unused constants 2019-04-16 17:30:37 +01:00
David Allsopp ac26bf0f56 Use caml/misc.h in ocamlyacc 2017-09-14 22:55:44 +01:00
David Allsopp 162b0f9340 Remove unnecessary extern to mktemp
stdlib.h is included in defs.h
2017-09-14 22:52:58 +01:00
David Allsopp 11e0b5597c Remove defines_file from ocamlyacc 2017-09-14 22:52:17 +01:00
Sébastien Hinderer 5ec649f0cb
Build system: share rules to compile C files (#8930)
This commit deduplicates some of the Makefile rules used to compile C files.

Rather than having one such rule per Makefile for each directory
containing C files, the relevant rules are moved to Makefile.common.in.
2019-09-11 09:16:15 +02:00
Pieter Goetschalckx 30fbae7265 Octal character literals and apostrophes in ocamlyacc actions (#1932) 2019-09-06 16:12:54 +02:00
Fourchaux 1946594bd7 Fixing typos in various files (#2246)
Note: Typos found with https://github.com/codespell-project/codespell

Here is the (semi-manual) command used to get (and correct) the typos:

$ codespell -i 3 -w --skip=".png,.gif,./ocaml/boot,./ocaml/.git,./ocaml/manual/styles,./ocaml/manual/manual/htmlman" -L minimise,instal,contructor,"o'caml",cristal,pres,clos,cmo,uint,iff,te,objext,nto,nd,mut,upto,larg,exten,leage,mthod,delte,tim,atleast,langage,hten,iwth,mke,contant,succint,methids,eles,valu,clas,modul,que,classe,missings,froms,defaut,correspondance,differents,configury,reachs,cas,approche,normale,dur,millon,amin,oje,transfert
2019-02-13 14:04:56 +01:00
Sébastien Hinderer 01b65ac0af Introduce and use ROOTDIR in more makefiles 2018-09-17 14:51:01 +02:00
Sébastien Hinderer ba6362a07d Move config/Makefile to Makefile.config
In order to prepare the transition to autoconf, this commit moves the
configuration Makefile out of the config directory which will disappear
and gives it the name it will have once intstalled, namely Makefile.config.
2018-09-17 14:23:35 +02:00
Sébastien Hinderer d3e73595e5 Merge the asmrun and byterun directories into the runtime directory 2018-06-28 17:50:33 +02:00
Sébastien Hinderer 85fa27f7e9 Rename C compiler related build variables
This commit renames a few C compiler related build variables so that
they are reserved for the build system. They will then be re-introduced,
but this time as user varialbes whose value can be freely customized
when compiling the package, without risking to conflict with those
command-line flags that are required by the build system itself.

Here are the variables this commit renames:

- CFLAGS -> OC_CFLAGS
- CPPFLAGS -> OC_CPPFLAGS
- LDFLAGS -> OC_LDFLAGS

Note: before this commit the compilation of scheduler.c in
otherlibs/threads was relying on make's implicit rule to compile C files.

Since this commit stops using the standard variables for flags,
it is necessary to introduce an explicit rule to compile C files
and that makes use of the newly introduced variables.
2018-06-20 14:01:42 +02:00
Sébastien Hinderer a2586680a0 Remove the Makefile.nt files 2018-05-25 00:36:56 +02:00
Nicolás Ojeda Bär 9fe6d0e2c2 Unicode support for the Windows runtime (#1200)
* Add support code

* Explicitly reference ANSI Windows APIs

* Adapt Sys.is_directory

* Adapt ocamlrun

* Add Changes entry

* Add testsuite

* Adapt Unix.open_process{_in,_out,_full,}, Unix.create_process{_env,}

* Adapt headernt.c

* Adapt Pervasives.open_{in,out}, Filename.temp_file, etc.

* Adapt Sys.file_exists

* Adapt Sys.remove

* Adapt Sys.chdir

* Adapt Sys.getcwd

* Adapt Sys.getenv

* Adapt Sys.command

* Adapt Sys.readdir

* Adapt CPLUGINS

* Remove use of FormatMessageA, CreateFileA

* Adapt Unix.mkdir

* Adapt Unix.openfile

* Adapt Unix.readlink

* Adapt Unix.rename

* Adapt Unix.{LargeFile,}.{l,}stat

* Adapt Unix.system

* Adapt Unix.{open,read}dir

* Adapt Unix.link

* Adapt Unix.symlink

* Adapt Unix.getcwd

* Adapt Unix.rmdir

* Adapt Unix.utimes

* Adapt Unix.unlink

* Adapt Unix.chdir

* Adapt Unix.chmod

* Adapt Unix.{execv,execve,execvp,execvpe}

* Compile with -DUNICODE -D_UNICODE under Windows

* Add configure-time switch, Config.windows_unicode

* Adapt Unix.putenv

* Re-implement Unix.environment using GetEnvironmentStrings()

* Use Unicode-aware flexdll

* Adapt Unix.environment

* AppVeyor: bootstrap flexdll

* Adapt tests/embedded/cmmain.c

* Adapt tests/lib-dynlink-csharp/entry.c

* Remove exec tests

* Fixup

* Pass -municode to MinGW compiler

* Try to fix tests/embedded

* Adapt Sys.rename

* Correct Changes entry

* Makefile.several: use $(O) and $(NATIVECODE_ONLY)

* Display => skipped correctly for tests/win-unicode

* Add missing casts to execv* calls

It's not clear why these aren't necessary for with char, but they are
necessary with wchar_t on GCC (but not MSVC).

* Missing header in systhreads (Win32 only)

* Revert "Pass -municode to MinGW compiler"

This reverts commit a4ce7fb319c429068a5b9d1ab14a2cc3969c355f.

* Revert "Try to fix tests/embedded"

This reverts commit 5197d8922295b7b339b970ec3189374aa15de4b8.

* Revert "Remove exec tests"

This reverts commit 306ccef2e79eca5b38ecfa285b912c7bcf3e9f52.

* Don't pass $(LDFLAGS) when build ocamlc.opt

It's already included via CC anyway, and it causes Unicode problems for
Winodws (because the linker options need to be prefixed "-link" to go via
flexlink).

* Use wmain on Windows for ocamlrun

* Build Unicode applications on Windows

* Use wmain in headernt.c

* Minor correction to win-unicode Makefile

* Switch submodule to FlexDLL 0.36

* Build ocamlyacc as an ANSI application

* Revert "Fixup"

This reverts commit 500bd6b575ffd6c5b71c6953e55d740f0b090185.

* Fix casts for execvp/execve

* Remove tabs from test code

* Fix Changes entry

* shell32.lib is no longer necessary

* Free allocated string

* Changes: signal breaking change

* Disable exec_tests

* Protect with CAML_INTERNALS
2017-09-18 17:41:29 +02:00
David Allsopp 82b3cdc6ee Restore 32bit compilation (#1295) 2017-08-29 10:42:23 +01:00
Demi Obenour 472ee2c0ff Fix build on MSVC 2017-05-17 09:48:41 +01:00
Demi Obenour ebe9f33f83 Delete code that isn't useful for ocamlyacc
It was left from the conversion of Berkely Yacc to ocamlyacc
2017-05-17 09:48:41 +01:00
Demi Obenour 13fe590602 Partial testcase and bug fix
This adds a partial testcase for the better lexing of
OCaml code by ocamlyacc, as well as a bug fix.
2017-05-17 09:48:41 +01:00
Demi Obenour 28767a90ae Fix parsing for a corner case in ocamlyacc
A'"'" was misparsed (the ' was not associated with the A as it should
be)
2017-05-17 09:48:41 +01:00
Demi Obenour 795f1bb37a Fix the parsing of comments by ocamlyacc 2017-05-17 09:48:41 +01:00
Demi Obenour af55037229 Check for balanced parentheses and curly braces in ocamlyacc
This uses an explicit stack to keep track of parentheses and curly
braces in actions.
2017-05-17 09:48:41 +01:00
Demi Obenour f081bc399d Fix parsing of raw strings
This adds support for parsing of raw OCaml strings.
2017-05-17 09:48:41 +01:00
Demi Obenour 83a90593b2 Refactor the ocamlyacc reader
The processing of apostrophes, quoted strings and comments was
duplicated in at least two places.  This refactors both into
functions.

Also move the bitmap code, for use by later changes.
2017-05-17 09:48:41 +01:00
Demi Obenour 897711b40e Delete some superfluous code
The %ident and %union directives don't make sense for OCaml,
and generated broken OCaml code.  Just drop support for them.
2017-05-17 09:48:41 +01:00
Sébastien Hinderer 40fcbb5f0a Move configuration header files from the config to the byterun/caml directory
This commit moves:
  - config/m.h to byterun/caml/m.h
  - config/s.h to byterun/caml/s.h

Consequently, m.h and s.h now get installed alongside other
OCaml header files.

This commit also updates the .depend files, introducing updates in the
dependencies which are not consequences of this commit itself.
2017-04-26 19:28:17 +02:00
David Allsopp 0301576685 Fix \r problems on recent Cygwins
The Cygwin packages for awk, grep and sed were updated on 20 February
2017 so that they no longer automatically strip \r characters on binary
mounts. This affects the OCaml build system in a few places, requiring
the addition of a few tr calls.

References:
  * https://cygwin.com/ml/cygwin/2017-02/msg00152.html
  * https://cygwin.com/ml/cygwin/2017-02/msg00189.html
  * https://cygwin.com/ml/cygwin/2017-02/msg00188.html
2017-04-13 14:17:28 +02:00
Sébastien Hinderer 3564aade19 Introduce and use the OUTPUTEXE and OUTPUTOBJ build variables 2017-03-29 11:10:06 +02:00
Sébastien Hinderer f2d5d60376 Define new build variables for C compiler and preprocessor flags 2017-03-29 11:10:06 +02:00
Sébastien Hinderer cc7ad5650a Get rid of BYTECC and NATIVECC
Use the same C compiler, CC, in all the build system.
2017-03-29 11:10:06 +02:00
Sébastien Hinderer 93c32dbd10 Rely on _WIN32 rather than NO_UNIX to compile ocamlyacc 2017-03-07 14:24:45 +01:00
David Allsopp fffde17d52 Make ocamlyacc and make_opcodes ignore \r on Unix
ocamlyacc doesn't correctly handle \r on Unix meaning that long strings
with escaped newlines cause unterminated string warnings.

Similarly, the make_opcodes script in the build system cannot cope with
a CRLF checkout of the header files.
2017-02-15 13:02:11 +00:00
Sébastien Hinderer d917ff6eb3 Merge Makefile.nt into Makefile in the yacc directory. (#762)
yacc/Makefile has been changed so that it also works on Windows.
2016-08-26 09:05:57 +02:00
Nicolas Ojeda Bar 318d9c9b41 ocamlyacc: output verbose file before failing on --strict. 2016-07-05 11:42:21 +02:00
Jeremy Yallop 27346ebcd4 Rename ocamlyacc's -e option --strict. 2016-06-22 09:03:29 +01:00
Jeremy Yallop 54065bb1d0 Add an -e option to ocamlyacc to reject grammars with conflicts. 2016-05-31 20:45:06 +01:00
whitequark c95e6502d5 yacc/Makefile{,.nt}: merge. 2016-03-17 23:36:44 +01:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
Damien Doligez 7cb9a80744 simplify .gitignore; remove .ignore files and tools/setignore; adjust tools/check-typo 2015-11-06 16:25:05 +01:00
Xavier Leroy 27c467c777 byterun/ yacc/ : replace some K&R function declarations with proper prototypes. 2015-11-03 11:08:01 +01:00
Gabriel Scherer 64eed3f20f fix an issue spotted by the Clang analyzer (assigned value never read)
yacc/reader.c:922:9: warning: Value stored to 'value' is never read
        value = UNDEFINED;
        ^       ~~~~~~~~~

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16334 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-08-04 20:32:12 +00:00
Gabriel Scherer 1714cfa5ec fix an issue spotted by the Clang analyzer (leak in yacc/reader.c)
yacc/reader.c:1328:7: warning: Potential leak of memory pointed to by 'a_line'
      fprintf(f, ")\n# 0\n              ");
      ^~~~~~~

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16333 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-08-04 20:32:11 +00:00
Damien Doligez 860c670848 merge branch 4.02 from 4.02.1 (rev 15540) to a few fixes after 4.02.2 (rev 16205)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16214 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-17 14:31:05 +00:00
Gabriel Scherer f22564b84d PR#6729: Makefile: remove suffix rules to avoid -jN race conditions
(Peter Zotov)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15751 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-12-27 08:44:48 +00:00