[Solved] Command execution in Makefile


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] Command execution in Makefile
# 1  
Old 03-19-2013
Lightbulb [Solved] Command execution in Makefile

Linux Gurus,

I have a query regarding the execution of a complex command in the makefile of the current system.

I am currently using shell command in the makefile to execute the command. However my command fails as it is a combination of a many commands and execution collects a huge data... something like..

Makefile content

variable=$(shell ls -lart | grep name | cut -d/ -f2- )


However the make file execution fails with execvp failure..

Please suggest me any ways to overcome this issue. ... basically i would like to execute a complex command and assign that output to a makefile variable which i want to use in the program further...

I am novice to makefile programming... so pls forgive any mistages/ignorance....

Thanks Much !
__________________
We reject: kings, presidents and voting.
We believe in: rough consensus and running code
# 2  
Old 03-19-2013
Well, one thing to remember is that makefile variables are recursive.

That is, when you set a variable to the output of a shell command, it doesn't necessarily run that immediately. It may decide to run that shell command every time, to get that output.

Making an include file for the makefile might be one way to do it. Creating a file that says 'var=value' in one step, then including it the next.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 03-20-2013
Thanks for the reply..

Could you please give me a example of "Making an include file for the makefile"...
# 4  
Old 03-20-2013
Code:
# Makefile contents

all:target

includefile:
        ./script-that-makes-include-file > includefile

include includefile

target:includefile sourcefiles
        command to make target from source files

This User Gave Thanks to Corona688 For This Post:
# 5  
Old 03-21-2013
Oh..ok Thank You Corona688..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] Korn Shell execution

There are two Korn Shell scripts : script_1.ksh ( located in /home/dir1 ) script_2.ksh ( located in /home/dir2 ) Content of script_2.ksh is #!/usr/bin/ksh echo "Hello world.." The script_2.ksh is called from within script_1.ksh using the following command : ./home/dir2/script_2.ksh but... (7 Replies)
Discussion started by: kumarjt
7 Replies

2. Shell Programming and Scripting

Multiple command execution inside awk command during xml parsing

below is the output xml string from some other command and i will be parsing it using awk cat /tmp/alerts.xml <Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies

3. Shell Programming and Scripting

Want to terminate command execution when string found in the command output

Hi Experts, I am very much new to linux scripting, I am currently working on reducing my manual work and hence writing a script to automate few task. I am running below command to snmpwalk the router.. snmpwalk -v 3 -u WANDL_SU -a MD5 -A vfipmpls -x DES -X VfIpMpLs -l authPriv... (19 Replies)
Discussion started by: Hanumant.madane
19 Replies

4. UNIX for Dummies Questions & Answers

[Solved] execution problem

Hi I want to make a script . In this script i want to use input file and this input file consist of three numbers in a line for example input file is as below: 919876543210 09876543234567876 98764534245678 aircelmms","aircelweb","aircelwap" 096574235625... (2 Replies)
Discussion started by: esumiba
2 Replies

5. Shell Programming and Scripting

bash command in makefile (cygwin)

Hello, In my make file (make 3.81), I use a combination of shell commands to automatically create the name of my build directory. OS := $(shell uname -s) ARCH := $(shell uname -m) KERN := $(shell uname -r | cut -d. -f 1,2) BDIR := $(OS)_$(KERN).$(ARCH)When I boot into different OSs, I... (7 Replies)
Discussion started by: LMHmedchem
7 Replies

6. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

7. Programming

[Solved] makefile conditions

Hi Everyone, I'm trying to write a makefile that has two options. 1. A make all that shall believe it or not make everything :P and 2. a make without option. I need to setup a few arrays differently, depending on the option choosen i.e. all or without. My first try consisted of me creating... (2 Replies)
Discussion started by: robfwauk
2 Replies

8. UNIX for Dummies Questions & Answers

Trouble with flex command in makefile

Hey all, im trying to create a makefile in unix. cpp2html is a program created from the files cpp2html.o and lex.yy.o. cpp2html.o is created from compiling cpp2html.c and lex.yy.o is created from another created file lex.yy.c. and lex.yy.c is created from a command "flex cppscanner.l" and here is... (1 Reply)
Discussion started by: iwatk003
1 Replies

9. UNIX for Advanced & Expert Users

Makefile problem - How to run module load in a Makefile

Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error: make: module: command not found Why is this? Is there any way to run this command in a Makefile? NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies

10. Programming

my problems with MAKEFILE command

Hi everyone. I'm a newbies in using c++ in UNIX. And since then I only do maintenance coding not development. so far i understand c++ coding and OOP concepts. currently i'm working onsomething for maintenance purpose.here's the situation : below are my files : source files: advDisc.cpp ... (2 Replies)
Discussion started by: aliasunway
2 Replies
Login or Register to Ask a Question