File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -ex
4+
5+ # Target directory for saving preprocessed project.
6+ destdir=" ${DESTDIR:- build} "
7+
8+ # Get fypp preprocessor
9+ fypp=" ${FYPP:- $(which fypp)} "
10+
11+ # Number of parallel jobs for preprocessing
12+ if [ $( uname) = " Darwin" ]; then
13+ njob=" $( sysctl -n hw.ncpu) "
14+ else
15+ njob=" $( nproc) "
16+ fi
17+
18+ # Create directories for the fpm project.
19+ mkdir -p " $destdir /preprocessed_files"
20+
21+ # Preprocess all files with .fypp extension in source directory.
22+ # Save generated files in build directory.
23+ find src -iname " *.fypp" \
24+ -exec basename {} .fypp ' ;' \
25+ | cut -f1 -d. | xargs -P " $njob " -I{} " $fypp " " src/{}.fypp" " $destdir /preprocessed_files/{}.f90" \
26+
27+ args=(" $@ " )
28+
29+ file=$( printf " %s\n" " ${args[@]} " | grep -P ' ^.+\.[fF]90' )
30+
31+ exec gfortran " ${args[@]} "
32+
33+
You can’t perform that action at this time.
0 commit comments