makefile query


 
Thread Tools Search this Thread
Top Forums Programming makefile query
# 1  
Old 10-19-2002
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  
Old 06-30-2005
Power

Quote:
Originally Posted by amatsaka
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

I am not familier with Sun Worstation, i will tell u the situation in unix environment.

u will be having the one main .c Or .cpp file
just use the below command,

gcc -MM abc.cpp>anyname

the above option will re-direct all the dependence list including path into the anyname file.
abc.cpp is the main cpp file, in which so many files are included
# 3  
Old 07-05-2005
Here is one sample makefile for your purpose

# Sample Makefile

SHELL=/bin/sh

.KEEP_STATE:

# Include .cpp in suffixes list
.SUFFIXES:$(.SUFFIXES) .cpp

# Rule for .cpp to .o
.cpp.o:
${COMPILE.cc} -o $@ $<

SOURCE_PATH=${HOME}/source

INCLUDE_PATH=-I.

OBJECTS = ${SOURCE_PATH}/a.o

TARGET=a.out

CPPFLAGS=${INCLUDE_PATH}-mt

all : ${TARGET}

${TARGET}: ${OBJECTS}
$(CCC) -o ${TARGET} ${OBJECTS}

clean:
$(RM) ${TARGET} ${OBJECTS}

In case the source files and Header files are present in other directories, then modify the paths pointed by variables INCLUDE_PATH and SOURCE_PATH respectively..

I hope I am clear with the description.

Note: Kindly see the bolded commands starting with spaces. These are not the spaces but Tab.

Last edited by amit_sapre; 07-05-2005 at 11:04 AM..
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 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... (2 Replies)
Discussion started by: shishirm
2 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. 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
Login or Register to Ask a Question