change makefile environment variables


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers change makefile environment variables
# 1  
Old 01-31-2009
change makefile environment variables

this is my first post so Hello,
here is my question

@top level Makefile should not set values for
environment variables FC, CC, FFLAGS (etc) but
use the ones that mpi_make sets.

So as you can see i have to run an mpi program, in fortran and i am supposed to do the above.the program was created some years ago with different compiler and system and i have to adapt it to my system so for a beggining could someone give me an introductory (very introductory), pdf html or something, file that describes the makefile.so far the only thing i changed was the compiler in the makefile.


# 2  
Old 01-31-2009
Quote:
Originally Posted by Kwstas
@top level Makefile should not set values for
environment variables FC, CC, FFLAGS (etc) but
use the ones that mpi_make sets.
That's not completely true... you CAN set FC, CC and so forth, in the Makefile. You should compile it with mpicc or mpif77 or whatever. It will use what values you provide for these variables.

Normally your makefile will look something like this:
Code:
FC=g77
FFLAGS=-O2
MPIFC=mpif77

mpiprog: mpiprog.o

mpiprog.o: mpiprog.f
   $MPIFC $FFLAGS mpiprog.f -o mpiprog.o

# 3  
Old 02-01-2009
thanks for your reply let me inspect my files again, good info but i need more than this, I will try some things you said and post something later to make it more specific. I have a command -I which i think is something like include and this creates the mess in the error message, maybe i should post the error message.the previous post was just a hint from a friend who guessed in general the situation. I also have many makefiles 3 or 4 ,and one other which is probably the top level makefile.
# 4  
Old 02-02-2009
In Gnu make, the top level makefile directives are passed to sub-makefiles anytime you do an Include or something like this:
Code:
target-lib-dir : 
   cd lib-dir; $(MAKE)

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Environment Variables

Hi All, I need to understand following three environment variables and their usages in HP Unix. _M_ARENA_OPTS _M_CACHE_OPTS PTHREAD_SCOPE_SYSTEM How does these environment variables influence multi threaded applciation and how do we decide the value of these variables? Is there... (0 Replies)
Discussion started by: angshuman
0 Replies

2. HP-UX

Environment Variables

Hi Experts, Need your help in understanding the commands to setup the environment variables in hp-ux. Beleive need to use either set,setenv or export. I am confused between above three options, when to use which option? On command line, I have tried both set and setenv but couldn't... (1 Reply)
Discussion started by: sai_2507
1 Replies

3. Shell Programming and Scripting

Environment variables

I have read tons of posts about how you can't set persisting environment variable in a child script of a shell and have it persist. The only way is to source a file as % . <scriptname> I am finding that true... but I know there is a way around it. I just don't know how. I worked for 6... (5 Replies)
Discussion started by: rwa25
5 Replies

4. Programming

Makefile includes and shell environment during compile

Below is the top of my Makefile. On one machine, I have mysql_config5, and another, I have mysql_config. In my .bashrc file of one UNIX machine, I added an alias so that that mysql_config5 is mysql_config, however, when I do make, it doesn't use that environment and I get compile errors, unless I... (1 Reply)
Discussion started by: pyramation
1 Replies

5. Shell Programming and Scripting

Unable to change environment variables in bash script

Hello! For the moment some settings in my .bashrc contain the password of my company's firewall, which is not a good idea. I would like to use the string "PASSWORD" set in .bashrc and a script that changes all appearances of "PASSWORD" in the environment variables by the actual password (which... (4 Replies)
Discussion started by: markolopa
4 Replies

6. Shell Programming and Scripting

using environment variables

say i define an environment variable in a particular script (upgrade.sh). my script is upgarde.sh and it calls another script try.sh. will this environment variable be accessible to try.sh also. if not how to I make environment variables global so that they can be used by any script. (2 Replies)
Discussion started by: lassimanji
2 Replies

7. Shell Programming and Scripting

Setting environment variables in Makefile

I've seen a few other threads like this, but they either went unanswered or failed to answer my question. How do I set an environment variable in a Makefile? What I'm trying to do is use GNU make to automate an ant build. In order to run ant, I've got to first set a few environment... (1 Reply)
Discussion started by: Bags
1 Replies

8. Programming

environment variables

hi, I want to create a new EV(Environment Variable) through a c program and I done this thing through setenv() method. But the newly created EV is not permanent, i.e. when I exit from the program the EV also no longer lives. But I want to make it a permanent EV for the current user. Actually I... (6 Replies)
Discussion started by: sumsin
6 Replies

9. UNIX for Dummies Questions & Answers

help..Environment variables...

hi, 1). i would like to know what is meant by environment variables? 2). is the number of envi variables is a constant number for unix systems? 3). how to see the list of envi variables (and the values of the envi variables)in a single command? 4). if this questions were already asked... (3 Replies)
Discussion started by: sekar sundaram
3 Replies

10. UNIX for Dummies Questions & Answers

environment variables

Hi Folks, Is it possible somehow to unset all the environment variables which have been defined before in UNIX (Solaris). Thanks, Slava (3 Replies)
Discussion started by: spavlov
3 Replies
Login or Register to Ask a Question