-
Notifications
You must be signed in to change notification settings - Fork 68
Update of the minibook on building programs: #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
LKedward
merged 16 commits into
fortran-lang:master
from
arjenmarkus:building_programs_revised
Jun 17, 2020
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
06adb98
Update of the minibook on building programs:
arjenmarkusdeltaresnl fabcba4
Update learn/building_programs/build_tools.md
arjenmarkus 630d472
Update learn/building_programs/build_tools.md
arjenmarkus f0953a2
Update learn/building_programs/build_tools.md
arjenmarkus 6ce58ec
Update learn/building_programs/distributing.md
arjenmarkus 052360b
Update learn/building_programs/linking_pieces.md
arjenmarkus b15e409
Update learn/building_programs/managing_libraries.md
arjenmarkus cf91e95
Update learn/building_programs/managing_libraries.md
arjenmarkus f9bebaf
Update learn/building_programs/include_files.md
arjenmarkus 1093f68
Merge branch 'master' into building_programs_revised
LKedward 35db588
Update learn/building_programs/index.md
arjenmarkus 7e8a4f5
Update learn/building_programs/index.md
arjenmarkus e3104b5
Update learn/building_programs/distributing.md
arjenmarkus 4ce1646
Update learn/building_programs/distributing.md
arjenmarkus 12a3bf1
Update learn/building_programs/distributing.md
arjenmarkus e06ec5f
Update learn/building_programs/distributing.md
arjenmarkus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,115 @@ | ||
# Categories group mini-books on the 'Learn' landing page | ||
# | ||
# 'fa-icon' refers to the font-awesome icon to display | ||
# next to the category on the landing page | ||
# | ||
categories: | ||
- name: Getting started | ||
fa-icon: fas fa-cubes | ||
# - name: Advanced programming methods | ||
# fa-icon: fas fa-laptop-code | ||
|
||
|
||
|
||
# Mini-books are single-page or multi-page tutorials | ||
# | ||
# 'link' refers to the 'permalink' field of the corresponding page | ||
# | ||
books: | ||
- title: Quickstart Fortran Tutorial | ||
description: An introduction to the Fortran syntax and its capabilities | ||
category: Getting started | ||
link: /learn/quickstart | ||
pages: | ||
- link: /learn/quickstart/hello_world | ||
- link: /learn/quickstart/variables | ||
- link: /learn/quickstart/arrays_strings | ||
- link: /learn/quickstart/operators_control_flow | ||
- link: /learn/quickstart/organising_code | ||
|
||
|
||
|
||
# Web links listed at the bottom of the 'Learn' landing page | ||
# | ||
reference-links: | ||
- name: Fortran wiki | ||
url: http://fortranwiki.org/ | ||
description: A rich collection of Fortran articles and resources in an editable wiki format | ||
|
||
- name: "Fortran 2018 Standard Interpretation Document" | ||
url: https://j3-fortran.org/doc/year/18/18-007r1.pdf | ||
description: "J3/18-007r1 F2018, specification of the base Fortran 2018 language" | ||
|
||
- name: "J3 Fortran Proposals" | ||
url: https://github.com/j3-fortran/fortran_proposals | ||
description: a repository for community collaboration on proposals for the Fortran Standards Committee | ||
|
||
- name: "J3: US Fortran Standards Committee" | ||
url: https://j3-fortran.org/ | ||
description: J3 is the US National Body for the international Fortran standards committee | ||
|
||
- name: "WG5: International Fortran Standards Committe" | ||
url: https://wg5-fortran.org/ | ||
description: | ||
|
||
- name: "Scivision Fortran 2018 Examples" | ||
url: https://github.com/scivision/fortran2018-examples | ||
description: A github repository containing code samples for various Fortran 2018 features | ||
|
||
|
||
|
||
|
||
# Print books listed at the bottom of the 'Learn' landing page | ||
# | ||
reference-books: | ||
- author: Metcalf, M., Reid, J. and Cohen M. | ||
year: 2018 | ||
title: Modern Fortran Explained | ||
url: https://global.oup.com/academic/product/modern-fortran-explained-9780198811893 | ||
edition: 5th ed | ||
location: Oxford, UK | ||
publisher: Oxford Universtiy Press | ||
|
||
- author: Curcic, M. | ||
year: 2020 | ||
title: "Modern Fortran: Building Efficient Parallel Applications" | ||
url: https://www.manning.com/books/modern-fortran | ||
edition: 1st ed | ||
location: Shelter Island, NY | ||
publisher: Manning Publications | ||
|
||
- author: Markus, A. | ||
year: 2012 | ||
title: "Modern Fortran in Practice" | ||
url: https://www.cambridge.org/core/books/modern-fortran-in-practice/BC5BD23B2E478B4D457C5D6265BA9363 | ||
edition: 1st ed | ||
location: Cambridge, UK | ||
publisher: Cambridge University Press | ||
|
||
- author: Chivers, I. and Sleightholme, J. | ||
year: 2018 | ||
title: Introduction to Programming with Fortran | ||
url: https://doi.org/10.1007/978-3-319-75502-1 | ||
edition: 4th ed | ||
publisher: Springer International Publishing | ||
|
||
- author: Chapman S. J. | ||
year: 2018 | ||
title: Fortran for Scientists and Engineers | ||
url: https://www.mheducation.com/highered/product/fortran-scientists-engineers-chapman/M9780073385891.html | ||
edition: 4th ed | ||
location: New York | ||
publisher: McGraw-Hill Education | ||
# Categories group mini-books on the 'Learn' landing page | ||
# | ||
# 'fa-icon' refers to the font-awesome icon to display | ||
# next to the category on the landing page | ||
# | ||
categories: | ||
- name: Getting started | ||
fa-icon: fas fa-cubes | ||
# - name: Advanced programming methods | ||
# fa-icon: fas fa-laptop-code | ||
|
||
|
||
|
||
# Mini-books are single-page or multi-page tutorials | ||
# | ||
# 'link' refers to the 'permalink' field of the corresponding page | ||
# | ||
books: | ||
- title: Quickstart Fortran Tutorial | ||
description: An introduction to the Fortran syntax and its capabilities | ||
category: Getting started | ||
link: /learn/quickstart | ||
pages: | ||
- link: /learn/quickstart/hello_world | ||
- link: /learn/quickstart/variables | ||
- link: /learn/quickstart/arrays_strings | ||
- link: /learn/quickstart/operators_control_flow | ||
- link: /learn/quickstart/organising_code | ||
|
||
- title: Building programs | ||
description: How to use the compiler to build an executable program | ||
category: Getting started | ||
link: /learn/building_programs | ||
pages: | ||
- link: /learn/building_programs/compiling_source | ||
- link: /learn/building_programs/linking_pieces | ||
- link: /learn/building_programs/runtime_libraries | ||
- link: /learn/building_programs/include_files | ||
- link: /learn/building_programs/managing_libraries | ||
- link: /learn/building_programs/build_tools | ||
- link: /learn/building_programs/distributing | ||
|
||
|
||
|
||
# Web links listed at the bottom of the 'Learn' landing page | ||
# | ||
reference-links: | ||
- name: Fortran wiki | ||
url: http://fortranwiki.org/ | ||
description: A rich collection of Fortran articles and resources in an editable wiki format | ||
|
||
- name: "Fortran 2018 Standard Interpretation Document" | ||
url: https://j3-fortran.org/doc/year/18/18-007r1.pdf | ||
description: "J3/18-007r1 F2018, specification of the base Fortran 2018 language" | ||
|
||
- name: "J3 Fortran Proposals" | ||
url: https://github.com/j3-fortran/fortran_proposals | ||
description: a repository for community collaboration on proposals for the Fortran Standards Committee | ||
|
||
- name: "J3: US Fortran Standards Committee" | ||
url: https://j3-fortran.org/ | ||
description: J3 is the US National Body for the international Fortran standards committee | ||
|
||
- name: "WG5: International Fortran Standards Committe" | ||
url: https://wg5-fortran.org/ | ||
description: | ||
|
||
- name: "Scivision Fortran 2018 Examples" | ||
url: https://github.com/scivision/fortran2018-examples | ||
description: A github repository containing code samples for various Fortran 2018 features | ||
|
||
|
||
|
||
|
||
# Print books listed at the bottom of the 'Learn' landing page | ||
# | ||
reference-books: | ||
- author: Metcalf, M., Reid, J. and Cohen M. | ||
year: 2018 | ||
title: Modern Fortran Explained | ||
url: https://global.oup.com/academic/product/modern-fortran-explained-9780198811893 | ||
edition: 5th ed | ||
location: Oxford, UK | ||
publisher: Oxford Universtiy Press | ||
|
||
- author: Curcic, M. | ||
year: 2020 | ||
title: "Modern Fortran: Building Efficient Parallel Applications" | ||
url: https://www.manning.com/books/modern-fortran | ||
edition: 1st ed | ||
location: Shelter Island, NY | ||
publisher: Manning Publications | ||
|
||
- author: Markus, A. | ||
year: 2012 | ||
title: "Modern Fortran in Practice" | ||
url: https://www.cambridge.org/core/books/modern-fortran-in-practice/BC5BD23B2E478B4D457C5D6265BA9363 | ||
edition: 1st ed | ||
location: Cambridge, UK | ||
publisher: Cambridge University Press | ||
|
||
- author: Chivers, I. and Sleightholme, J. | ||
year: 2018 | ||
title: Introduction to Programming with Fortran | ||
url: https://doi.org/10.1007/978-3-319-75502-1 | ||
edition: 4th ed | ||
publisher: Springer International Publishing | ||
|
||
- author: Chapman S. J. | ||
year: 2018 | ||
title: Fortran for Scientists and Engineers | ||
url: https://www.mheducation.com/highered/product/fortran-scientists-engineers-chapman/M9780073385891.html | ||
edition: 4th ed | ||
location: New York | ||
publisher: McGraw-Hill Education |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
layout: book | ||
title: Build tools | ||
permalink: /learn/building_programs/build_tools | ||
--- | ||
|
||
If this seems complicated, well, you are right and we are only | ||
scratching the surface here. The complications arise because of | ||
differences between platforms, differences between compilers/linkers and | ||
because of differences in the way programs are set up. Fortunately, | ||
there are many tools to help configure and maintain the build steps. | ||
We will not try and catalogue them, but give instead a very limited | ||
list of tools that you typically encounter: | ||
|
||
* The `make` utility is a classical tool that uses instructions about | ||
how the various components of a program depend on each other to | ||
efficiently compile and link the program (or programs). It takes a | ||
so-called `Makefile` that contains the dependencies. | ||
|
||
Simply put: | ||
|
||
If a program file is older than any of the libraries and object files | ||
it depends on, the make utility knows it has to rebuild it and goes on | ||
to look at the libraries and object files - are any out of date? | ||
|
||
If an object file is older than the corresponding source file, the | ||
make utility knows it has to compile the source file. | ||
|
||
* Integrated development tools take care of many of the above details. A | ||
popular tool on Windows is MicroSoft's Visual Studio, but others exist, | ||
such as Eclipse (Photran) and Code::Blocks. They offer a graphical | ||
arjenmarkus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
user-interface, but are often very specific for the compiler and | ||
platform. | ||
|
||
* Maintenance tools like autotools and CMake can generate makefiles or | ||
arjenmarkus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Visual Studio project files via a high-level description. They abstract | ||
away from the compiler and platform specifics. | ||
|
||
Here is a very simple example of a `Makefile` as used by the `make` utility, | ||
just to give you an impression: | ||
|
||
# Collect the macros at the beginning - easier to customise | ||
FC = gfortran | ||
LD = gfortran | ||
FCOPTS = -c | ||
LDOPTS = "-o " | ||
|
||
EXE = .exe | ||
OBJ = .o | ||
|
||
all: tabulate$(EXE) | ||
|
||
tabulate$(EXE) : tabulate$(OBJ) function$(OBJ) | ||
{tab}$(LD) $(LDOPTS)tabulate$(EXE) tabulate.f90 function$(OBJ) | ||
|
||
tabulate$(OBJ) : tabulate.f90 function.mod | ||
{tab}$(FC) $(FCOPTS) tabulate.f90 | ||
|
||
function$(OBJ) : function.f90 | ||
{tab}$(FC) $(FCOPTS) function.f90 | ||
|
||
(A peculiarity of `make` is that in the input file, tab characters are used | ||
in several places - here indicated as "{tab}" - as significant whitespace.) | ||
|
||
When stored in a file "Makefile" and "{tab}" replaced by a tab character, | ||
you can run it like: | ||
|
||
```shell | ||
$ make | ||
``` | ||
|
||
(the name `Makefile` is the default, otherwise use the option `-f` to specify | ||
a different file name). Now only change the file "tabulate.f90" and run it | ||
again. You will see that only that file gets compiled again and then the | ||
program is built. The file "function.f90" was not changed, so the object | ||
file and the module intermediate file would remain unchanged, so there | ||
is no need to recompile it. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.