How to write backslash character in makefile for pythonanywhere

I need to combine String in a makefile to get this output:

username\$databasename

to automate the build process for a django project.

I realized that the $ sign should be $$ in the makefile, so now this is what I have:

MYVAR = username$$databasename

My problem is the backslash in the string! As I know, \\as usual, the backslash is escaped, it doesn’t work here because it is intended for the Makefile line creation function.

+4
source share
2 answers

You probably want to try it myvar = username\\"$$"databasename.

FROM

rule : 
  @echo $(myvar)

It outputs username\$databasename.

, , : myvar = username\\'$$'databasename.


databasename , , :

myvar = username\\$$"$$databasename"

, myvar = username\\$$"$$USER" username\$guiltydolphin .

+4

Makefile Python .

BACKSLASH Makefile, echo.

BACKSLASH = '\\'

reactance_sim: reactance.py
        echo "{"$(BACKSLASH)tiny           >  reactance_sim
        echo $(BACKSLASH)"begin{verbatim}" >> reactance_sim
        cat reactance.py                   >> reactance_sim
        echo $(BACKSLASH)"end{verbatim}"   >> reactance_sim
        echo "}"                           >> reactance_sim
        cp reactance_sim reactance_simulation.tex
        # vi reactance_simulation.tex

Makefile actance.py , actance_sim, ( , \tiny \begin)

0

Source: https://habr.com/ru/post/1607151/


All Articles