Commit graph jw-pkg/make/platform.mk
Author SHA1 Message Date
d90c0ebf18
cache.mk: Include from topdir.mk, not make.mk
During a topdir "make all", caching variables is currently not the
first thing that happens. Instead, variables are cached as soon as a
project recurses into the make subdirectory. That was necessary,
because some makefiles were regenerated in the make subdirectory by
autoconf, potentially contributing variables that needed to be
cached.

As of now, autoconf is long gone and this is no longer true. And for
some variables, the two step process becomes involved, notably for
PYTHONPATH, which coding agents would like to look at from the topdir
very early on.

This commit moves the .project-cache.mk creation to topdir.mk, and
.projects-cache.mk creation to jw-pkg/Makefile to address that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 14:38:24 +02:00
6325f9ea19
platform.mk: Fix make -C $(TOPDIR)/make clean all
If run from $(TOPDIR), "make clean all" runs fine, because it
recurses twice into $(TOPDIR)/make, once for every target. If invoked
directly from $(TOPDIR)/make, it can break in two different ways:

If the cache files don't exist, "make clean all" in $(TOPDIR)/make
tries to create them too early as implicit make target. This leaves
variables empty which should have a value.

If the cache files do exist, "make clean all" in $(TOPDIR)/make
includes them, cleans them, and re-creates them from the same
variables just read from cache. Undesirable for cache purging.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 12:34:05 +02:00
2cafd60b71
platform.mk: Support PREREQ_RUN_ADD
Modifying JW_PKG_XXX_PATH in pre-local.mk is fragile.

Amending PREREQ_RUN in pre-local.mk works, but only with
$(JW_PKG_NO_CACHE) == true, or if "undefine JW_PKG_XXX_PATH" is also
added in pre-local.mk. Otherwise JW_PKG_XXX_PATH will not be
recomputed, because it's already defined from the cache.

Introduce the new variable PREREQ_RUN_ADD to solve that. If it's
defined, it automatically invalidates the JW_PKG_XXX_PATH variables
and sets them up for recalculation in py-path.mk / ldlibpath.mk.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-24 21:43:11 +02:00
4660a34305
platform.mk: Move include .cache-project.mk up
Reverse inclusion order of .cache-project.mk and cache-projects.mk:
Definitions in .cache-project.mk should win over cache-projects.mk,
because it's the more specialized include file, and the way the
definitions in both files are structured, the later doesn't overwrite
the earlier.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-24 21:43:11 +02:00
514d66dac1
cmds.distro.CmdInfo: Rename to cmds.platform.CmdInfo
Rename command "distro" to "pkg" together with "info", its last
remaining subcommand. "distro" is often used in the sense of "Linux
distribution", which would be too narrow for the targets jw-pkg could
theoretically support.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-24 16:53:55 +02:00
3457daa0fb platform.mk: Add HOST_DISTRO_INFO
HOST_TUPLE is bastardized to contain more info that just the GNU
Triplet. Add HOST_DISTRO_INFO to do the caching job, and leave
HOST_TUPLE alone.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-03 05:32:47 +01:00
e93338872f defs.mk: Move PKG_FORMAT definition into platform.mk
PKG_FORMAT is now more straightforward to get with from the revised
jw-pkg.py distro info --format '%{cascade}', so do that, and do it in
the context where all the other variables are set from the output of
that command.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-02 12:55:36 +00:00
fa65047d2f platform.mk: Replace get-os.sh by jw-pkg.py distro info
To reduce redundancy, replace get-os.py by jw-pkg-py distro info.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-02 12:55:36 +00:00
521600bc56 projects.mk -> platform.mk: Move definitions up
To remove redundancy, get-os.sh needs to be retired in favor of
pkg.py distro info. It's needed in platform.mk, but the only
definiton of JW_PKG_PY is in projects.mk, so move it, along with the
variables essential for the command:

  include $(JWBDIR)/make/py-version.mk (defining PYTHON)
  JW_PKG_PY
  DEVELOPMENT
  VERSION_FILE

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-02 12:55:36 +00:00
741a3b6db2 make: Install cache-projects.mk
.cache-projects.mk is not installed / packaged, which makes builds
against an installed jw-pkg considerably slower. Change that, at the
risk of making the installed jw-pkg-devel less versatile. This commit
installs a cache file cache-projects.mk, renamed from
.cache-projects.mk, because there's no justification for hiding an
installed makefile. At least I can't think of one.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-01 09:50:52 +01:00
f05e1ee0e3 make/[Makefile|*.mk): Improve variable caching
This commit aims at improving speed by using better caching.

  - Makefile, cache.mk: Split .cache.mk up

    To allow caching of runtime path variables which are
    project-specific, split .cache.mk up in .cache-project.mk and
    .cache-projects.mk

  - ldlibpath.mk: Cache ldlibpath, exepath and pythonpath

    Place the output of $(call proj_query ldlibpath), $(call
    proj_query, exepath) and $(call proj_query pythonpath) in
    JW_PKG_LD_LIBRARY_PATH, JW_PKG_EXE_PATH, and JW_PKG_PYTHON_PATH
    respectively, and cache the variables in make/.project-cache.mk.

  - cache.mk: Use = instead of :=

    Recursively expanded variables are nearly as fast as := variables
    if the assigned value is a fixed string. And sometimes it's not,
    rightly so, because variables get assigned below, as with
    JW_PKG_XXX for instance.

  - cache.mk: Use $(TOPDIR) as variable values

    Replace absolute references to project's topdir by $(TOPDIR) with
    sed. As soon as the project queries produce absolute paths, they
    will be transformed into relative paths which allow the code base
    to be moved to a different location and still remain functional
    without a rebuild.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-26 17:17:23 +01:00
9217d38964 Everywhere: Rename package "jw-build" to "jw-pkg"
jw-build doesn't stop at building software, packaging it afterwards
is also a core feature, so this commit gives the package a better
name.

The commit replaces strings s/jw-build/jw-pkg/ in text files and file
names. Fallout to the functionality is fixed, variable names are left
as they are, though. To be adjusted by later commits.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-28 13:35:56 +01:00
23ce1b8642 platform.mk / defs.mk fix: SHELL was referenced before definition
SHELL defaults to /bin/sh on Ubuntu 16, and was used to get-os.sh, which fails

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-08-02 05:48:32 +00:00
bdd66dbc26 Everywhere: Rename MOD_SCRIPT_DIR -> JWB_SCRIPT_DIR
Follow name change of MODDIR -> JWBDIR.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-29 21:45:24 +00:00
b2d6e6f554 Everywhere: Rename MODDIR -> JWBDIR
Rename the omnipresent MODDIR variable to JWBDIR, since that's more to the
point.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-29 21:34:18 +00:00
3ae0916ff4 defs-cpp.mk, platform.mk: Add support for st-disc1-f429i
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-04-04 14:36:38 +00:00
9c773838c7 make: Improve flash-fetch targets
- Add support MCU_FLASH_BANK_NAME to support multiple banks
- Prefix binaries with TARGET_PRODUCT, if defined
- Fix flash data for stm32f769i-disco

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-29 13:32:16 +00:00
419d3b2a08 defs-cpp.mk, defs.mk, platform.mk: More cleanup to defs-cpp.mk
- Group more consistently into overall default choices, template cascade and
  compiler flags
- Add definitions for st-nucleo-f103rb (for now)

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-20 15:06:25 +00:00
aa87adad04 platform.mk: Fix undefined SYSTEM_LIBDIR variable
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-17 15:28:24 +00:00
5e9dba6d15 platform.mk: Add support for explicit TARGET = linux
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-03 19:49:54 +00:00
0eaef0c326 conf/jcs, make, tmpl/doxygen: Align equal signs in makefiles to column 30
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-03 18:12:28 +00:00
be6a2792d4 platform.mk fix: Predefined HOST_TUPLE wasn't evaluated
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-03 14:48:46 +00:00
bf9bb79246 make/Makefile, defs-cpp.mk, platform.mk: Generalize MinGW build machinery (a bit)
This commit takes the MinGW cross compilation further into the direction of
being a more general framework for cross compilation. Changed some variable
names that are too specialized, notably MinGW tool chain directories,
compilers, utilities.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-03 10:45:08 +00:00
59da607e12 defs.mk, platform.mk: Include pre-local.mk and cache.mk from platform.mk
platform.mk is sometimes included before defs.mk, e.g. from
$(TOPDIR)/make/proj.mk, then these definitions are necessary

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-03 09:56:11 +00:00
ce2c6b0190 defs-cpp.mk, platform.mk: Rename variable MINGW_SYS_ROOT -> TC_SYS_ROOT
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-03 09:31:38 +00:00
f1eafaa234 platform.mk: Consistently define TARGET_TUPLE|TRIPLE_WORDS
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-03 09:07:35 +00:00
f9d398d219 make: Fix MinGW build machinery machinery
This commit makes it possible to successfully run "make all" against ytools'
again, with TARGET_TUPLE set to i686-ms-w64-mingw. Lots of minor and major
tweaks here and there.

The biggest diff is a move of the architecture-related definitions into
platform.mk. The are needed pretty early on, so that seems reasonable.

Making this work again is part of the larger effort to support cross
buildchains in a more concise way, i.e. without so many if ($(TARGET),mingw))
all over the place. TARGET's relevance should dwindle, until it's finally taken
over by the TARGET_XXX variables extracted from TARGET_TUPLE or TARGET_TRIPLET.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-02 17:21:48 +00:00
316435bb78 $(MODDIR)/make/defs.mk: Split off defs-cpp.mk with C++ definitions
C++ definitions are numerous, and they shouldn't pollute variable space and
performance outside of directories containing C++ files. This commit pushes
them into a defs-cpp.mk file.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-02-27 20:46:54 +00:00
Jan Lindemann
5dea335512 platform.mk: Fix ifndef TARGET condition 2009-07-12 19:30:17 +00:00
Jan Lindemann
a51ebac3dc platform.mk: Add file 2009-07-09 11:53:53 +00:00