Sponsored Content
Top Forums Programming Two issues in make file, g++, gfortran Post 302505586 by drl on Thursday 17th of March 2011 10:44:07 AM
Old 03-17-2011
Hi.

Question 2:

You are testing HAVEgfortran in the second if sequence which will then (re)set FCOMP. I suggest making the first endif an else, and add another endif, say on a file "m2":
Code:
# Thu Mar 17 09:37:00 CDT 2011

HAVEgfortran := $(shell which gfortran)

ifeq "$(HAVEgfortran)" "/usr/bin/gfortran"
  FCOMP = gfortran
else
  ifeq "$(HAVEgfortran)" "/usr/local/bin/gfortran"
    FCOMP = gfortran
  else
    FCOMP = g77
  endif
endif

.PHONY: all

all:
	@echo " FCOMP is " $(FCOMP)

Then:
Code:
% make -f m2
 FCOMP is  gfortran

This User Gave Thanks to drl For This Post:
 

10 More Discussions You Might Find Interesting

1. Red Hat

AMBER md/g95/gfortran issue

Hi, i am trying to install AMBER10 which is a molecular dynamcis package onto two linux red hat pcs. I can successfully install the tools that comes with which uses gcc to compile, however AMBER10 requires either g95 or gfortran to compile. This is where the issue lies, i have installed both... (0 Replies)
Discussion started by: olifu02
0 Replies

2. Programming

makeutility: how to get the make-file name inside of the make-file?

How I can get the current make-file name in a make-file So, if I run make with specified file:make -f target.mak is it possible to have the 'target' inside of the that 'target.mak' from the file name? (2 Replies)
Discussion started by: alex_5161
2 Replies

3. Programming

Fortran 77 and gfortran

Hi! I have a program in fortran77. This program was compiled with pgf90, but now, I need compiled it with gfortran. I show a bit of code. program hello PARAMETER(a=100) integer a write(*,*)'value ', a end program hello What's the problem? Thanks (2 Replies)
Discussion started by: kekaes
2 Replies

4. Programming

gfortran not connecting to system libraries

Hi ! I have one program made of several sub programs which I am trying to compile with gfortran on Fedora 14 in my system. The program was originally written in Fortran 77 and compilation command used to be - fort77 -O2 -f -w -o life life_com.f lifetime.f minuit.f tek_life.f utilities.f... (0 Replies)
Discussion started by: cylab123
0 Replies

5. Programming

f77 program on gfortran

Hi, I am trying to run a simple f77 program on gfortran. Program is as follows. program trial implicit real*8 (a-h,o-z) common/var/a(2),b,c(4),d a=(/0,0/) b=0 c=(/0,0,0,0/) d=0 call add(a,b,c,d) ... (1 Reply)
Discussion started by: anshulfy
1 Replies

6. Programming

Gfortran compiler options.

I am a INTEL fortran user recently migrated to linux and installed gfortran on my system. I run numerical models as part of my research. my question is on optimization of the fortran code. I used the - vectorize option to compile for reducing the run time considerably and was happy. But... (1 Reply)
Discussion started by: schamarthi1
1 Replies

7. Programming

Compilation problem with gfortran

Hello everyone, I'm trying since a few days to compile a f90 program with gfortran (on Ubuntu) with a makefile. The fortran program calls 2 routines written in C. Here is my makefile: FC = gfortran SFC = gfortran FFLAGS = -ffree-form -O... (21 Replies)
Discussion started by: leroygr
21 Replies

8. Programming

gfortran 4.7, no support for qfloat?

I have code that works fine in ifort. But when trying to run on gfortran 4.7.1 (which does support quads and has no problem with real * 16) I can't cast an integer variable to a quad precision float (real*16) using something like: factq(i) = factq(i-1) * qfloat(i) Finding a list of the new... (2 Replies)
Discussion started by: vibrantcascade
2 Replies

9. Programming

Make and gmake issues

Hello I am working on a CPP code written for SUN CC 5.5 and make we used make to compile the code then it compilation went smooth now i am using gmake: I have a make file like this WSROOT=.. include $(WSROOT)/etc/wsmkinclude.common all: @for subdir in */Makefile; \ do \... (1 Reply)
Discussion started by: Revathi R
1 Replies

10. Solaris

Make and gmake issues

Hello I am working on a CPP code written for SUN CC 5.5 and make we used make to compile the code then it compilation went smooth now i am using gmake: I have a make file like this WSROOT=.. include $(WSROOT)/etc/wsmkinclude.common all: @for subdir in */Makefile; \ do \... (1 Reply)
Discussion started by: Revathi R
1 Replies
CERNLIB(1)						      General Commands Manual							CERNLIB(1)

NAME
cernlib - print CERN library dependencies SYNOPSIS
cernlib [options] libraries DESCRIPTION
cernlib is a tool to list the compiler and linker options necessary to compile a CERNLIB program that has the given library dependencies. It is generally used within a command substitution, as in the following example: gfortran -o myprogram myprogram.F `cernlib -G Motif pawlib` This version of cernlib has been completely rewritten from the original script provided by CERN. It now does recursive library dependency checking and removes duplicate entries. Note that by default, the cernlib script assumes that the CERN libraries are to be linked against statically; if the environment variables $CERN or $CERN_ROOT are specified, it looks for the libraries only in the "lib" subdirectory of those locations, not any "shlib" subdirec- tory. Furthermore, the script brackets the CERN libraries with linker instructions to link statically. This is done to preserve the orig- inal upstream behavior, in which all CERNLIB libraries exist only in static form. For instance, "cernlib packlib" outputs: -Wl,-static -lpacklib -lkernlib -Wl,-dy -lm -lnsl -lcrypt -ldl -lg2c If you want to link against ALL libraries (including CERNLIB) either statically or dynamically, call the cernlib script with its -safe flag to omit these bracketing linker flags. That is: if you want to link against all libraries (not just CERNLIB) statically, use the -static compiler flag and call cernlib with its -safe flag: gfortran -o myprogram myprogram.F -static `cernlib -safe -G Motif pawlib` and if you want to link against all libraries (including the CERN libraries) dynamically, use the same command without the -static compiler flag (the linker assumes dynamic linking by default): gfortran -o myprogram myprogram.F `cernlib -safe -G Motif pawlib` OPTIONS
-a arch Specify a system architecture, e.g. Linux (default), AIX, HP-UX, etc. -dy Equivalent to -safe; for backwards compatibility. -G driver Specify a graphics driver. The available options on Linux are X11 and Motif (the latter option will also work when the Lesstif library is present). -P, -s Ignored; for backwards compatibility. -safe Do not make any assumptions about whether the CERN libraries should be linked against dynamically or statically. (The default behavior, if this flag is not used, is to link them statically.) -u Do not include architecture-specific libraries in the output. -v version Specify version of $CERN_LEVEL. This is meaningless unless you have installed an upstream version of CERNLIB (i.e. not packaged by Debian); see the file /usr/share/doc/cernlib-base/README.Debian. -?, --help Show a summary of options. -- Tell cernlib that this marks the end of cernlib-specific flags, and all following arguments are to be parsed as described in the LIBRARIES section below. If -- is not given, the first word parsed as a library name will be the first word not starting with a hyphen "-" that is not an argument to a preceding cernlib flag. LIBRARIES
The following library names are recognized by this version of the cernlib script. These names may be used exactly as shown here, or pre- fixed by "-l". Core CERN libraries mathlib, packlib, kernlib Graphics and PAW libraries graflib, pawlib Monte Carlo and GEANT libraries cojets, eurodec, geant321, herwig59, isajet758, pdflib804, photos202, phtools Additional Monte Carlo libraries (to obtain these, see /usr/share/doc/montecarlo-base/README.Debian) ariadne, ariadne-p5, fritiof, jetset, lepto, pythia5, pythia6 Aliases The numerals at the end may be left off most of the library names above. Other library names Various other names are recognized for backwards compatibility, internal use, and non-Linux architectures. For the complete list, please see the cernlib script. Other Any names not recognized by cernlib that start with "-l" or with any character other than a hyphen ("-") are output as -l${name#-l} (i.e., are assumed to be a library). Names starting with a hyphen for which the second character is not "l" are assumed to be com- piler flags, and are output at the beginning of the line before all other output. SEE ALSO
/usr/share/doc/cernlib-base/README.Debian describes some of the changes that have been made to the CERN libraries in order to comply with Debian policy and the Filesystem Hierarchy Standard. CERNLIB documentation for all related libraries and programs is available at the following URL: http://cern.ch/cernlib/ AUTHOR
This manual page and the version of the cernlib script that it describes were written by Kevin McCarty <kmccarty@debian.org> for the Debian GNU/Linux system (but may be used by others). They are licensed under the GNU General Public License, version 2 or later (at your choice). COPYRIGHT
Copyright (C) Kevin B. McCarty, 2002, 2003, 2004, 2005, 2006. Jan 6, 2005 CERNLIB(1)
All times are GMT -4. The time now is 10:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy