Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Help running a Makefile from within a .sh script? Post 303005284 by Scott on Monday 16th of October 2017 02:11:05 PM
Old 10-16-2017
What if you run the gcc command directly (from the directory where the .c file is)?
Code:
gcc -g -Wall -pedantic -Wextra cfile.c -w -o cfile.out

Show your makefile:
Code:
cat Makefile

(and just to not make the same mistake I did, make sure there are no other makefiles there!)

UPDATE: OK, cool. You're welcome Smilie
 

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::Parser::GmakeDB(3pm)				User Contributed Perl Documentation			    Makefile::Parser::GmakeDB(3pm)

NAME
Makefile::Parser::GmakeDB - GNU makefile parser using GNU make's database dump VERSION
This document describes Makefile::Parser::GmakeDB 0.215 released on 18 August 2011. SYNOPSIS
use Makefile::Parser::GmakeDB; my $db_listing = `make --print-data-base -pqRrs -f Makefile`; my $ast = Makefile::Parser::GmakeDB->parse($db_listing); DESCRIPTION
This module serves as a parser for GNU makefiles. However, it does not parse user's original makefile directly. Instead it uses Makefile::DOM to parse the "data base output listing" produced by GNU make (via its "--print-data-base" option). So essentially it reuses the C implementation of GNU make. This parser has been tested as a component of the pgmake-db utility and has successfully passed 51% of GNU make 3.81's official test suite. The result of the parser is a makefile AST defined by Makefile::AST. The "data base output listing" generated by "make --print-data-base" is a detailed listing for GNU make's internal data structures, which is essentially the AST used by "make". According to GNU make's current maintainer, Paul Smith, this feature is provided primarily for debugging the user's own makefiles, and it also helps the GNU make developer team to diagnose the flaws in make itself. Incidentally this output is conformed to the GNU makefile syntax, and a lot of important information is provided in the form of makefile comments. Therefore, my GmakeDB parser is able to reuse the Makefile::DOM module to parse this output listing. The data base output from GNU make can be divided into several clearly-separated segments. They're file header, "Variables", "Files", "VPATH Search Paths", as well as the last resource stats information. The contents of these segments are mostly obvious. The Files segment may deserve some explanation. It is the place for explicit rules. Now let's take the Variables segment as an example to demonstrate the format of the data base listing: # Variables # automatic <D = $(patsubst %/,%,$(dir $<)) # automatic ?F = $(notdir $?) # environment DESKTOP_SESSION = default # automatic ?D = $(patsubst %/,%,$(dir $?)) # environment GTK_RC_FILES = /etc/gtk/gtkrc:/home/agentz/.gtkrc-1.2-gnome2 # environment ... It's shown that the flavor and origin of the makefile variables are given in the previous line as comments. Hence feeding this back into GNU make again makes little sense. Similarly, the Files segment for explicit rules also puts big amount of the important information into makefile comments: # Files # Not a target: bar.c: # Implicit rule search has not been done. # Modification time never checked. # File has not been updated. all: foo.o bar.o # Implicit rule search has been done. # File does not exist. # File has not been updated. # variable set hash-table stats: # Load=0/32=0%, Rehash=0, Collisions=0/0=0% foo.o: foo.c # Implicit rule search has not been done. # Implicit/static pattern stem: `foo' # File does not exist. # File has not been updated. # variable set hash-table stats: # Load=0/32=0%, Rehash=0, Collisions=0/0=0% # commands to execute (from `ex2.mk', line 8): $(CC) -c $(CFLAGS) $< -o $@ ... From the previous two data base listing snippets, it's not hard to see that the variable references in rule commands and recursively- expanded variables's values are not expanded. Experiments have shown that GNU make will do implicit rule search for the first rule that needs to, but no more. This behavior means testing our own implicit rule searching algorithm requires specifying at least two goals that require matching. DEPENDENCIES
GNU make 3.81 At least the make executable of GNU make 3.81 is required to work with this module. Makefile::DOM BUGS
o GNU make does not escape meta characters appeared in rule targets and prerequisites in its data base listing. Examples are ":", "", and "#". This bug has been reported to the GNU make team as "Savannah bug #20067". This bug has not yet been fixed on the "make" side, so I have to work around this issue by preprocessing the data base listing in the makesimple script. o The data base listing produced by GNU make lacks the information regarding the "export" and "unexport" directives. It gives rise to the lack of information in the resulting AST structures constructed by this module. Hence the current AST and runtime do not implement the "export" and "unexport" directives. To make it even worse, there's no known way to work around it. I've already reported this issue to the GNU make team as Savannah bug #20069. 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) 2005-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::AST::Evaluator, Makefile::DOM, makesimple, pgmake-db. perl v5.12.4 2011-10-01 Makefile::Parser::GmakeDB(3pm)
All times are GMT -4. The time now is 08:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy