Automatic Make recipes generation

With gfortran at least, you can also build C files with the same driver,

$ cat hello.c
#include <stdio.h>

// Subroutine definition
void print_hello() {
    printf("Hello, world!\n");
}

$ cat hello_from_fortran.f90
interface
  subroutine print_hello() bind(c)
  end subroutine
end interface
call print_hello()
end

$ gfortran hello.c hello_from_fortran.f90 && ./a.out
Hello, world!

So you could package the files into a tarball and anyone could built it with a one-liner:

tar -xf mk-fdeps.tar.gz && cd mk-fdeps && \
gfortran -o mk-fdeps lexer.c $(cat compile-order.txt)

It’s still very minimalistic.

2 Likes