logo
down
shadow

Makefile: use multiline string as input for command


Makefile: use multiline string as input for command

By : user2955645
Date : November 22 2020, 10:40 AM
fixed the issue. Will look into that further While this does not appear to be possible in make itself -- make ends up interpreting every line of the variable as a command in the recipe -- there is a workaround: You can export the variable as a shell variable and reference that in the command. That is:
code :
define WATCHMAN_TYPESCRIPT_TRIGGER =
["trigger", "./ts", {
  "name": "tsTrigger",
  "expression": ["suffix", "ts"],
  "command": ["make" "typescript"]
}]
endef

# export as shell variable
export WATCHMAN_TYPESCRIPT_TRIGGER

# ...

# use shell variable in the command. $$ in make means $ in the shell command.
watchman-typescript:
    watchman -j "$$WATCHMAN_TYPESCRIPT_TRIGGER"


Share : facebook icon twitter icon
Makefile - Why is the read command not reading the user input?

Makefile - Why is the read command not reading the user input?


By : saikrishna
Date : March 29 2020, 07:55 AM
hope this fix your issue The immediate problem is that Make itself interprets the $ differently than the shell does. Try:
code :
    echo "What is the root directory of your webserver? Eg. ~/Server/htdocs"; \
    read root_path; \
    echo $$root_path
Makefile multiline dash command run executable in a detached process

Makefile multiline dash command run executable in a detached process


By : Peter
Date : March 29 2020, 07:55 AM
like below fixes the issue The important thing to remember here is that your line breaks don't actually exist when the shell sees the command.
So your first command becomes:
code :
$(ENV_VARS) python -m SimpleHTTPServer $(TEST_PORT); PID=$$(lsof -t -i @localhost:$(TEST_PORT) -sTCP:listen); echo $(PID); if [ -n "$$PID" ]; then python test.py; fi; function finish { if [ -n "$$PID" ]; then kill -9 $$PID; fi } trap finish EXIT;
PID=$$(lsof -t -i @localhost:$(TEST_PORT) -sTCP:listen); if [ -n "$$PID" ]; then $(ENV_VARS) python test.py; fi function finish { if [ -n "$$PID" ]; then kill -9 $$PID; fi } echo $$PID; trap finish EXIT;
Read command is parsing multiline input

Read command is parsing multiline input


By : user1555586
Date : March 29 2020, 07:55 AM
help you fix your problem The read command in the below code is parsing only the first line from the input. But it works fine when the IFS is set to comma or any other symbol other than newline. , You can just do this while read loop:
code :
u="*
john
dan"
while IFS= read -r user; do
    echo "drop user $user"
done <<< "$u"
drop user *
drop user john
drop user dan
Makefile multiline command does not work in Docker properly

Makefile multiline command does not work in Docker properly


By : sridhar s
Date : March 29 2020, 07:55 AM
I wish this helpful for you Unfortunately you have been misled by your "obvious" conclusion Obviously, make somehow tries sed earlier than HTML is done :) That's not at all what the problem is. Review your error message more carefully:
code :
sed: can't read : No such file or directory
sed -i '' -e '/href="./s/\.md/\.html/g' /project/docs/changelog.html
   -i[SUFFIX], --in-place[=SUFFIX]

          edit files in place (makes backup if SUFFIX supplied)
sed -i'' -e '/href="./s/\.md/\.html/g' $@
sed --in-place= -e '/href="./s/\.md/\.html/g' $@
Makefile call itself with identical command line input except prepended string

Makefile call itself with identical command line input except prepended string


By : Daniel Baptista
Date : March 29 2020, 07:55 AM
will be helpful for those in need I have a complex, legacy Makefile which I need to run inside of a Docker container. Essentially, I need the Makefile to call itself again, except I need to prepend "docker run ...". , Rename the makefile to something else and use the following as a stub
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org