Skip to content

Commit 32595e3

Browse files
committed
Added FORD manifest.
1 parent 710f92a commit 32595e3

File tree

3 files changed

+131
-2
lines changed

3 files changed

+131
-2
lines changed

Makefile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# CC - C compiler.
1010
# AR - Archiver.
1111
# MAKE - Make tool.
12+
# FORD - FORD documentation generator.
1213
# FFLAGS - Fortran compiler flags.
1314
# CFLAGS - C compiler flags.
1415
# PPFLAGS - Pre-processor flags. Change to `-fpp` for Intel IFORT.
@@ -23,6 +24,7 @@ FC = gfortran
2324
CC = gcc
2425
AR = ar
2526
MAKE = make
27+
FORD = ford
2628

2729
DEBUG = -g -O0 -Wall -fmax-errors=1
2830
RELEASE = -O2 -march=native
@@ -35,6 +37,7 @@ LDFLAGS = -I$(PREFIX)/include -L$(PREFIX)/lib
3537
LDLIBS =
3638
INCDIR = $(PREFIX)/include/libfortran-unix
3739
LIBDIR = $(PREFIX)/lib
40+
DOCDIR = ./doc
3841

3942
TARGET = libfortran-unix.a
4043

@@ -55,9 +58,13 @@ OBJ = unix.o unix_dirent.o unix_errno.o unix_fcntl.o \
5558
unix_time.o unix_types.o unix_unistd.o unix_utsname.o \
5659
unix_wait.o unix_macro.o
5760

58-
.PHONY: all clean examples freebsd freebsd_examples install linux linux_examples
61+
.PHONY: all clean doc examples install \
62+
freebsd freebsd_doc freebsd_examples \
63+
linux linux_doc linux_examples
5964

60-
all: $(TARGET)
65+
all:
66+
@echo "Add build target [freebsd|linux], for example:"
67+
@echo "make linux"
6168

6269
# Library
6370
$(TARGET): $(SRC)
@@ -169,6 +176,17 @@ uname: $(TARGET) examples/uname/uname.f90
169176
uptime: $(TARGET) examples/uptime/uptime.f90
170177
$(FC) $(FFLAGS) $(PPFLAGS) $(LDFLAGS) -o uptime examples/uptime/uptime.f90 $(TARGET) $(LDLIBS)
171178

179+
# Documentation
180+
doc: ford.md
181+
$(FORD) -d ./src ford.md
182+
183+
freebsd_doc: ford.md
184+
$(FORD) -m "__FreeBSD__" -d ./src ford.md
185+
186+
linux_doc: ford.md
187+
$(FORD) -m "__linux__" -d ./src ford.md
188+
189+
# Installation.
172190
install: $(TARGET)
173191
@echo "--- Installing $(TARGET) to $(LIBDIR)/ ..."
174192
install -d $(LIBDIR)
@@ -177,9 +195,11 @@ install: $(TARGET)
177195
install -d $(INCDIR)
178196
install -m 644 unix*.mod $(INCDIR)/
179197

198+
# Clean-up.
180199
clean:
181200
if [ `ls -1 *.mod 2>/dev/null | wc -l` -gt 0 ]; then rm *.mod; fi
182201
if [ `ls -1 *.o 2>/dev/null | wc -l` -gt 0 ]; then rm *.o; fi
202+
if [ -e $(DOCDIR) ]; then rm -r $(DOCDIR); fi
183203
if [ -e $(TARGET) ]; then rm $(TARGET); fi
184204
if [ -e dirent ]; then rm dirent; fi
185205
if [ -e fifo ]; then rm fifo; fi

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,31 @@ On Linux:
9494
$ fpm build --profile release --flag "-D__linux__"
9595
```
9696

97+
## Source Code Documentation
98+
99+
The source code documentation of the library has to be created with
100+
[FORD](https://github.com/Fortran-FOSS-Programmers/ford). Install the Python
101+
package with:
102+
103+
```
104+
$ python3 -m pip install -U ford
105+
```
106+
107+
In the source repository, either run:
108+
109+
```
110+
$ make freebsd_doc
111+
```
112+
113+
Or:
114+
115+
```
116+
$ make linux_doc
117+
```
118+
119+
The HTML files will be written to directory `doc/`. Open `index.html` in a web
120+
browser.
121+
97122
## Examples
98123

99124
Examples are provided in directory `examples/`:

ford.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
project: fortran-unix
2+
version: 0.1.0
3+
license: isc
4+
doc_license: by
5+
graph: false
6+
search: true
7+
display: public
8+
sort: alpha
9+
fpp_extensions: F90
10+
macro: __linux__
11+
preprocess: true
12+
summary: **fortran-unix** – A collection of Fortran 2008 ISO C binding
13+
interfaces to selected POSIX and SysV types, functions, and
14+
routines on 64-bit Linux and FreeBSD.
15+
author: Philipp Engel
16+
project_github: https://github.com/interkosmos/fortran-unix
17+
18+
The library covers system calls for:
19+
20+
* standard input/output,
21+
* file and directory access,
22+
* clocks and timers,
23+
* signals,
24+
* processes,
25+
* pipes,
26+
* serial port input/output,
27+
* terminal control,
28+
* POSIX threads,
29+
* POSIX mutexes and semaphores,
30+
* POSIX regular expressions,
31+
* BSD sockets,
32+
* UNIX System V message queues,
33+
* POSIX message queues.
34+
35+
By default, the documentation is based on the Linux API. For the FreeBSD API,
36+
select build target `freebsd_doc`:
37+
38+
```
39+
$ make freebsd_doc
40+
```
41+
42+
## Build Instructions
43+
44+
On Linux, run:
45+
46+
```
47+
$ make linux
48+
```
49+
50+
On FreeBSD, run:
51+
52+
```
53+
$ make freebsd
54+
```
55+
56+
To compile with Intel oneAPI instead of GCC:
57+
58+
```
59+
$ make CC=icx FC=ifx PPFLAGS=
60+
```
61+
62+
Optionally, install `libfortran-unix.a` and the associated module files
63+
system-wide:
64+
65+
```
66+
$ make install PREFIX=/opt
67+
--- Installing libfortran-unix.a to /opt/lib/ ...
68+
--- Installing module files to /opt/include/libfortran-unix/ ...
69+
```
70+
71+
## Fortran Package Manager
72+
73+
Using the Fortran Package Manager, a preprocessor flag has to be passed to GNU
74+
Fortran. On Linux:
75+
76+
```
77+
$ fpm build --profile release --flag "-D__linux__"
78+
```
79+
80+
On FreeBSD:
81+
82+
```
83+
$ fpm build --profile release --flag "-D__FreeBSD__"
84+
```

0 commit comments

Comments
 (0)