Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
833a850
ham-fisted packaging approach- put everything in nested mkmf folder, …
ilaflott Jan 22, 2025
7791ad0
build_conda workflow
ilaflott Jan 22, 2025
523f8e6
move test dir up one level and adjust testing commands, source files …
ilaflott Jan 23, 2025
a962698
Merge branch 'main' into conda_package
ilaflott Jan 23, 2025
691fce0
remove git dependency, add verbose run flag to bats testing calls. re…
ilaflott Jan 23, 2025
a8bf0c1
update success condition in regex-based check for version-printing te…
ilaflott Jan 23, 2025
8514450
remove PATH env var export from test- shouldnt be needed anymore. cha…
ilaflott Jan 23, 2025
42e73a8
torturing the pipeline and the test to see if i can get more intel. t…
ilaflott Jan 23, 2025
7db3edf
comment out most commands to test build- focus on certain things...
ilaflott Jan 23, 2025
d8c1fb2
torture test more. somewhat suspicious of insonsistent comparisons be…
ilaflott Jan 23, 2025
4ad9e29
another attempt... set shell variable to number of lines determined v…
ilaflott Jan 23, 2025
c487371
remove failure guard and add a "no-parallelize-within-files" flag... …
ilaflott Jan 23, 2025
0904c22
that option doesnt work for bats. specify only ONE job. add -x for tr…
ilaflott Jan 23, 2025
47f4e8b
what are you doing pipeline????
ilaflott Jan 23, 2025
54007b8
what are you doing pipeline????
ilaflott Jan 23, 2025
13712d6
adjust and torture tests again
ilaflott Jan 23, 2025
e4c20ab
adjust and torture tests again because i forgot to change an expected…
ilaflott Jan 23, 2025
76b3b32
lets see what we have won...
ilaflott Jan 23, 2025
9fb952c
ok- throwing a towel in to focus on other things
ilaflott Jan 23, 2025
19aa357
Update README.md
ilaflott Jan 24, 2025
1832388
Update README.md
ilaflott Jan 24, 2025
53ced82
adjust tests back to answers obtained locally
ilaflott Jan 24, 2025
e6c03c7
settle on local/conda build answers in t/t001-list_paths.sh
ilaflott Jan 24, 2025
1d66115
remove link file that we will create on-the-fly
ilaflott Jan 24, 2025
e0d9ad0
make the link on-the-fly- the local answers should now work in the pi…
ilaflott Jan 24, 2025
ff7018f
t003 setup adjustment as well.
ilaflott Jan 24, 2025
1046f0c
add publish workflow
ilaflott Jan 24, 2025
904fba6
adjust setup routines to work for local and conda cases
ilaflott Jan 24, 2025
a04500d
adjust (which mkmf) check in bats setup. lets try the git test in the…
ilaflott Jan 24, 2025
53d15ab
clean up commented out shell
ilaflott Jan 24, 2025
25a5cc5
have the setup function in t/t002-git-version-string configure the em…
ilaflott Jan 24, 2025
8dad61a
remove noaa-gfdl channel where not needed. update tag
ilaflott Jan 24, 2025
bf0eb7f
replace some_channel in README
ilaflott Jan 24, 2025
616d2cf
forget the Jinja for now
ilaflott Jan 24, 2025
c79f958
move the templates back to base of the repo directory, outside of the…
ilaflott Jan 28, 2025
6d7b5e1
Update README.md
ilaflott Jan 28, 2025
93e6c8f
Update publish_conda.yml
ilaflott Jan 28, 2025
45fac6d
restore publish_conda workflow run condition. remove uneeded and old …
ilaflott Jan 28, 2025
fb1e646
Merge branch 'main' into conda_package
ilaflott Jun 24, 2025
2afff05
Remove tcsh from requirements in meta.yaml
ilaflott Feb 24, 2026
36116df
Merge branch 'main' into conda_package
ilaflott Feb 24, 2026
57a2df5
Install templates to $PREFIX/share/mkmf/templates; fix t004 template …
ilaflott Mar 11, 2026
8114959
Address underwoo's review feedback on test setup/teardown hygiene
ilaflott Mar 11, 2026
65cdfaa
Remove tcsh from environment.yml; move bats-core to test-only in meta…
ilaflott Mar 11, 2026
d23009f
Always prepend correct bin dir to PATH; never skip (underwoo review)
ilaflott Mar 12, 2026
48d0874
test: fail loudly when mkmf is not on PATH instead of silent fallback
ilaflott Mar 12, 2026
f328512
ci: add non-conda test workflow
ilaflott Mar 12, 2026
2cee876
ci: merge build_conda and publish_conda into build_and_publish_conda
ilaflott Mar 12, 2026
a862043
test: fix t002 hanging on GitHub Actions
ilaflott Mar 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/build_and_publish_conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: build_and_publish_conda
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container:
image: ghcr.io/noaa-gfdl/fre-cli:miniconda24.7.1_gcc14.2.0
steps:
- name: Checkout Files
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Run Conda to Build
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
# append the reqd channels
conda config --append channels conda-forge
conda config --append channels noaa-gfdl

# install conda-build and conda-verify
conda install conda-build conda-verify

# publish to anaconda.org when pushing to main
if [ "${{ github.event_name }}" = "push" ] && [ -n "${ANACONDA_TOKEN}" ]; then
export ANACONDA_API_TOKEN="${ANACONDA_TOKEN}"
conda config --set anaconda_upload yes
fi

# conda build
conda build .
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test
on:
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update -q
sudo apt-get install -y -q perl bats

- name: Run tests
run: |
export PATH="$(readlink -f mkmf/bin):$PATH"
bats t/t000-basic.sh
bats t/t001-list_paths.sh
bats t/t002-git-version-string.sh
bats t/t003-mkmf.sh
bats t/t004-templates.sh
5 changes: 0 additions & 5 deletions .gitlab-ci.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

120 changes: 82 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,103 @@
[![Build Status](https://travis-ci.org/NOAA-GFDL/mkmf.svg?branch=master)](https://travis-ci.org/underwoo/mkmf)

Disclaimer
==========

The United States Department of Commerce (DOC) GitHub project code is
provided on an "as is" basis and the user assumes responsibility for
its use. The DOC has relinquished control of the information and no
longer has responsibility to protect the integrity, confidentiality,
or availability of the information. Any claims against the Department
of Commerce stemming from the use of its GitHub project will be
governed by all applicable Federal law. Any reference to specific
commercial products, processes, or services by service mark,
trademark, manufacturer, or otherwise, does not constitute or imply
their endorsement, recommendation or favoring by the Department of
Commerce. The Department of Commerce seal and logo, or the seal and
logo of a DOC bureau, shall not be used in any manner to imply
endorsement of any commercial product or activity by DOC or the United
States Government.

mkmf: Make Makefile
`mkmf`: Make Makefile
===================

__mkmf__ is a tool written in perl5 that will construct a makefile
[![CI](https://github.com/NOAA-GFDL/mkmf/workflows/build_conda/badge.svg)](https://github.com/NOAA-GFDL/mkmf/actions?query=workflow%3Abuild_conda)

__`mkmf`__ is a tool written in `perl5` that will construct a makefile
from distributed source. A single executable program is the typical
result, but I dare say it is extensible to a makefile for any purpose
at all.

__`mkmf`__ is pronounced make-make-file or make-m-f or even McMuff (Paul
Kushner's suggestion).

Features
--------

* Understands dependencies in f90 (modules and use), the Fortran
include statement, and the cpp #include statement in any type of
source
* Understands `f90` dependencies (modules and use), Fortran's
`include` statement, and cpp's `#include` statement, in any type of
source.
* No restrictions on filenames, module names, etc.
* Supports the concept of overlays (where source is maintained in
layers of directories with a defined precedence)
* Keeps track of changes to cpp flags, and knows when to recompile
affected source (i.e, files containing #ifdefs that have been
changed since the last invocation);
* Will run on any unix platform that has perl version 5 installed
layers of directories with a defined precedence).
* Keeps track of changes to `cpp` flags, and knows when to recompile
affected source (i.e, files containing `#ifdefs` that have been
changed since the last invocation).
* It is free, and released under GPL.


Pronunciation
-------------
Requirements
------------
`mkmf` and `list_paths` can be run on any unix type system that has
C-shell ([`tcsh`](http://www.tcsh.org/)) and `perl` version 5 installed.
`git-version-string` requires `git`.

__mkmf__ is pronounced make-make-file or make-m-f or even McMuff (Paul
Kushner's suggestion).
Usage as a `conda` package requires `conda`.

For testing, we recommend [`bats-core`](https://github.com/bats-core/bats-core),
a current and up-to-date (as of January 2025) fork of the original
[`bats`](https://github.com/sstephenson/bats). Tests are run in the `build_conda`
github workflow automatically for PRs. To test locally by hand, simply call `bats`
and target the testing scripts in `t/` as desired from the root of this repository.

Installation
------------

*mkmf* and *list_paths* can be run on any \*nix type system that has
C-shell ([tcsh](http://www.tcsh.org/)) and Perl version 5 installed.
### **(no `conda`)** install and use a copy of this repository
Clone the repository onto a file system with the aforementioned requirements.
Then and add the `mkmf/bin` directory to your shell's `$PATH`, like so:
```
git clone https://github.com/noaa-gfdl/mkmf.git mkmf && cd mkmf
export $PATH=$PWD/mkmf/bin:$PATH
```

### `conda env create` and use a copy of this repository
Similar to the previous approach, clone, but before adjusting `$PATH`,
we create the `conda` environment named `mkmf` with all the required
dependencies. To change the default name of the environment, edit the
first line in `environment.yaml`.
```
git clone https://github.com/noaa-gfdl/mkmf.git mkmf && cd mkmf
conda env create -y -f ./environment.yaml
conda activate mkmf
export $PATH=$PWD/mkmf/bin:$PATH
```

### install package from the `conda` channel into `conda` environment
Dissimilar from the aforementioned approaches, this requires no cloning,
nor any manual adjusting of `$PATH`. It just assumes your `conda` env of
choice is already activated. The package is retrieved from the `noaa-gfdl`
conda channel.

The following line installs `mkmf` iinto the current environment, and
handles everything:
```
conda activate existing_env
(existing_env) conda install noaa-gfdl::mkmf
```

### create a conda environment using the package from the channel
This approach creates a fresh, new environment with `mkmf` and all of
it's dependencies, and requires no manual adjusting of `$PATH`
```
conda create -y -n env_name noaa-gfdl::mkmf
```


To install, place the repository on the file system and add the bin
directory to PATH.
Disclaimer
==========

The United States Department of Commerce (DOC) GitHub project code is
provided on an "as is" basis and the user assumes responsibility for
its use. The DOC has relinquished control of the information and no
longer has responsibility to protect the integrity, confidentiality,
or availability of the information. Any claims against the Department
of Commerce stemming from the use of its GitHub project will be
governed by all applicable Federal law. Any reference to specific
commercial products, processes, or services by service mark,
trademark, manufacturer, or otherwise, does not constitute or imply
their endorsement, recommendation or favoring by the Department of
Commerce. The Department of Commerce seal and logo, or the seal and
logo of a DOC bureau, shall not be used in any manner to imply
endorsement of any commercial product or activity by DOC or the United
States Government.
6 changes: 6 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: mkmf
channels:
- conda-forge
dependencies:
- conda-forge::perl
- conda-forge::bats-core
46 changes: 46 additions & 0 deletions meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package:
name: mkmf
version: '2025.01'
# version: '{{ environ.get("GIT_DESCRIBE_TAG", data.get("version")) }}'

source:
path: .

build:
script:
- cp mkmf/bin/mkmf $PREFIX/bin
- cp mkmf/bin/list_paths $PREFIX/bin
- cp mkmf/bin/git-version-string $PREFIX/bin
# Install templates to the standard data-files location so downstream
# tools (e.g. fre-cli) can reference them via a stable, predictable path.
# Users can point mkmf at a specific template with:
# mkmf -t $CONDA_PREFIX/share/mkmf/templates/<name>.mk
- mkdir -p $PREFIX/share/mkmf/templates
- cp -r templates/* $PREFIX/share/mkmf/templates/


requirements:
host:
- conda-forge::perl
run:
- conda-forge::perl

test:
requires:
- conda-forge::perl
- conda-forge::bats-core
source_files:
- t/
- mkmf/
commands:
- which mkmf
- bats -j 1 -x --verbose-run t/t000-basic.sh
- bats -j 1 -x --verbose-run t/t001-list_paths.sh
- bats -j 1 -x --verbose-run t/t002-git-version-string.sh
- bats -j 1 -x --verbose-run t/t003-mkmf.sh
- bats -j 1 -x --verbose-run t/t004-templates.sh



about:
home: https://github.com/NOAA-GFDL/mkmf
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion t/src/file6.f90

This file was deleted.

16 changes: 14 additions & 2 deletions t/t000-basic.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
#!/usr/bin/env bats

setup() {
binDir=$(readlink -f ${BATS_TEST_DIRNAME}/../bin)
# During conda build/test, $PREFIX points to the just-installed package.
if [[ -n "${PREFIX:-}" && -x "${PREFIX}/bin/mkmf" ]]; then
export PATH="${PREFIX}/bin:${PATH}"
fi

# Fail immediately if mkmf is not on PATH — don't silently fall back.
if ! command -v mkmf >/dev/null 2>&1; then
echo "ERROR: mkmf not found on PATH." >&2
echo "If testing locally, add the repo bin directory first:" >&2
echo " export PATH=\"\$(readlink -f mkmf/bin):\$PATH\"" >&2
return 1
fi

# Temporary directory where tests are run
testDir=$(mktemp -d ${BATS_TEST_DIRNAME}/${BATS_TEST_NAME}.XXXXXXXX)
export PATH=${binDir}:${PATH}
cd ${testDir}
}

Expand Down
Loading
Loading