[MITgcm-devel] genmake2 and makedepend
Jean-Michel Campin
jmc at ocean.mit.edu
Fri Dec 21 09:54:57 EST 2012
Hi Martin and Oliver,
Can we postpone this modification until we have 2 days in a row of
good testreport results ? might want to make a tag (checkpoint64b)
before changing xmakedpend & genmake2.
Cheers,
Jean-Michel
On Fri, Dec 21, 2012 at 09:36:21AM +0100, Martin Losch wrote:
> Hi Oliver,
>
> this looks great. I tested this line on my exotic computers, see the results below. It gives something reasonable for all machines (even f******* SunOS). I say let's go for it.
>
> Martin
>
> csysm15::~> uname -a
> Darwin csysm15.dmawi.de 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
> csysm15::~> cat /dev/null | cpp -v 2>&1 | awk '/^End of search/{f=0}!/^#/{if(f){print "-I"$1}}/^#include "..." search start/{f=1}'
> -I/usr/local/include
> -I/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include
> -I/usr/include
> -I/System/Library/Frameworks
> -I/Library/Frameworks
>
> solasrv4:~> uname -a
> SunOS solasrv4 5.10 Generic_144501-19 i86pc i386 i86pc
> solasrv4:~> cat /dev/null | cpp -v 2>&1 | awk '/^End of search/{f=0}!/^#/{if(f){print "-I"$1}}/^#include "..." search start/{f=1}'
> -I/opt/csw/lib/gcc/i386-pc-solaris2.10/4.7.1/include
> -I/opt/csw/include
> -I/opt/csw/lib/gcc/i386-pc-solaris2.10/4.7.1/include-fixed
> -I/usr/include
>
> iblade1::mlosch> uname -a
> AIX iblade1 3 5 0007465AD400 powerpc unknown AIX
> iblade1::mlosch> cat /dev/null | cpp -v 2>&1 | awk '/^End of search/{f=0}!/^#/{if(f){print "-I"$1}}/^#include "..." search start/{f=1}'
> -I/opt/freeware/include
> -I/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.0/include
> -I/usr/include
>
> sx8:~> uname -a
> Linux sx8 2.6.16.60-0.39.3.PTF.518120.1-default #1 SMP Mon May 11 11:46:34 UTC 2009 ia64 ia64 ia64 GNU/Linux
> sx8:~> cat /dev/null | cpp -v 2>&1 | awk '/^End of search/{f=0}!/^#/{if(f){print "-I"$1}}/^#include "..." search start/{f=1}'
> -I/usr/local/include
> -I/usr/lib/gcc/ia64-suse-linux/4.1.2/include
> -I/usr/lib/gcc/ia64-suse-linux/4.1.2/../../../../ia64-suse-linux/include
> -I/usr/include
>
> uv100:~> uname -a
> Linux uv100 3.0.13-0.27-default #1 SMP Wed Feb 15 13:33:49 UTC 2012 (d73692b) x86_64 x86_64 x86_64 GNU/Linux
> uv100:~> cat /dev/null | cpp -v 2>&1 | awk '/^End of search/{f=0}!/^#/{if(f){print "-I"$1}}/^#include "..." search start/{f=1}'
> -I/opt/sgi/mpt/mpt-2.06/include
> -I/uv/soft/intel/composer_xe_2013.1.117/composer_xe_2013.1.117/tbb/include
> -I/uv/soft/intel/composer_xe_2013.1.117/composer_xe_2013.1.117/mkl/include
> -I/usr/local/include
> -I/usr/lib64/gcc/x86_64-suse-linux/4.3/include
> -I/usr/lib64/gcc/x86_64-suse-linux/4.3/include-fixed
> -I/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/include
> -I/usr/include
>
> On Dec 20, 2012, at 10:23 PM, Oliver Jahn <jahn at MIT.EDU> wrote:
>
> > My 2 cents for a one liner to extract the cpp search path:
> >
> > cat /dev/null | cpp -v 2>&1 | awk '/^End of search/{f=0}!/^#/{if(f){print "-I"$1}}/^#include "..." search start/{f=1}'
> >
> > The attached modif to genmake2 does this (in the makefile) and adds it to the makedepend command line. I've tested it on the analogous problem we've been having with mpi on acesgrid. This is with cyrus-makedepend (but shouldn't depend on this as it only adds -I options) and gnu cpp. If it doesn't find appropriate output, it will not add anything. Seems the only way it could fail badly is if cpp doesn't have a -v option. Want to give it a try?
> >
> > Oliver
> >
> > On 2012-12-18 18:00, Jean-Michel Campin wrote:
> >> Hi Martin,
> >>
> >> I agreee that it would be good to fix this (and check that it works with
> >> our xmakedepend, with the cyrus-makedepend and with some default makedepend),
> >> but would be nicer to put the true path that cpp uses, rather than a list of
> >> potential location for the include (on my laptop, /usr/local/include
> >> is empty but /usr/include is not).
> >> I guess the next question is, "is there a simple way to find
> >> 'the standard system include directories' ?"
> >> I can see that "cpp -v" (among many things) give a list include dirs,
> >> but don't know how standard it is (and how easy it is to extract this
> >> list).
> >>
> >> Cheers,
> >> Jean-Michel
> >>
> >> On Tue, Dec 18, 2012 at 04:36:43PM +0100, Martin Losch wrote:
> >>> Hi Jean-Michel,
> >>>
> >>> you are right, the compilation still works, it just means that the corresponding files, e.g. mmc_file.f do not depend on netcdf.inc anymore, which one can probably live with.
> >>>
> >>> I guess one can fix this by enlarging the default search for make depend, e.g. always add -I/usr/local/include (or the typical search paths of cpp) to the arguments of $(MAKEDEPEND). It's not very nice because the list is likely to expand, but should be safe, because the actual paths have been checked with the test in genmake2. What do you think?
> >>>
> >>> Martin
> >>>
> >>> On Dec 18, 2012, at 2:56 PM, Jean-Michel Campin <jmc at ocean.mit.edu> wrote:
> >>>
> >>>> Hi Martin,
> >>>>
> >>>> It happens manay times to me that "make depend" return some warning/error,
> >>>> but this does not prevent me to compile (with a successful "make").
> >>>> Are you in this situation ?
> >>>>
> >>>> Otherwise, I find your suggestion little bit tricky, since it might
> >>>> prevent to use NetCDF in cases where it is available.
> >>>> My impression is that we should try to fix the makedepend step.
> >>>>
> >>>> Cheers,
> >>>> Jean-Michel
> >>>>
> >>>> On Tue, Dec 18, 2012 at 02:04:54PM +0100, Martin Losch wrote:
> >>>>> Hi there,
> >>>>> my version of Murphy's law: Whenever you want to show how great everything is, it turns against you and does not work.
> >>>>>
> >>>>> I was trying to show to my group in a presentation, how makefiles are generated by genmake2 and how you compile the model etc, when "make depend" returned errors that it cannot find "netcdf.inc". This happened after the genmake_tnc.F test passed. I used darwin_amd64_gfortran with OS X 10.8 (mountain lion).
> >>>>>
> >>>>> The problem is that (on my PowerBook), /usr/bin/cpp finds files in /usr/local/include by default, and gfortran finds libraries in /usr/local/lib by default (that's where my netcdf installation is), so that the test passes without problems (-DHAVE_NETCDF), and more importantly without INCLUDES or INCLUDEPATH being set (I have NETCDF_ROOT unset by default). However, when make depend tries to build the dependencies, the include files are no longer found because apparently, my makedepend (/opt/X11/bin/makedepend) does not search /usr/local/include by default.
> >>>>>
> >>>>> I can easily fix this by specifying a proper NETCDF_ROOT (=/usr/local), but it shows that the netcdf test is not fool-proof. Do you have a suggestion how we can improve the test? E.g. tell cpp not to search anywhere that is not explicitly specified in the INCLUDEPATH?
> >>>>>
> >>>>> Martin
> >>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> MITgcm-devel mailing list
> >>>>> MITgcm-devel at mitgcm.org
> >>>>> http://mitgcm.org/mailman/listinfo/mitgcm-devel
> >>>>
> >>>> _______________________________________________
> >>>> MITgcm-devel mailing list
> >>>> MITgcm-devel at mitgcm.org
> >>>> http://mitgcm.org/mailman/listinfo/mitgcm-devel
> >>>
> >>>
> >>> _______________________________________________
> >>> MITgcm-devel mailing list
> >>> MITgcm-devel at mitgcm.org
> >>> http://mitgcm.org/mailman/listinfo/mitgcm-devel
> >>
> >> _______________________________________________
> >> MITgcm-devel mailing list
> >> MITgcm-devel at mitgcm.org
> >> http://mitgcm.org/mailman/listinfo/mitgcm-devel
> >>
> >
> > <genmake2.patch>_______________________________________________
> > MITgcm-devel mailing list
> > MITgcm-devel at mitgcm.org
> > http://mitgcm.org/mailman/listinfo/mitgcm-devel
>
>
> _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-devel
More information about the MITgcm-devel
mailing list