A
A
Arris2021-05-12 17:57:51
GNU Make
Arris, 2021-05-12 17:57:51

[SOLVED] Makefile + read variable value from console + dch - how to do it?

Due to established traditions, we actively use make-files at work. And for the normal assembly of DEB packages, and to simplify frequently used operations. And if everything is fine with simple recipes:

build:		##@build Build project to DEB Package
  @echo Building project to DEB-package
  export COMPOSER_HOME=/tmp/ && dpkg-buildpackage -rfakeroot --no-sign


Then with this recipe - like fish on ice:
dchv:		##@development Append release
  export DEBEMAIL="[email protected]" && \
  export DEBFULLNAME="Arris" && \
  export VERSION=$(shell read -p "Version: ";echo $$REPLY) && \
  dch -v $(VERSION)


What do you want? I would like to run `make dchv`, enter the version number in the console and get the launch of `dch -v 1.3.4`
I note: the version number can be anything, up to 15.5.11 + fix35

How to do this?

PS Alternatively, `make dchv 1.3.4` will do, but teaching makefile how to do this is a pain in the ass :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2021-05-13
@Arris

dch -v $$VERSION
should work.
because

export VERSION=$(shell read -p "Version: ";echo $$REPLY)
exports a variable inside the shell, but $(VERSION)refers to a make variable rather than a shell variable.
Alternatively, `make dchv 1.3.4` will do, but teaching makefile how to do this is a pain in the ass :(

don't do it because it's against the grain. It would be more correct to do this: make dchv VERSION=1.3.4and throw out the code for entering the VERSION variable from the dchv rule, i.e. leave onlydch -v $(VERSION)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question