Skip to content

Commit

Permalink
Add autotools
Browse files Browse the repository at this point in the history
  • Loading branch information
alexispaz committed Jul 7, 2021
1 parent af50742 commit 82f7650
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Autotools

# http://www.gnu.org/software/automake
Makefile.in
Makefile
ar-lib
mdate-sh
py-compile
test-driver
ylwrap

# http://www.gnu.org/software/autoconf
autom4te.cache
autoscan.log
autoscan-*.log
aclocal.m4
compile
config.*
configure
configure.scan
depcomp
install-sh
missing
stamp-h?

# https://www.gnu.org/software/libtool/
ltmain.sh
libtool
missing
.deps/
.dirstamp
.libs/

# http://www.gnu.org/software/texinfo
texinfo.tex

# http://www.gnu.org/software/m4/
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
50 changes: 50 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# We are not following the standard layout of a GNU proyect
AUTOMAKE_OPTIONS = foreign

bin_PROGRAMS = dana

dana_SOURCES = dana.F90

DEBUG_FLAGS = -g -O0 -p
PROF_FLAGS = -p

if COMPILER_IS_GFORTRAN
DEBUG_FLAGS += -fbacktrace
DEBUG_FLAGS += -fcheck=all
DEBUG_FLAGS += -Wall
DEBUG_FLAGS += -fbounds-check
DEBUG_FLAGS += -fcheck-array-temporaries
DEBUG_FLAGS += -pedantic-errors
# F90DEBUG += -std=f2003 -pedantic

# Some times needed for valgrind
# F90DEBUG += -static

# To warn about use modules without only keyword
# F90DEBUG += -Wuse-without-only
endif

if COMPILER_IS_IFORT
DEBUG_FLAGS += -check all
DEBUG_FLAGS += -traceback
DEBUG_FLAGS += -warn all
DEBUG_FLAGS += -debug all
#F90DEBUG += "-Mprof=func"
#F90DEBUG += "-Mprof=line"
endif

if DEBUG
ENABLE_DEBUG=$(DEBUG_FLAGS)
endif

AM_FCFLAGS = $(ENABLE_DEBUG)



.PHONY: debug

debug:
make ENABLE_DEBUG="$(DEBUG_FLAGS)"

all: dana

50 changes: 50 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT([dana],
[m4_esyscmd_s([git describe --always --abbrev=4 --dirty])],
[[email protected]])

AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(.)

AM_INIT_AUTOMAKE()

# Avoid make to rebuild configure
AM_MAINTAINER_MODE

# To build libraries
AC_PROG_RANLIB

# Set AR
AM_PROG_AR

# Set FCFLAGS and FC
: ${FCFLAGS=""} # Override default (i.e. "-g -O2")
AC_PROG_FC

# Debug options
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],[Turn on debugging]),
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value "${enableval}" for --enable-debug]) ;;
esac],enable_debug=no)


# Usefull variables to use inside the Makefile.am files
AM_CONDITIONAL([COMPILER_IS_IFORT], [test x"$FC" = xifort])
AM_CONDITIONAL([COMPILER_IS_GFORTRAN], [test x"$FC" = xgfortran])
AM_CONDITIONAL([DEBUG], [test "x$enable_debug" = "xyes"])


AC_CONFIG_FILES([
Makefile
])


# A precompiler variable
# AC_DEFINE([MYDEFINE],[SOMEVALUE],[Description: Make #define MYDEFINE SOMEVALUE])

AC_OUTPUT
File renamed without changes.
2 changes: 0 additions & 2 deletions makefile

This file was deleted.

0 comments on commit 82f7650

Please sign in to comment.