how to print $ with makefile..


 
Thread Tools Search this Thread
Top Forums Programming how to print $ with makefile..
# 1  
Old 07-14-2008
Computer how to print $ with makefile..

Hello~

If $ is inside makfile, it is considered as internal definition of makefile.
Is there any way around this?
I mean I want to print $ using makefile.
Any tip will be great help !
# 2  
Old 07-14-2008
Tools printing "$"

Not sure if I understand what you are trying to do without seeing sample program code, but putting a character inside double-quotes normally protects it from being interpreted. For instance
Code:
echo "$"
$

command.

What exactly are you trying to do?
# 3  
Old 07-14-2008
joeyg//

Inside the makefile,
Code:
test:
        awk '/MUCOEFF/{$1=0.1}1' file > file

I want to change values of MUCOEFF in file with above makefile.

0.0 MUCOEFF -> 0.1 MUCOEFF

If I type "awk '/MUCOEFF/{$1=0.1}1' file > file" in command line, it works.
But if I type "make test" which calls the above code, it gives following error message :

awk '/MUCOEFF/{=0.1}1' file > file
awk: /MUCOEFF/{=0.1}1
awk: ^ syntax error
make: *** [test] Error 1

As you see from the first line in error message, $1 is not recognized and gives syntax error.
Main reason is that $ is recognized as internal definition of makefile.

I tried "$"1 and "$1", but it does not work also.
It is recognized as "awk '/MUCOEFF/{"1=0.1}1' file > file" or "awk '/MUCOEFF/{"=0.1}1' file > file".
Any other ways?

Last edited by lorenzz; 07-14-2008 at 09:53 PM..
# 4  
Old 07-15-2008
Code:
echo "$"

won't work in a makefile because make interprets anything beginning with $ as a variable and wants to expand it, but
Code:
echo "$$"

will print a literal $, so try
Code:
test:
        awk '/MUCOEFF/{$$1=0.1}1' file > file

# 5  
Old 07-15-2008
spirtle//
Thank you so much, $$ works !!!
You have shed light on me finally.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Makefile Help

Hello, I have to write makefile which supports specific targets and I have to do the following things: - A variable T determines whether the function is executed 1 or 2 - A variable N determines which size will be executed e.g. it must be read from the command line "make 1500" where 1... (0 Replies)
Discussion started by: StudUni
0 Replies

2. UNIX for Dummies Questions & Answers

is this a Makefile?

file1.h : file2.h file3.h file1.exe : file4.c file5.c gcc -o file1.exe file4.c file5.c file4.c file5.c : file1.h I was looking up how to make a Makefile and i came across this can someone just explain what it is or does? Thanks. (2 Replies)
Discussion started by: syco__
2 Replies

3. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

4. UNIX for Advanced & Expert Users

Makefile executing another Makefile first?

I have 2 libraries in 2 different directories that I build with Makefiles. library B depends on library A. If I modify a .cpp file in library A and run lib B's Makefile can I have B's makefile to automatically rebuild library A? I am now rebuilding A, followed by B... but I'd like B to... (0 Replies)
Discussion started by: wwuster
0 Replies

5. Programming

Makefile help

I've copied a C++ project from my old computer to this one, and I am now trying to (without success) compile the project in the same way as I did before. I use Emacs as a text editor and compile with g++. Here is what my makefile looks like: CC=g++ CPPFLAGS=-Wall CPPFLAGS+=-I..... (4 Replies)
Discussion started by: TriKri
4 Replies

6. Shell Programming and Scripting

Regarding Makefile

Hi friends, I have a problem with compiling makefile.While i am compiling makefile it always compiles 1 or 2 files inside that makefile even if nothing is changed in those files.If none of the changes are made in those file while compiling the makefile it should output like "file is upto date",... (0 Replies)
Discussion started by: s.sen1213
0 Replies

7. UNIX for Advanced & Expert Users

Makefile problem - How to run module load in a Makefile

Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error: make: module: command not found Why is this? Is there any way to run this command in a Makefile? NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies

8. High Performance Computing

help with makefile

I am new to creating makefiles. I have several fortran programs in a folder called as "test" and also have several subroutines in another folder (which is inside this test folder) called as libry My makefile is in the folder "test" I want to create a makefile which can access the files in... (2 Replies)
Discussion started by: explorer
2 Replies

9. Programming

Makefile help

Hi, What I want to do is for make to reconstruct the target even if its dependencies have not changed. So, even if if the dependent files do not have a more recent timestamp, the commands are executed. The reason I want to do this.. 1)someone executes make on solaris. We have a solaris... (4 Replies)
Discussion started by: tantric
4 Replies

10. Programming

about the makefile

can anyone well explain how to create a makefile? especially those commands in the makefile? BTW, what is CFLAG? (2 Replies)
Discussion started by: ligerdave
2 Replies
Login or Register to Ask a Question