¿Hay alguna forma de escribir "$ @" en un nuevo archivo desde un Makefile?

I've been trying to create an executable file from a Makefile to run a java program and I need the executable to have the text: java program $@. This is so any arguments will be passed into the program when it runs.

From the Makefile, I've been trying to echo into the new file:

@echo "java Program $@" >> exec

However, $@ results in "all" being written to exec, and $$@ becomes blank when written to exec. Is there another way to escape this sequence in a Makefile? I essentially need it to ignore $@.

Aprecio tu tiempo.

preguntado el 31 de enero de 12 a las 08:01

1 Respuestas

$$ is the correct way to escape the $ for Make, but the result is then being expanded by Bash. Try this:

@echo 'java Program $$@' >> exec

Single quotes in Bash mean that variables don't get expanded.

Respondido el 31 de enero de 12 a las 12:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.