Skip to content

Instantly share code, notes, and snippets.

@chirimenmonster
Last active August 29, 2015 14:16
Show Gist options
  • Save chirimenmonster/f72a7411cded889b3771 to your computer and use it in GitHub Desktop.
Save chirimenmonster/f72a7411cded889b3771 to your computer and use it in GitHub Desktop.
Fortran で使う Makefile の書き方 (for GNU Make)
program main
use sub
call helloworld
end program main
FC = gfortran
TARGET = sample
OBJS = main.o sub.o
.SUFFIXES: .f90
%.o: %.f90
$(COMPILE.f) $(OUTPUT_OPTION) $<
%.mod: %.f90 %.o
@:
$(TARGET): $(OBJS)
$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@
main.o: sub.mod
module sub
use, intrinsic :: iso_fortran_env
contains
subroutine helloworld
write(output_unit, '(*(g0))') 'Hello World!'
end subroutine helloworld
end module sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment