Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 03-23-2012, 08:16 PM   #1
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453
Blog Entries: 3

Rep: Reputation: 40
executing shell commands in makefiles


i've something like this:
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??

Old 03-23-2012, 11:15 PM   #2
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:
CLASSES := $(shell find . -maxdepth 1 -type d -name "cl*" | sed 's@\./@@g' )
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.


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 07:03 PM
GUI for executing shell commands shishirkotkar Linux - Newbie 1 04-12-2008 09:36 AM
executing shell commands in PHP mohtasham1983 Programming 7 09-14-2007 11:04 AM
Executing shell commands through PHP!!! Richtown Linux - Newbie 6 04-12-2006 02:57 PM
executing shell commands in c++ true_atlantis Programming 2 10-01-2004 04:53 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:14 PM.

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