Commit graph

12 commits

Author SHA1 Message Date
Kelvin M. Klann
f9cc7b24eb build: move cleaning of test files to test/Makefile
Move them from the distclean target in the root Makefile.

Related commits:

* a1ff0c3fd ("testing", 2026-01-16)
* 2f6afc99d ("gcov testing", 2026-01-16)
2026-01-17 02:14:51 -03:00
netblue30
e6b240b3fa remove make test-sysutlis 2026-01-16 13:16:34 -05:00
Kelvin M. Klann
fb11081bec build: allow overriding common tools
Tools:

* gzip
* install
* rm
* strip
* tar

For the programs not checked in configure.ac:

From the manual of GNU Autoconf (version 2.71):

> If you use `AC_PROG_INSTALL`, you must include `install-sh` in your
> distribution

So set `install` just in the Makefile.  Use `$(RM)` to ensure that `-f`
is always used and to make it easier to spot when `-r` is used.

See commit 93d623fdf ("build: allow overriding certain tools",
2024-02-23) / PR #6222.
2024-05-29 17:35:35 -03:00
Kelvin M. Klann
97d5a79030 build: prevent make clean error if compile.sh --clean fails
In the `debian_ci` job in .gitlab-ci.yml, dpkg-deb calls `make
distclean` before calling ./configure, which makes `make clean` fail due
to test/compile/compile.sh not being able to source config.mk (which is
created by ./configure):

     dpkg-source -i -I --before-build .
    [...]
       dh_auto_clean
    	make -j2 distclean
    make[1]: Entering directory '/builds/Firejail/firejail_ci'
    error: run ./configure to generate config.mk
    [...]
    cd compile && ./compile.sh --clean
    ./compile.sh: line 15: ./../../config.sh: No such file or directory
    make[2]: *** [Makefile:24: clean] Error 1

This amends commit 152a21f15 ("build: simplify clean target",
2023-07-29) / PR #6186.
2024-02-07 09:45:33 -03:00
Kelvin M. Klann
152a21f151 build: simplify clean target
Move some clean commands into more relevant makefiles.
2024-01-31 17:37:05 -03:00
Kelvin M. Klann
5f27852906 build: remove unnecessary distclean targets
This also fixes the duplicate execution of the "clean" targets.
2023-07-20 05:03:47 -03:00
Kelvin M. Klann
c0c284e33c build: move MAKEFLAGS to config.mk.in
To reduce the amount of boilerplate in the makefiles.

This amends commit 9789c263a ("build: disable all built-in implicit make
rules", 2023-06-21) / PR #5864.
2023-06-24 11:54:15 -03:00
Kelvin M. Klann
9789c263a2 build: disable all built-in implicit make rules
Use `make -r` to reduce unnecessary filesystem lookups.

Overall, this appears to reduce the amount of implicit rule searches by
~93.3% (~97.5% compared to a8f01a383) for the default build and by
~83.3% (~99.3% compared to a8f01a383) for the "man" target (as an
example):

    $ git show --pretty='%h %ai %s' -s
    a8f01a383 2023-06-20 05:26:23 +0000 Merge pull request #5859 from kmk3/build-remove-retpoline
    $ ./configure >/dev/null
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    6798
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    1085
    # (in the previous commit)
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    2535
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    42
    # (with this commit applied)
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    170
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    7

Environment: GNU make 4.4.1-2 on Artix Linux.

Note: According to make(1p) in POSIX.1-2017, "If .SUFFIXES does not have
any prerequisites, the list of known suffixes shall be cleared.", while
"The result of setting MAKEFLAGS in the Makefile is unspecified."

Commands used to search and replace:

    $ git ls-files -z -- '*Makefile*' | xargs -0 -I '{}' sh -c \
      "printf '%s\n' \"\$(sed -E \
        's/^(.SUFFIXES:)/\1\nMAKEFLAGS += -r\n/' '{}')\" >'{}'"
2023-06-21 14:21:09 -03:00
Kelvin M. Klann
d4be8e512d build: disable most built-in implicit make rules
Clear `.SUFFIXES:` to reduce unnecessary filesystem lookups.

Overall, this appears to reduce the amount of implicit rule searches by
~62% for the default build and by ~96% for the "man" target (as an
example):

    $ git checkout master >/dev/null 2>&1
    $ git show --pretty='%h %ai %s' -s
    a8f01a383 2023-06-20 05:26:23 +0000 Merge pull request #5859 from kmk3/build-remove-retpoline
    $ ./configure >/dev/null
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    6798
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    1085
    # (with this commit applied)
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    2535
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    42

Environment: GNU make 4.4.1-2 on Artix Linux.

Commands used to search and replace:

    $ git ls-files -z -- '*Makefile*' | xargs -0 -I '{}' sh -c \
      "printf '%s\n' \"\$(sed '1s/^/.SUFFIXES:\n/' '{}')\" >'{}'"

See also commit f48886f25 ("build: mark most phony targets as such",
2023-02-01) / PR #5637.
2023-06-21 12:22:34 -03:00
Kelvin M. Klann
6ece8cec3d build: standardize commands on top of makefiles
To make the makefiles look more similar.
2023-06-21 12:22:10 -03:00
Reiner Herrmann
057f431b0a CI: fix wrong matching for test errors
grep was returning non-zero exit code if it did NOT find the
error marker, and zero if it did.
2022-07-30 10:48:33 +02:00
Kelvin M. Klann
011d84b462 build: reduce autoconf input files from 32 to 2
Configure summary: autoconf essentially only parses configure.ac and
generates the configure script (that is, the "./configure" shell
script).  The latter is what actually checks what is available on the
system and internally sets the value of the output variables.  It then,
for every filename foo in AC_CONFIG_FILES (and for every output variable
name BAR in AC_SUBST), reads foo.in, replaces every occurrence of
`@BAR@` with the value of the shell variable `$BAR` and generates the
file foo from the result.  After this, configure is finished and `make`
could be executed to start the build.

Now that (as of #5140) all output variables are only defined on
config.mk.in and on config.sh.in, there is no need to generate any
makefile nor any other mkfile or shell script at configure time.  So
rename every "Makefile.in" to "Makefile", mkdeb.sh.in to mkdeb.sh,
src/common.mk.in to src/common.mk and leave just config.mk and config.sh
as the files to be generated at configure time.

This allows editing and committing all makefiles directly, without
potentially having to run ./configure in between.

Commands used to rename the makefiles:

    $ git ls-files -z -- '*Makefile.in' | xargs -0 -I '{}' sh -c \
      "git mv '{}' \"\$(dirname '{}')/Makefile\""

Additionally, from my (rudimentary) testing, this commit reduces the
time it takes to run ./configure by about 20~25% compared to commit
72ece92ea ("Transmission fixes: drop private-lib (#5213)", 2022-06-22).
Environment: dash 0.5.11.5-1, gcc 12.1.0-2, Artix Linux, ext4 on an HDD.

Commands used for benchmarking each commit:

    $ : >time_configure && ./configure && make distclean &&
      for i in $(seq 1 10); do
      { time -p ./configure; } 2>>time_configure; done
    $ grep real time_configure |
      awk '{ total += $2 } END { print total/NR }'
2022-06-30 05:30:14 -03:00
Renamed from test/Makefile.in (Browse further)