LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 03-23-2012, 09:16 PM   #1
entz
Member
 
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453
Blog Entries: 3

Rep: Reputation: 40
executing shell commands in makefiles


hello,

i've something like this:
Code:
test: test.cpp
	g++ test.cpp -o test <shellcode>some command</shellcode>
the question is how can i get the shellcode executed inside the make recipe line??

cheers
 
Old 03-24-2012, 12:15 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
I think the $(shell ... ) construct is what you're looking. As far as I know, it can be placed anywhere a variable can be used, and I'm certain variables can be used in recipes

I use shell code commands as part of my template Makefile. For instance:
Code:
CLASSES := $(shell find . -maxdepth 1 -type d -name "cl*" | sed 's@\./@@g' )
CLASS_OBJS := $(CLASSES:%=%.o)
I manage my classes in separate, self-contained directories with each class name beginning with "cl". So, the net effect of the above two lines is that a program is updated on-the-fly to include/compile any objects I checkout or create in the program's source directory.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Executing commands through shell variable shriyer Linux - Software 2 07-23-2009 08:03 PM
GUI for executing shell commands shishirkotkar Linux - Newbie 1 04-12-2008 10:36 AM
executing shell commands in PHP mohtasham1983 Programming 7 09-14-2007 12:04 PM
Executing shell commands through PHP!!! Richtown Linux - Newbie 6 04-12-2006 03:57 PM
executing shell commands in c++ true_atlantis Programming 2 10-01-2004 05:53 PM

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

All times are GMT -5. The time now is 06:52 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration