Commit Graph

126 Commits (be3c8f8b2bf2893950b11ea7fa16cea074bc7903)

Author SHA1 Message Date
Roman Yeryomin 2ca084ccaa build: improve ccache support
Set CCACHE_DIR to $(TOPDIR)/.ccache and CCACHE_BASEDIR to $(TOPDIR).
This allows to do clean and dirclean. Cache hit rate for test build
after dirclean is ~65%.
If CCACHE is enabled stats are printed out at the end of building process.
CCACHE_DIR config variable allows to override default, which could be useful
when sharing cache with many builds.
cacheclean make target allows to clean the cache.

Changes from v1:
- remove ccache directory using CCACHE_DIR variable
- remove ccache leftovers from sdk and toolchain make files
- introduce CONFIG_CCACHE_DIR variable
- introduce cacheclean make target

Signed-off-by: Roman Yeryomin <roman@advem.lv>
4 years ago
Sergio E. Nemirowski 645b1ec3e2 build: add 'make kernel_xconfig' command
This adds the kernel_xconfig make target.

Signed-off-by: Sergio E. Nemirowski <sergio@outerface.net>
4 years ago
Sergio E. Nemirowski 8fb0b15efd build: add nconfig
Add support for make target nconfig (ncurses)

Reviewed-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Signed-off-by: Sergio E. Nemirowski <sergio@outerface.net>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Eneas U de Queiroz db6c1214e0 build: add option to treat recursive deps as error
Running make with RECURSIVE_DEP_IS_ERROR=1 will cause a hard failure
when a recursive dependency is detected.  This is useful to apply
stricter Ci tests, for example.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
4 years ago
Eneas U de Queiroz f827f947ae build: show make output in scripts/config when V=s
This should make debugging build errors in scripts/config a bit easier.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
4 years ago
Jo-Philipp Wich 6c16d64b2a Revert "build: add option to warn on recursive dependency"
This reverts commit 3204430e38.

Reverting this commit in preparation for reverting
dcf3e63a35 ("build: scripts/config - update to kconfig-v5.6") which
introduces various unaddressed build breakages.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
4 years ago
Eneas U de Queiroz 3204430e38 build: add option to warn on recursive dependency
This addes the option to treat recursive dependencies as warnings
instead of errors, by running make with WARN_RECURSIVE_DEP=1.

Note that the script/config targets will not get rebuilt when you add or
remove WARN_RECURSIVE_DEP while running make.  One must run
'make config-clean' before building config with a different setting.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
4 years ago
Eneas U de Queiroz 8636a17214 build: simplify building *config targets
Instead of passing pkg-config location through a variable when building
qconf (make xconfig), prepend its parent directory to the PATH, as it is
being done for other conf targets.

Use a Makefile pattern rule to group all 'scripts/config/%onf'
(currently conf, mconf, qconf) targets in a single rule.  Add -O2 to
CFLAGS when building them as well.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
4 years ago
Petr Štetiar 965f341aa9 build: fix host menu config targets using ncurses
On a recent Gentoo Linux installation, invoking `make menuconfig`, `make
kernel_menuconfig` or `make kernel_nconfig` in the build system fails,
whereas for example `make menuconfig` in the kernel tree alone works as
expected.

This is happening because STAGING_PREFIX is not defined when kernel's
{menu,n}config target calls pkg-config from the toolchain/host and thus
pkg-config returns an empty value, and the fallback values in the kernel
config script are applied but those are off and the linking fails.

Solution is to use system's pkg-config for all ncurses based menu config
targets in order to provide proper compiler/linker flags.

Ref: FS#2423
Cc: Thomas Albers <thomas.gameiro@gmail.com>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
Tested-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Petr Štetiar 83c0ee621b build: fix kernel_*config targets on 4.19
Recent kernel versions need toolchain in order to properly configure
kernel, for example to set CC_HAS_ASM_GOTO config symbol, so missing
toolchain leads to the following error while running `make
kernel_oldconfig` on ath79 target with 4.19 kernel in the clean tree:

 init/Kconfig:17: syntax error
 init/Kconfig:16: invalid option
 ./scripts/clang-version.sh: line 15: mips-openwrt-linux-musl-gcc: command not found
 ./scripts/gcc-plugin.sh: line 11: mips-openwrt-linux-musl-gcc: command not found
 net/sched/Kconfig:44: warning: menuconfig statement without prompt
 make[4]: *** [scripts/kconfig/Makefile:69: oldconfig] Error 1

So in order to support this new kernel versions, this patch adds
toolchain as a hard dependency to the kernel_*config targets.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Jo-Philipp Wich 2d9d57b9de build: rename .packagesubdirs to .packageauxvars
Subsequent commits will put more auxiliary information into this file,
such as the per-package ABI version, so rename the metadata script
subcommand and file names accordingly.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years ago
Felix Fietkau 29b2199eb0 build: fix target metadata scan dependencies
Move SCAN_DEPS to scan.mk to eliminate redundancy with scripts/feeds
Add image/*.mk to SCAN_DEPS for targets to pick up newly added devices

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Alif M. Ahmad 23dd6db2ea include/toplevel.mk: Add xconfig target
Add xconfig target to include/toplevel.mk, so that ``make xconfig`` can
be invoked from $TOPDIR to use Qt based configuration tool to prepare
.config file.

The qconf related sources are taken from linux 4.9.13 archive.

Signed-off-by: Alif M. Ahmad <alive4ever@live.com>
7 years ago
Alexander Couzens acc5ab6b92
include/toplevel: set env GIT_ASKPASS=/bin/true
When git-https request a service (e.g. github) which ask for credentials
git will pass this request to the user resulting download.pl to wait for
user input. Set GIT_ASKPASS to stop asking.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
7 years ago
Felix Fietkau 737b063cc2 build: ensure that flock is available for make download
It ensures that make download can parallelize downloads, even when some
packages download the same files (e.g. gcc/initial, gcc/final)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Sergey Ryazanov e06d8f0f6f build: new fixes for symlinked .config handling
When running "make {config|defconfig|oldconfig}" with symlinked .config
(e.g. to env/.config) it renames symlink to .config.old, creates new
.config file, and writes the updated configuration into it.

This breaks the desired workflow when changes in the configuration can
be checked using "scripts/env diff" and commited using "scripts/env
save". Since the env/.config file is not updated.

The things become even worse when working with feeds, since feeds script
quite often silently invokes "make {oldconfig|defconfig}" and breaks the
symlink.

Fix this issue by exporting KCONFIG_OVERWRITECONFIG=1, which forces
mconf to overwrite the .config content, instead of renaming it and
creating a new file. This variable is set only if .config is a symlink,
otherwise the variable is not exported and the old behaviour is
preserved.

This change uses the same behaviour as "make menucofig", which has
already been fixed in commit 5bf98b1acc.

Also make a tiny cosmetic update to the "make menuconfig" target code
layout to make it look like other config handling targets.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
7 years ago
Felix Fietkau ddbb036bbb build: allow val.% targets to bypass the prepare steps
Significantly reduces time spent processing those targets and should
also silence some log clutter which could confuse buildbot

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Sergey Ryazanov 5bf98b1acc build: fix symlinked .config handling
When running "make menuconfig" with symlinked .config (e.g. to
env/.config) it renames symlink to .config.old, creates new .config file
and writes updated configuration here.

This breaks the desired workflow when changes in the configuration could
be checked using "scripts/env diff" and commited with
"scripts/env save". Since the env/.config file is not updated.

Fix this issue by exporting KCONFIG_OVERWRITECONFIG=1, which forces
mconf to overwrite the .config content, instead of renaming it and
creating a new file. This variable is set only if .config is a symlink,
otherwise the variable is not exported and the old behaviour is
preserved.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
7 years ago
Felix Fietkau b044bd5921 build: remove package makefile overlay functionality
Recent attempts to use it have shown that it does not work properly
except for a few undocumented cases. It's better to remove this now to
avoid having more people fall into the same trap

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 9467ce42da build: get rid of host.mk
Defined required host related variables in toplevel.mk instead

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Baptiste Jonglez f938de7914 build: fix dependency of kernel_menuconfig target
When running "make kernel_menuconfig" in a clean tree, it fails with:

    make[1]: *** No rule to make target 'tools/quilt/install'.  Stop.

Replacing the dependency with 'tools/quilt/compile' fixes the issue (quilt
and all its prerequisites will be built, and quilt will be installed in
staging_dir).

Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
7 years ago
Felix Fietkau d2ddda691e build: ensure that prereq-build is run before metadata scan from feeds (FS#367)
Fixes ./scripts/feeds update

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 7a315b0b5d build: implement make check and make package/X/check
This is intended to be used for a wide array of package sanity checks.

The first check that is implemented is for the hash of downloaded files.
It checks:
  - Missing hash
  - Use of SHA256 instead of MD5
  - dl/<file> hash not matching hash in makefile
  - deprecated MD5SUM variable

The deprecated MD5SUM variable check is skipped for feeds/ until OpenWrt
is updated as well

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Mathias Kresin 59261cbf38 docs: remove all refrences in Makefiles/scripts
The SDK Makefile still trys to copy the docs folder which was removed
with 882f4d2d63. This causes an SDK build
error.

All other removals are just cleanup.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Jo-Philipp Wich 8cc9224115 sdk: predefine SOURCE_DATE_EPOCH
When building packages within the SDK, there is no Git revision history
available so prepopulate SOURCE_DATE_EPOCH in version.mk, similar to
how we handle REVISION already.

Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
John Crispin 1b13b35231 include/toplevel.mk: fix defconfig when ~/.openwrt/defconfig exists - take 2
commit 5b72807416 ("include/toplevel.mk: fix defconfig when
~/.openwrt/defconfig exists") was missing a !

Signed-off-by: John Crispin <john@phrozen.org>
8 years ago
John Crispin 5b72807416 include/toplevel.mk: fix defconfig when ~/.openwrt/defconfig exists
./scripts/feeds update will reset the .config file if ~/.openwrt/defconfig
exists, thus resetting the target to ar71xx.

Signed-off-by: John Crispin <john@phrozen.org>
8 years ago
Felix Fietkau 9ae952cf8c build: split scripts/metadata.pl into target-metadata.pl and package-metadata.pl
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Hannu Nyman 3193053df7 Centralize setting of all version info to include/version.mk
Centralize setting all version information in include/version.mk
* Set RELEASE env variable in include/version.mk instead of toplevel.mk.
  Stop exporting the variable.
* Remove hardcoded release name from /etc/banner

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
8 years ago
Felix Fietkau 470442ea0f build: fix make download in the SDK
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau 471ca4197c toplevel.mk: rescan target metadata if the image makefile changes
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau 82522dbaee build: introduce SOURCE_DATE_EPOCH variable
SOURCE_DATE_EPOCH is the date of the last modified file using git/svn
as date source.
See https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48584
8 years ago
Jo-Philipp Wich 0333da8943 include: group kmod ipk files into a "kernel" subdirectory
This is useful to just use the kmods from an official build while supplying
base packages from a custom feed or the other way around; for just overriding
the kmods with a local repo while using official repos for the rest.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 48475
8 years ago
Felix Fietkau 830c308cf9 build: ignore the linux package in the sdk only for generating package data, not for dependencies
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48171
8 years ago
Felix Fietkau c390359418 build: prevent host default LDFLAGS from leaking into packages
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48158
8 years ago
Felix Fietkau dd537242a2 build: filter out relative directory entries from $PATH
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48107
8 years ago
Felix Fietkau c3d3dbc191 toplevel.mk: fix distclean
- remove logs like "make dirclean" does
- remove key-build*

Signed-off-by: Dirk Neukirchen <dirkneukirchen@web.de>

SVN-Revision: 47397
9 years ago
Jo-Philipp Wich dea417017e toplevel.mk: drop LD_LIBRARY_PATH overrides
Overriding LD_LIBRARY_PATH for host utilities frequently leads to problems
with host executables loading shared libraries from the staging_dir, leading
to crashes due to incompatible ABIs.

Since most host utilties either embed a proper rpath or are reworked to link
statically we do not need the workaround anymore.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 47103
9 years ago
Rafał Miłecki 164ac62643 include: toplevel: drop unused OPENWRTVERSION variable
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 46906
9 years ago
Steven Barth d1f6bd2541 toplevel: fix release name
Signed-off-by: Steven Barth <steven@midlink.org>

SVN-Revision: 46899
9 years ago
Jo-Philipp Wich b052a00c0b toplevel.mk: fix LD_LIBRARY_PATH for host binaries
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 46394
9 years ago
Felix Fietkau 5868331214 build: don't call prereq for any package/symlinks rules
Most of the time, we want to make sure OpenWrt has been configured and
setup before start running make. However, in case of package/symlinks,
forcing prereq as a dependency creates multiple issues:
*when executed on a clean workspace, it will prompt for user input
 and open a menuconfig window before executing the feeds command
*the only way around that is to provide a .config. However, the "prereq"
 target would then run a "make defconfig", which will remove all the
 packages in the .config but from external feeds, as feeds have not been
 installed yet.

The only way to currently work around this, is to generate a fake config
by running "make defconfig", then "make package/symlinks", copy the real
config (which at this point disregards the previously generated config),
and run make defconfig again. Something like this:

make defconfig
make package/symlinks
cp real.config .config
make defconfig

This change is removing the need for the first defconfig, making the
process more logical for OpenWrt users using the package/symlinks target.

Signed-off-by: Mathieu Olivari <mathieu@qca.qualcomm.com>

SVN-Revision: 45657
9 years ago
Felix Fietkau a0ced5164a build: tell users to do non-paralle builds on errors
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 45457
9 years ago
Luka Perkov 7002f6326e include: remove trailing whitespaces
Signed-off-by: Luka Perkov <luka@openwrt.org>

SVN-Revision: 45127
9 years ago
Felix Fietkau 379dc5c11f build: move tmp/.prereq-build to staging_dir/host to gracefully handle staging_dir deletion
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 44551
9 years ago
Jo-Philipp Wich 1a27d74827 include: remove SDK specific target from toplevel.mk
Instead introduce a generic "make prepare" target which is executed if
include/prepare.mk exists.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 44329
9 years ago
Jo-Philipp Wich 2cdba572f9 include: let HOSTCC default to $(CC), not gcc
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 44277
9 years ago
Jo-Philipp Wich d3610773a1 include: test build prereqs before preparing tempinfo
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 44270
9 years ago
Jo-Philipp Wich 4685e4f273 sdk: track files with git and use it to implement proper clean targets
Initialize a Git repository in the SDK and use git reset / git clean
to rollback any SDK changes with "make clean" or "make dirclean".

This approach is more robust than nuking entire directory trees because
some parts of them might have been shipped with the original archive.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 43904
9 years ago
John Crispin c22bebf6ab Fix build when TAR_OPTIONS env variable is set
The build system sets a make variable TAR_OPTIONS to the unpacking
command, i.e. "-xf -". Now if an environment variable with the same
name is set, the make variable is automatically exported to the
environment. The make variable is added to the tar command in the
makefile, and tar adds the environment variable. This results in a
command like "tar -c /some/dir -xf - -xf -" which of course doesn't
work. It is also difficult to spot as the second "-xf -" is not
visible on the command line.
I suggest this is fixed by unexporting TAR_OPTIONS as I see no use
of the evironment variable, and it is changed from the original
value anyway.

Signed-off-by: Jan Kardell <jan.kardell@telliq.com>

SVN-Revision: 42794
10 years ago