Personal tools

Mohid Makefile

From MohidWiki

Revision as of 23:35, 5 February 2008 by 89.180.71.13 (talk) (References)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Following the makefile cross-platform, cross-compiler project methodology, we finally developped a sound makefile project for MOHID.

MOHID makefile project DAG tree:Orange ellipsoids are makefiles; orange rectangles are makefile code snippets; Diamond arrows are inclusions; Quiver arrows are recursive makes; Large rectangles are project folders; purple octagons are junction nodes. Sketch made using yED

Global environment variables

There is one thing that allow this project to be easily cross-platformed:

  1. The use of global environment variables. They are all defined in the respective platform makefile: win.mk, nix.mk, etc... Every new addition of a module, of a fortran file, or of an action must be followed by an update of all the respective platform makefiles (win.mk, nix.mk, etc...)

Platform/Compiler expandible

The project makefile's DAG meta-tree shows currently 4 platforms/compilers available: windows win.mk, linux nix.mk, linux with Portland Group Fortran nix_pgf.mk and macintosh mac.mk.

  • To add a new compiler and/or a new architecture, one needs to change the main Makefile and create a new arch_Fcomp.mk file.

Action expandible

An action is one given process to apply to the whole project: it could be to build the project, to clean the project, to install the binaries of the project to a safe place, to Get the files of the project from SourceOffSite etc ... The makefile code for the actions of the MOHID project is located in the files contained by the makefiles folder (at the bottom of the image).

  • To add an action, one needs to edit the actions.mk file and create in the makefiles folder a new myaction.mk file.

Module expandible

The MOHID project has a modular nature. In this makefile project, each module is subject to the same overall actions and each module is contained in a light-blue folder in the image (MohidWater, Mohid_Base_1, Mohid_Base_2 and ...).

  • To add a new file to an existing module: one must edit the Files.mk and the Dependencies.mk within the module's folder.
  • To add a new module: one must create a new folder, name it after the module, copy the module's files, create the corresponding Files.mk and Dependencies.mk files. Finally, one must edit the Modules.mk and Dependencies.mk from the root folder.

User's guide

Linux

  • Build
>make nix

Please edit the nix_template.mk first and save it as nix.mk

  • Clean
>make nix.clean
  • Get from SourceOffSite
>make nix.sos

Please edit the ../makefiles/Sos_template.mk file first and save it as ../makefiles/Sos.mk.

  • Install
>make nix.install

This will copy the binaries to a specific location on the harddisk. You can change the location by editing the nix.mk file.

Windows

Use GNUmake! Attention: Rename gmake.exe to make.exe.

  • Build
>make win
  • Clean
>make win.clean
  • Get from SourceOffSite
>make win.sos

Please edit the ../makefiles/Sos.mk file first.

References

  1. The makefile methodology.
  2. The GNU make manual.
  3. The graph editor yED.