0

I found this port = ${PORT} in one makefile. How can I pass value to the variable port using make commands?

marla
  • 43
  • 5

1 Answers1

2

for many simple situations, pass the values on the command line using the variable=value grammar. Note that this will (usually) override the value in the Makefile.

make PORT=1234 ...
# OR
make port=1234 ...

This format will also override other variable settings (environment variables, built-in variables, ...). It will NOT replace variables set with the 'override' directive.

@rveerd comment provide a link to more complete answer.

dash-o
  • 13,723
  • 1
  • 10
  • 37
  • 1
    Note that these are two separate variables. In this particular example `port` gets copied from the uppercase `PORT` within the Makefile as per the code the OP posted, so both will work. – tripleee Sep 29 '19 at 10:21