Skip to content
Stefano Zaghi edited this page Jan 8, 2015 · 9 revisions

FLAP has been developed on GNU/Linux architecture. Other OS are not supported (and in general there is no best alternative to GNU/Linux :-).

The code provided have been successfully compiled with the following compilers:

  • Intel Fortran Compiler ifort (version 12.0+)

Other compilers are not supported.

FLAP relies on 4 modules:

The most easy way to compile FLAP is to use FoBiS.py within the provided fobos file.

Consequently, it is strongly encouraged to install FoBiS.py.

Compiling by means of FoBiS.py

FoBiS.py is a KISS tool for automatic building of modern Fortran projects. Providing very few options, FoBiS.py is able to build almost automatically complex Fortran projects with cumbersome inter-modules dependency. This removes the necessity to write complex makefile. Moreover, providing a very simple options file (in the FoBiS.py nomenclature indicated as fobos file) FoBiS.py can substitute the (ab)use of makefile for other project stuffs (build documentations, make project archive, etc...). FLAP is shipped with a fobos file that can build the library in both static and shared forms and also build the FLAP_Test program. The provided fobos file has several building modes.

Listing fobos building modes

Typing:

FoBiS.py build -lmodes

the following message should be printed:

The fobos file defines the following modes:
  - "shared"
  - "static"
  - "flap-test"
  - "shared-debug"
  - "static-debug"
  - "flap-test-debug"

The modes should be self-explicative: shared, static and flap-test are the modes for building (in realese, optimized form) the shared and static versions of the library and the Test Driver program, respectively. The other 3 modes are the same, but in debug form instead of release one.

Building the library

The shared or static directories are created accordingly to the form of the library built. The compiled objects and mod files are placed inside this directory, as well as the linked library.

Release shared library
FoBiS.py build -mode shared
Release static library
FoBiS.py build -mode static
Debug shared library
FoBiS.py build -mode shared-debug
Debug static library
FoBiS.py build -mode static-debug

Building the Test Driver program

The flap_test directory is created. The compiled objects and mod files are placed inside this directory, as well as the linked program.

Release test driver program
FoBiS.py build -mode flap-test
Debug test driver program
FoBiS.py build -mode flap-test-debug

Listing fobos rules

Typing:

FoBiS.py rule -ls

the following message should be printed:

The fobos file defines the following rules:
  - "makedoc" Rule for building documentation from source files
       Command => rm -rf doc/html/*
       Command => ford.py doc/main_page.md
       Command => cp -r doc/html/publish/* doc/html/

The rules should be self-explicative.

Compiling without FoBiS.py

Bad choice :-)

However, the following is the Hierarchical dependencies list for building the library and the test diver program:

  • src/IR_Precision.f90
  • src/Data_Type_Command_Line_Interface.f90
    • src/IR_Precision.f90
    • src/Lib_IO_Misc.f90
    • src/Lib_Strings.f90
  • src/Lib_IO_Misc.f90
    • src/IR_Precision.f90

The complete ordered dependencies list is:

  1. src/IR_Precision.f90
  2. src/Lib_IO_Misc.f90
  3. src/Lib_Strings.f90
  4. src/Data_Type_Command_Line_Interface.f90
  5. src/flap_test.f90

A possible makefile (generate by FoBiS.py...) to be used with a compatible GNU Make tool is:

#!/usr/bin/make

#main building variables
DSRC    = src/
DOBJ    = flap_test/obj/
DMOD    = flap_test/mod/
VPATH   = $(DSRC) $(DOBJ) $(DMOD)
DEXE    = flap_test/
MKDIRS  = $(DOBJ) $(DMOD) $(DEXE)
LIBS    =
FC      = ifort
OPTSC   = -cpp -c -assume realloc_lhs -O3 -module flap_test/mod/
OPTSL   = -O3 -module flap_test/mod/
PREPROC =
LCEXES  = $(shell echo $(EXES) | tr '[:upper:]' '[:lower:]')
EXESPO  = $(addsuffix .o,$(LCEXES))
EXESOBJ = $(addprefix $(DOBJ),$(EXESPO))

#auxiliary variables
COTEXT  = "Compiling $(<F)"
LITEXT  = "Assembling $@"

#building rules
$(DEXE)FLAP_TEST: $(MKDIRS) $(DOBJ)flap_test.o
        @rm -f $(filter-out $(DOBJ)flap_test.o,$(EXESOBJ))
        @echo $(LITEXT)
        @$(FC) $(OPTSL) $(PREPROC) $(DOBJ)*.o $(LIBS) -o $@
EXES := $(EXES) FLAP_TEST

$(DOBJ)ir_precision.o: src/IR_Precision.f90
        @echo $(COTEXT)
        @$(FC) $(OPTSC) $(PREPROC)  $< -o $@

$(DOBJ)flap_test.o: src/flap_test.f90 \
        $(DOBJ)ir_precision.o \
        $(DOBJ)data_type_command_line_interface.o \
        $(DOBJ)lib_io_misc.o
        @echo $(COTEXT)
        @$(FC) $(OPTSC) $(PREPROC)  $< -o $@

$(DOBJ)lib_strings.o: src/Lib_Strings.f90 \
        $(DOBJ)ir_precision.o
        @echo $(COTEXT)
        @$(FC) $(OPTSC) $(PREPROC)  $< -o $@

$(DOBJ)data_type_command_line_interface.o: src/Data_Type_Command_Line_Interface.f90 \
        $(DOBJ)ir_precision.o \
        $(DOBJ)lib_io_misc.o \
        $(DOBJ)lib_strings.o
        @echo $(COTEXT)
        @$(FC) $(OPTSC) $(PREPROC)  $< -o $@

$(DOBJ)lib_io_misc.o: src/Lib_IO_Misc.f90 \
        $(DOBJ)ir_precision.o
        @echo $(COTEXT)
        @$(FC) $(OPTSC) $(PREPROC)  $< -o $@

#phony rules
.PHONY : $(MKDIRS)
$(MKDIRS):
        @mkdir -p $@
.PHONY : cleanobj
cleanobj:
        @echo deleting objects
        @rm -fr $(DOBJ)
.PHONY : cleanmod
cleanmod:
        @echo deleting mods
        @rm -fr $(DMOD)
.PHONY : cleanexe
cleanexe:
        @echo deleting exes
        @rm -f $(addprefix $(DEXE),$(EXES))
.PHONY : clean
clean: cleanobj cleanmod
.PHONY : cleanall
cleanall: clean cleanexe
Clone this wiki locally