"$?" 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. |
probably you wanted to write $< instead of $?, but it also depends on the target: line of your makefile
|
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 $< |
see man page of gnu make, maybe this will work:
Code:
(MCB_OBJS) $(ARC_OBJS) $(SYS_OBJS) $(SCRIPT_OBJS) $(ALERTDOBJS): %.o: $(SRCDIR)%.c |
It works fine now. Thanks!
|
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 12:14 AM. |