Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Help running a Makefile from within a .sh script? Post 303005282 by cherryTango on Monday 16th of October 2017 02:05:26 PM
Old 10-16-2017
After making the changes you suggested to my program the first error I recieved was:
Code:
Makefile:2: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.

This was because I copy and pasted directly from the forum.. after correcting it and re-running the program I then recieved:
Code:
rm -rf cfile.c cfile.out
gcc -g -Wall -pedantic -Wextra cfile.c -w -o cfile.out
gcc: error: cfile.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
Makefile:4: recipe for target 'build' failed
make: *** [build] Error 1

Originally I thought this meant I was in the wrong directory to call the makefile but clearly not if it can actually interpret the lines from the file. I realised I had been deleting the .c file before compiling it so there was nothing to compile. After changing the clean statement to:
Code:
rm -rf cfile.out

Running the make all command returned:
Code:
rm -rf cfile.out
gcc -g -Wall -pedantic -Wextra cfile.c -w -o cfile.out

With no errors! However there is no cfile.out in the directory or any compiled c file! What else am I missing?

---------- Post updated at 01:05 PM ---------- Previous update was at 01:03 PM ----------

UPDATE: It is in the directory I just couldn't see it. Thank you so much for your help! Problem solved!!!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

makefile sh script

Hello World ! ! ! I need libraries to use grib files. I only know the C language at the moment and I am working at the University under Red Hat 9.0. I downloaded the g2clib library (the best that I found) but I did not success to run the makefile. Here is the original file. I modified some... (4 Replies)
Discussion started by: Akeson Chihiro
4 Replies

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

3. Shell Programming and Scripting

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 Replies)
Discussion started by: surjyap
2 Replies

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

5. UNIX for Dummies Questions & Answers

error while running a makefile

any good website to know about makefiles (3 Replies)
Discussion started by: raviravula
3 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. 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

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

9. Shell Programming and Scripting

Need help with a script to make makefile

How do we create a shell script that creates a makefile? what if we want to use the #include header files too? (2 Replies)
Discussion started by: sslokhan
2 Replies

10. Programming

Problem running a makefile

I have written this makefile and am getting an error saying make nfd gfortran -O -Wall -fbacktrace -fno-align-commons -c -o fd.o fd.f fd.f:49: Error: Can't open included file 'fd.par' make: *** Error 1 The directory structure is as follows . ├── library │ ├── fd │ │ ├──... (3 Replies)
Discussion started by: kristinu
3 Replies
Makefile::AST::Evaluator(3pm)				User Contributed Perl Documentation			     Makefile::AST::Evaluator(3pm)

NAME
Makefile::AST::Evaluator - Evaluator and runtime for Makefile::AST instances SYNOPSIS
use Makefile::AST::Evaluator; $Makefile::AST::Evaluator::JustPrint = 0; $Makefile::AST::Evaluator::Quiet = 1; $Makefile::AST::Evaluator::IgnoreErrors = 1; $Makefile::AST::Evaluator::AlwaysMake = 1; $Makefile::AST::Evaluator::Question = 1; # $ast is a Makefile::AST instance: my $eval = Makefile::AST::Evaluator->new($ast); Makefile::AST::Evaluator->add_trigger( firing_rule => sub { my ($self, $rule, $ast_cmds) = @_; my $target = $rule->target; my $colon = $rule->colon; my @normal_prereqs = @{ $rule->normal_prereqs }; # ... } ); $eval->set_required_target($user_makefile) $eval->make($goal); DESCRIPTION
This module implementes an evaluator or a runtime for makefile ASTs represented by Makefile::AST instances. It "executes" the specified GNU make AST by the GNU makefile semantics. Note that, "execution" not necessarily mean building a project tree by firing makefile rule commands. Actually you can defining your own triggers by calling the add_trigger method. (See the "SYNOPSIS" for examples.) In other words, you can do more interesting things like plotting the call path tree of a Makefile using Graphviz, or translating the original makefile to another form (like what the makesimple script does). It's worth mentioning that, most of the construction algorithm for topological graph s (including implicit rule application) have already been implemented in Makefile::AST and its child node classes. CONFIGURE VARIABLES
This module provides several package variables (i.e. static class variables) for controlling the behavior of the evaluator. Particularly the user needs to set the $AlwaysMake variable to true and $Question to true, if she wants to use the evaluator to do special tasks like plotting dependency graphs and translating GNU makefiles to other format. Setting $AlwaysMake to true will force the evaluator to ignore the timestamps of external files appeared in the makefiles while setting $Question to true will prevent the evaluator from executing the shell commands specified in the makefile rules. Here's the detailed listing for all the config variables: $Question This variable corresponds to the command-line option "-q" or <--question> in GNU make. Its purpose is to make the evaluator enter the "questioning mode", i.e., a mode in which "make" will never try executing rule commands unless it has to, "and" echoing is suppressed at the same time. $AlwaysMake This variable corresponds to the command-line option "-B" or "--always-make". It forces re-constructing all the rule's targets related to the goal, ignoring the timestamp or existence of targets' dependencies. $Quiet It corresponds to GNU make's command-line option "-s", "--silent", or "--quiet". Its effect is to cancel the echoing of shell commands being executed. $JustPrint This variable corresponds to GNU make's command line option "-n", "--just-print", "--dry-run", or "--recon". Its effect is to print out the shell commands requiring execution but without actually executing them. $IgnoreErrors This variable corresponds to GNU make's command line option "-i" or "--ignore-errors"ieXXIt's used to ignore the errors of shell commands being executed during the make process. The default behavior is quitting as soon as a shell command without the "-" modifier fails. CLASS TRIGGERS
The "make_by_rule" method of this class defines a trigger named "firing_rule" via the Class::Trait module. Everytime the "make_by_rule" method reaches the trigger point, it will invoke the user's processing handler with the following three arguments: the self object, the Makefile::AST::Rule object, and the corresponding "Makefile::AST::Command" object in the context. By registering his own processing handlers for the "firing_rule" trigger, the user's code can reuse the evaluator to do his own cool things without traversing the makefile ASTs himself. See the "SYNOPSIS" for code examples. CODE REPOSITORY
For the very latest version of this script, check out the source from http://github.com/agentzh/makefile-parser-pm <http://github.com/agentzh/makefile-parser-pm>. There is anonymous access to all. AUTHOR
Zhang "agentzh" Yichun "<agentzh@gmail.com>" COPYRIGHT AND LICENSE
Copyright (c) 2007-2008 by Zhang "agentzh" Yichun (agentzh). This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Makefile::AST, Makefile::Parser::GmakeDB, pgmake-db, makesimple, Makefile::DOM. perl v5.12.4 2011-08-17 Makefile::AST::Evaluator(3pm)
All times are GMT -4. The time now is 03:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy