Skip to content

Commit

Permalink
make: build virtme-ng-init by default
Browse files Browse the repository at this point in the history
As mentioned in the README file, the 'make' command should only build
virtme-ng-init. Building is what 'make' usually does, and not installing
stuff.

Since commit 85a9b42 ("Make it build on macOS"), 'make' was building
virtme-ng-init, but it was also trying to install it with other files
elsewhere on the system, what 'make install' does. That's because make
was using the first target as the default one, so the 'install' one.

Instead of directly calling 'cargo' like it was the case before, the
'build' part of setup.py is called. This will generate files in the
build dir that are probably not needed, but it is quick, and it will
also build virtme-ng-init properly, what we want.

While at it:

- Mention all targets that are not linked to files in .PHONY.

- Only generate the init file when needed: when the .rs files have been
  modified.

- Initialise the submodule if the .rs files are not present.

- A new 'clean' target can help to force rebuilding (or just to clean,
  even if it looks like it missed many generated files...).

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
  • Loading branch information
matttbe committed Dec 3, 2024
1 parent 55698bf commit e437dd1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@ INSTALL_ARGS := # todo: add --break-system-packages if ubuntu
# Get git version information for make install
GIT_DESCRIBE := $(shell git describe --always --long --dirty)

.PHONY: all init clean install install_from_source install_only_top

all: init

virtme_ng_init/src/*.rs:
git submodule update --init --recursive

virtme/guest/bin/virtme-ng-init: virtme_ng_init/src/*.rs
BUILD_VIRTME_NG_INIT=1 python3 setup.py build

init: virtme/guest/bin/virtme-ng-init
@echo "Version: $(GIT_DESCRIBE)"

clean:
BUILD_VIRTME_NG_INIT=1 python3 setup.py clean
rm -f virtme/guest/bin/virtme-ng-init

# see README.md '* Install from source'
install: install_from_source
install_from_source:
Expand Down

0 comments on commit e437dd1

Please sign in to comment.