I only learned of this variable from reading Haiku's source code.
So, I tried to make a quick addition to the documenation (though it
took longer than I expected :P).
JAM_TARGETS was added in commit a1a02bed3c
Change-Id: I490472eb75305b7783e23784b728fdf5fb6e0012
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/7420
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
There was a comma in compile_commands.json after the last entry what
prevented from using file directly in some tools.
Test plan:
verified new compile_commands.json with "python3 -m json.tool compile_commands.json"
Change-Id: I6c2582f7285a3409d95081a93f3c05b5cc9322b9
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4671
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Version string was not updated for 10 years, but there were some changes made.
This commit updates the date to avoid confusion.
Test plan:
~/buildtools/jam> jam -v
Jam 2.5-haiku-20211020. OS=HAIKU. Copyright 1993-2002 Christopher Seiwald.
Change-Id: Ieea0ed2a533396f664948f58798acee0f6c811e9
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4618
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Running "./jam0 install" installed jam in /boot/common/bin/ which
is no longer used. Other directories also looked outdated so they
are updated too.
Test plan:
1. make
2. ./jam0 install
Install /boot/system/non-packaged/bin/jam
3. which jam
/boot/system/non-packaged/bin/jam
Change-Id: I69c719eab0bd211f545c17337e3bc73bb1ab78fe
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4617
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
The call of make in buildtools/jam produces the following output:
LINKLIBS= ./jam0
...patience...
...found 271 target(s)...
...updating 33 target(s)...
MkDir1 bin.linuxx86
Cc bin.linuxx86/builtins.o
< reduced output >
Cc bin.linuxx86/variable.o
Archive bin.linuxx86/libjam.a
ar: `u' modifier ignored since `D' is the default (see `U')
ar: creating bin.linuxx86/libjam.a
...
'make' bootstraps 'jam0' which calls 'ar' to create the static library 'libjam.a'.
The call looks like this:
ar ru bin.linuxx86/libjam.a bin.linuxx86/builtins.o <reduced output> bin.linuxx86/variable.o
The modifier 'u' gets ignored.
The underlying cause is that the build was done in deterministic mode ('D'), a.o. NOT using timestamps, which is completely fine.
But because of this the archiver tool (ar) can never update files in the archive based on timestamps.
"ru" means replace files (flag 'r') only if they are updated (flag suffix 'u') based on timestamps.
This patch removes the flag suffix 'u'.
Change-Id: I57fa2d50c2081ee66d1b71648714e773ecb7cd59
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4419
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Warnings were:
Cc bin.linuxx86/fileunix.o
fileunix.c: In function ‘file_archscan’:
fileunix.c:217:6: warning: implicit declaration of function ‘read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
217 | if( read( fd, buf, SARMAG ) != SARMAG ||
| ^~~~
| fread
fileunix.c:220:6: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
220 | close( fd );
| ^~~~~
| pclose
fileunix.c:272:3: warning: implicit declaration of function ‘lseek’; did you mean ‘fseek’? [-Wimplicit-function-declaration]
272 | lseek(fd, offset + SARHDR, 0);
| ^~~~~
| fseek
Change-Id: Iedcdec01deb929d6c91ebc9d7eb72497fe078dd4
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4399
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Pointer to struct on stack was given instead of the calculated value.
Warning was:
Cc bin.linuxx86/expand.o
expand.c: In function ‘var_expand’:
expand.c:210:49: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘LIST *’ {aka ‘struct _list *’} [-Wformat=]
210 | printf("MAXSYM is too low! Need at least %d\n", l);
| ~^ ~
| | |
| int LIST * {aka struct _list *}
Change-Id: I65ab593287fc1b9aa2aba0056714726e29467012
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4398
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Cc bin.linuxx86/variable.o
variable.c: In function ‘var_defines’:
variable.c:121:46: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
121 | printf("MAXSYM is too low, need at least %d\n", val - *e);
| ~^ ~~~~~~~~
| | |
| int long int
| %ld
Change-Id: I389577a71416029fdff0f486af745ea482b14ddd
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4397
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Include header file for function prototypes hcache_init, hcache_done.
Note that include order is important, i.e. include has to be placed after the lists.h and rules.h includes.
Change-Id: Ic8a286662c8267bdfd19011b5ed8e825ee16d7ee
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/4396
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Based on Boost Jam patch: https://github.com/boostorg/build/pull/133
retrofitted to our version. Only the rules whose name contains Cc or C++
are stored there. This can be improved if it's not good enough.
The commands are generated only as they are run. Unfortunately I think
with Jam there isn't really a way to do otherwise.
Change-Id: Ic5d44dc27baa2a2e4157324f6c5a228ab0366afe
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/3260
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This brings Jam's usage of AR to be more conventional: the flags for AR
are moved to a separate variable, called ARFLAGS, ensuring that any
environment that overrides the AR variable will still end up using the
correct flags to create the archve.
Change-Id: I00449b284fab132d5fc9239017d742480fb51820
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/3226
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Make new_string_list() initialize the buffer it creates to hold a file's
contents, preventing a segfault later on should jam attempt to parse the
contents of an empty file.
Fixes#15250.
Change-Id: I907dccd26e1ca35fbe07ed6d624b0144487134fe
Reviewed-on: https://review.haiku-os.org/c/buildtools/+/1716
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
On most systems, "D" (deterministic) is now the default archiving mode,
and so specifying "u" will throw a warning that "D" is being used anyway.
Jam previously assumed, as it was passing "u", that the timestamps inside
.a's were valid when they were actually 0, which was leading to spurious
rebuilds of .as.
After this change, we assume archives cannot be scanned for timestamps,
which should stop the spurious rebuilds of targets on most systems.
Hopefully this is enough to satisfy the license requirements.
Remove some of the "LOCAL CHANGE" comments as a result (ones about
the HeaderCache remain.)
I had jam crash in strange ways because a stack-allocatted aray was
overflowing. Double the limit, and add sanity checks with exit and clear
error messages in case it happens again.
If setting OPTIM by jam basically makes it impossible for the project that
is using jam to set its own optimization level while still allowing user
to override that in command line. For example in Haiku jam files there is
line like this: "OPTIM ?= -O2", which obviously is meant to set optimization
level to O2 unless user overwrites it. Unfortunately, because Jam have already
set OPTIM to -O this line never had an intended effect.
After this Jam no longer thinks it knows best what is good for projects
that are using it and Haiku is by default compiled with -O2.
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Looks like it wasn't enough yet after the PM merge.
However we still have an issue with a silently failed Link action
which actually is smaller than the max line size...
For its input files jam uses a buffer of 512 chars for fgets(). Lines
would therefore be split silently after that length, which could lead to
"interesting" issues. Now we fail to prevent the situation from going
unnoticed.
When reading the cache file failed we have to assume it is corrupt and
we should use any entries read from it. So now we remove the ones we
read again.
* This changes the optimization level from -O3 to -O
* This will prevent segfaults when creating jam via the Makefile on FreeBSD
* Benchmarking was done, and there seems to be no negative performance impact
* Another option would be -O3 -fno-strict-aliasing, but this has no noticeable benefit over -O