Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-25-2012, 02:48 AM
|
#1
|
LQ Newbie
Registered: May 2012
Posts: 15
Rep:
|
"$?" not picking up files
hi,
I am new to shell scripting and need help.
I have the following command in makefile;
$(CC) -DLOGFLAG=1 $(CFLAGS) -o $@ -c $?
when I run the make file, I get the output like
gcc -Wall -DLOGFLAG=1 -I../ -I/appl/oraclient/product/11g/precomp/public -w -I/opt/profile/OraAlert_test/code/pwutils -I/opt/profile/OraAlert_test/code/jslib/src -o oraGen.o -c /opt/profile/OraAlert_test/code/database/src
$@ is substituted by the name of .o file. I expect @? to pick up the name of C file. but it is picking up only the location of the C file and not the exact file. How can this be solved?
Thanks.
|
|
|
05-25-2012, 02:51 AM
|
#2
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,452
|
probably you wanted to write $< instead of $?, but it also depends on the target: line of your makefile
|
|
|
05-25-2012, 02:59 AM
|
#3
|
LQ Newbie
Registered: May 2012
Posts: 15
Original Poster
Rep:
|
Hi pan64,
Even after replacing $? by $< , I get the same error.
This is complete line in the makefile:
$(MCB_OBJS) $(ARC_OBJS) $(SYS_OBJS) $(SCRIPT_OBJS) $(ALERTDOBJS): $(SRCDIR)$(@:.o=.c)
$(CC) -DLOGFLAG=1 $(CFLAGS) -o $@ -c $<
|
|
|
05-25-2012, 03:10 AM
|
#4
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,452
|
see man page of gnu make, maybe this will work:
Code:
(MCB_OBJS) $(ARC_OBJS) $(SYS_OBJS) $(SCRIPT_OBJS) $(ALERTDOBJS): %.o: $(SRCDIR)%.c
<tab>$(CC) -DLOGFLAG=1 $(CFLAGS) -o $@ -c $(SRCDIR)$<
I do not know if $(SRCDIR) - the red text - required, so try
|
|
|
05-25-2012, 03:45 AM
|
#5
|
LQ Newbie
Registered: May 2012
Posts: 15
Original Poster
Rep:
|
It works fine now. Thanks!
|
|
|
05-25-2012, 03:50 AM
|
#6
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,452
|
great!
_____________________________________
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
Happy with solution ... mark as SOLVED
(located in the "thread tools")
|
|
|
All times are GMT -5. The time now is 11:07 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|