shell script in makefile


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell script in makefile
# 1  
Old 11-22-2005
shell script in makefile

Hi,
Can we execute a shell script by makefile.
I mean we will write a shell script in a make file and it will be executed when we compile the C++ program using make file.
# 2  
Old 11-22-2005
This is a simple minded example.
suppose you have a script that is in the PATH called wildcard that finds all file with a given substring
Code:
LIST_ALL= $(wildcard *CDU*) 

# to execute the script
$(LIST_ALL)

Be aware that make invokes /bin/sh which on some systems is not a great choice.
# 3  
Old 05-12-2008
Hi Jim,

you might have meant it like here:
CM Crossroads

e. g.
Code:
FILE_COUNT = $(shell ls | wc -l )

The list of other built-in functios is here:
Introduction to making Makefiles
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using a Shell Script in a Makefile

Hello, I have a Makefile that converts wrl (vrml) files to html files... how can I use a shell script in that makefile which works on all html files after converting? The Shell Script have to find and replace a String in every createt html file. sorry I'm a Newbie, so I hope someone can... (0 Replies)
Discussion started by: Dan_78
0 Replies

2. Shell Programming and Scripting

how to run a shell script through Makefile

I want to run a target defined in a shell script. The shell script name is 'ua.sc' and the target in it is 'N' i.e. (ua N) throught a makefile. How can i do it so that i can run it with a make target. (3 Replies)
Discussion started by: vineet.dhingra
3 Replies

3. Shell Programming and Scripting

Call makefile from shell script

I'm writing a VERY simple shell script. I need to call a makefile in a subdirectory. What's the command I need to use? ./dir/make and ./dir/makefile doesn't work. Thanks in advance (1 Reply)
Discussion started by: yamahabob
1 Replies

4. 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

5. Shell Programming and Scripting

Capture makefile errors in shell script

Hi, I have a bash script which calls a few "make". I would like to know whether the makefile failed with any errors. How do I do that in the script? Thanks, S (2 Replies)
Discussion started by: suryaemlinux
2 Replies

6. 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

7. Shell Programming and Scripting

Makefile autogenerated by shell script for a given .c code file

Hi, I have learned native compilation of basic c code example programs from the net. The issue is, .c code file doesn't come with respective Makefile. Visited some web sites with Makefile manuals but still can not master writing Makefile file to work. The idea is to have intelligent shell... (5 Replies)
Discussion started by: darius2
5 Replies

8. Shell Programming and Scripting

turn on shell tracing of a makefile

hey, within a shell script file I know how to turn on tracing using "-x" #!/bin/bash -x now I have a complicated makefile which contains lots of `command`, and i would like to trace these `command`, where shall i put the option "-x"? thanks! (1 Reply)
Discussion started by: patiobarbecue
1 Replies

9. Shell Programming and Scripting

Shell script makefile

Is there a way to write a makefile for all the source files in a directory with a shell script? (2 Replies)
Discussion started by: zzhan
2 Replies

10. Shell Programming and Scripting

embeding shell script in makefile

Hi I am new to shell scripting and makefile. I want a command's output in makefile to process further, can anyone plz suggest me a way ? I want ls -d *.dsm output in a variable and want to process it in makefile itself. It's urgent Thanks In advance (0 Replies)
Discussion started by: madhu12345
0 Replies
Login or Register to Ask a Question