LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-05-2011, 06:47 PM   #1
Ajay Kumar
LQ Newbie
 
Registered: Jul 2008
Posts: 8

Rep: Reputation: 0
Makefile output


I haven't been able to undertand Makefile 'error', 'warning' and 'info' commands used for displaying output. I have got them working in some cases though. Here is the current problem I am stuck with.
Code:
$(LCD_LIB) : $(RAMTEX_OBJS)
	$(CSTOOL_PREFIX)ar cr $(RAMTEX_BIN_DIR)/$(LCD_LIB) $^ 
	$(info copying the library to $(abspath $(COMMON_LIB_DIR))) 
	sudo cp --preserve $(RAMTEX_BIN_DIR)/$(LCD_LIB) $(COMMON_LIB_DIR)/
I don't know why doesn't it print the output the way I expect. Here I want to display the string "copying the ..." after bulding the static library. However, it prints the display string first and then builds library as shown below.

copying the library to /home/asabat/manhattan/simple_ui_project/lib
arm-none-linux-gnueabi-ar cr ./bin/libramtex.a obj/gcarc.o obj/gchlnsp.o ...
sudo cp --preserve ./bin/libramtex.a ../lib/

If I modify the Makefile to use echo instead of info, that works fine as given below.
Code:
$(LCD_LIB) : $(RAMTEX_OBJS)
	$(CSTOOL_PREFIX)ar cr $(RAMTEX_BIN_DIR)/$(LCD_LIB) $^ 
	@echo -e "copying the library to $(abspath $(COMMON_LIB_DIR))"  
	sudo cp --preserve $(RAMTEX_BIN_DIR)/$(LCD_LIB) $(COMMON_LIB_DIR)/
arm-none-linux-gnueabi-ar cr ./bin/libramtex.a obj/gcarc.o obj/gchlnsp.o ...
copying the library to /home/asabat/manhattan/simple_ui_project/lib
sudo cp --preserve ./bin/libramtex.a ../lib/

I have seen these issues even while using the other commands 'warning' and 'error'. I will appreciate any help in understanding my mistake here.
 
Old 12-07-2011, 01:04 PM   #2
Ajay Kumar
LQ Newbie
 
Registered: Jul 2008
Posts: 8

Original Poster
Rep: Reputation: 0
I think it is not a good idea to use the $(info ) function inside a recipe.
If it is used inside a recipe, then make would execute that first before even submitting the first rule to shell for execution.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to output line Makefile is executing? homer_3 Programming 2 08-03-2009 05:34 PM
Is it mandatory to have the name of the makefile as 'Makefile' for kernal module comp narender.d Linux - Kernel 3 05-29-2009 06:26 AM
How to redirect output object files using a linux kernel Makefile? archieval Linux - Newbie 0 06-28-2007 12:14 AM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 03:57 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration