makefile query


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users makefile query
# 1  
Old 06-04-2009
makefile query

Hi,

I have a few questions about makefiles. I have defined my own version of a dependency file (.d) by creating it in code and called it say .dd. Now this file I have included in the makefile with the include statement. (There are a whole bunch of these files so I've defined this as a rule which uses subst to replace the extension as required.)

Now suppose that file X depends on file Y i.e. X.dd contains a reference to file Y. Now from my understanding, whenever I run make and the program goes through the include and finds that Y has been updated, it somehow recompiles this so as to reflect the changes in X.

My question and problem is when this timestamp change in Y is noticed, does make restart itself so as to include the changes. How exactly are dependency files of this sort resolved. Also file X is not a typical .c or .cc file. So how would the file be treated when its dependency changes.

The problem I'm facing is that if file Y is changed/touched, file X does not recompile. Also if I touch file X, it recompiles just fine. Also as expected, if the makefile is touched, everything recompiles appopriately.

This bug has me scratching my head for a few days now so any help whatsoever would be appreciated.

Please let me know if you need any additional information.

Regards
--
Shishir

-----Post Update-----

Further explaining the situation with an example,

Ok so assume that there is this file X.boy where .boy is some internal format. Now this file depends on another file Y.boy which has been included inside X.boy. Now I have hand-coded my own dependency file say X.d which contains these dependencies and I have included this X.d in the makefile using the include statement. Now if I make changes to Y.boy, I would expect the X.d file to detect this change and automatically recompile X.boy. This however does not happen and apparently X.boy fails to pick up this change and recompile.

Cheers
--
Shishir
# 2  
Old 06-04-2009
Quote:
Also as expected, if the makefile is touched, everything recompiles appopriately.
I assume that by "touched" you mean "changed'. Is this correct?
# 3  
Old 06-05-2009
Thanks for your reply.

Yes. In production it would mean the file was modified but for testing I run a touch command on it on console so the timestamp changes and the file appears modified.

Basically, when a dependency is found to have been modified, does make stop, enter the file to be re-compiled into some internal database and then restart from that point onwards?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Makefile

Dear all, I have a quite simple question about how to manipulate "makefile.am". I intend to: 1. "CFLAGS" and "CXXFLAGS" have no value at all. I know that these values get "-g -O2" by default. On the other hand, when I try to set them as "CFLAGS = " in "makefile.am", I get warning messages... (4 Replies)
Discussion started by: Dandan
4 Replies

2. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

3. Homework & Coursework Questions

Makefile Help

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: I have been trying to make the program swap but i have been getting errors with the makefile such as driver.o:... (1 Reply)
Discussion started by: mgyeah
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. UNIX for Advanced & Expert Users

Makefile executing another Makefile first?

I have 2 libraries in 2 different directories that I build with Makefiles. library B depends on library A. If I modify a .cpp file in library A and run lib B's Makefile can I have B's makefile to automatically rebuild library A? I am now rebuilding A, followed by B... but I'd like B to... (0 Replies)
Discussion started by: wwuster
0 Replies

6. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

7. Programming

makefile help

Hi all, I'm new to make files . I'm writing a make file to compile and create .so files. i've 20 .cpp files. I want to compile one file at a time and then i've to create 1 .so for each file that i compiled. for eg: list.mk is having all the 20 .spp files. name = a.cpp name =+... (2 Replies)
Discussion started by: vij_krr
2 Replies

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

9. Shell Programming and Scripting

add the output of a query to a variable to be used in another query

I would like to use the result of a query in another query. How do I redirect/add the output to another variable? $result = odbc_exec($connect, $query); while ($row = odbc_fetch_array($result)) { echo $row,"\n"; } odbc_close($connect); ?> This will output hostnames: host1... (0 Replies)
Discussion started by: hazno
0 Replies

10. Programming

makefile query

I need to create a makefile to compile a large program in Sun Workstation. Can you please let me know how to specify the path of a .c or .h if are located in a different path from the makefile? I whould appriciate if you could post a section of this makefile Thanx (2 Replies)
Discussion started by: amatsaka
2 Replies
Login or Register to Ask a Question