aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in (renamed from Makefile)44
-rwxr-xr-xMoog.f.in (renamed from Moog.f)3
-rwxr-xr-xconfigure79
3 files changed, 112 insertions, 14 deletions
diff --git a/Makefile b/Makefile.in
index 9cc5c09..6f7dc9a 100644
--- a/Makefile
+++ b/Makefile.in
@@ -1,5 +1,9 @@
# makefile for MOOG with all of the common block assignments;
+PREFIX=@PREFIX@
+BINDIR=@BINDIR@
+DATADIR=@DATADIR@
+
# here are the object files
OBJECTS = Abfind.o Abpop.o Abunplot.o Batom.o Begin.o Binary.o \
Binplot.o Binplotprep.o Blankstring.o Blends.o Bmolec.o Boxit.o \
@@ -29,35 +33,47 @@ COMMON = Atmos.com Dummy.com Equivs.com Factor.com Kappa.com Linex.com \
Quants.com Multimod.com Dampdat.com
# the following lines point to some needed libraries
-X11LIB = /usr/X11/lib
-SMLIB = /usr/local/lib
-
-ifeq ($(MODERN_GCC), 1)
-FFLAGS_GCC10PLUS=-fallow-argument-mismatch
-endif
+X11LIB = @WITH_X11@
+SMLIB = @WITH_SM@
FC = gfortran
-FFLAGS = -Wall -Wextra -ff2c -fdefault-double-8 -fdefault-real-8 $(FFLAGS_GCC10PLUS)
+FFLAGS = @FFLAGS@
LDFLAGS = -L$(X11LIB) -lX11 -ltcl -ltk -L$(SMLIB) -lplotsub -ldevices -lutils
# here are the compilation and linking commands
all: MOOG MOOGSILENT
@echo -----------------------------------------------------------------
@echo
- @echo Set MOOG_DATA environment variable to path containing file\(s\):
- @for x in *.dat; \
- do echo $$x; \
- done
+ @echo Default MOOG_DATA path is $(DATADIR)
+ @echo
+ @echo To override this behavior set the MOOG_DATA environment variable
+ @echo
+ @echo "BASH: export MOOG_DATA=/path/to/dat/files"
+ @echo " CSH: setenv MOOG_DATA /path/to/dat/files"
@echo
@echo -----------------------------------------------------------------
-MOOG: $(OBJECTS);
+MOOG: $(OBJECTS)
$(FC) -o MOOG $(MOOG_ENTRY) $(OBJECTS) $(FFLAGS) $(LDFLAGS)
-MOOGSILENT: $(OBJECTS) $(MOOGSILENT_ENTRY);
+MOOGSILENT: $(OBJECTS) $(MOOGSILENT_ENTRY);
$(FC) -o MOOGSILENT $(MOOGSILENT_ENTRY) $(OBJECTS) $(FFLAGS) $(LDFLAGS)
$(OBJECTS): $(COMMON) $(MOOG_ENTRY) $(MOOGSILENT_ENTRY)
+install: all
+ @for x in $(DESTDIR)$(BINDIR) $(DESTDIR)$(DATADIR); do \
+ echo Creating $$x; \
+ mkdir -p $(DESTDIR)$$x; \
+ done;
+ @for x in MOOG MOOGSILENT; do \
+ echo Installing $$x to $(DESTDIR)$(BINDIR); \
+ install -m755 $$x $(DESTDIR)$(BINDIR); \
+ done;
+ @for x in *.dat; do \
+ echo Installing $$x to $(DESTDIR)$(DATADIR); \
+ install -m755 $$x $(DESTDIR)$(DATADIR);\
+ done;
+
clean:
- -rm -f *.o MOOG MOOGSILENT
+ -rm -f *.o MOOG MOOGSILENT Makefile Moog.f
diff --git a/Moog.f b/Moog.f.in
index c9ac072..cb63e11 100755
--- a/Moog.f
+++ b/Moog.f.in
@@ -20,6 +20,9 @@ c generate a reminder of this necessity
write (moogpath,1001)
call get_environment_variable("MOOG_DATA", moogpath)
+ if (moogpath == "") then
+ moogpath = "@MOOGPATH_DEFAULT@"
+ endif
c*****What kind of machine are you using? Possible ones are:
c OBSOLETE
diff --git a/configure b/configure
new file mode 100755
index 0000000..eaa9884
--- /dev/null
+++ b/configure
@@ -0,0 +1,79 @@
+#!/bin/bash
+with_x11="/usr/X11/lib"
+with_sm="/usr/local/sm"
+fflags=(-Wall -Wextra -ff2c -fdefault-double-8 -fdefault-real-8)
+
+gcc_version=$(gcc --version | head -n 1 | awk -F' ' '{ print $3 }')
+gcc_major="${gcc_version%%\.*}"
+
+if (( $gcc_major >= 10 )); then
+ fflags+=(--allow-argument-mismatch)
+fi
+
+argv=()
+for x in $@; do
+ if [[ "$x" =~ .*=.* ]]; then
+ key="${x%=*}"
+ value="${x#*=}"
+ argv+=($key)
+ argv+=($value)
+ else
+ argv+=(x)
+ fi
+done
+
+
+i=0
+nargs=${#argv[@]}
+while [[ $i < $nargs ]]; do
+ key="${argv[$i]}"
+ value="${argv[$i+1]}"
+ case "$key" in
+ --prefix)
+ prefix="$value"
+ (( i++ ))
+ ;;
+ --bindir)
+ bindir="$value"
+ (( i++ ))
+ ;;
+ --datadir)
+ datadir="$value"
+ (( i++ ))
+ ;;
+ --with-x11)
+ with_x11="$value"
+ (( i++ ))
+ ;;
+ --with-sm)
+ with_sm="$value"
+ (( i++ ))
+ ;;
+ esac
+ (( i++ ))
+done
+
+[[ -z "${prefix}" ]] && prefix="/usr/local"
+[[ -z "${bindir}" ]] && bindir="${prefix}/bin"
+[[ -z "${datadir}" ]] && datadir="${prefix}/share/moog"
+fflags="${fflags[@]}"
+sed "s|@PREFIX@|${prefix}|g;\
+ s|@BINDIR@|${bindir}|g;\
+ s|@DATADIR@|${datadir}|g;\
+ s|@FFLAGS@|${fflags}|g;\
+ s|@WITH_X11@|${with_x11}|g;\
+ s|@WITH_SM@|${with_sm}|g;\
+ " Makefile.in > Makefile
+sed "s|@MOOGPATH_DEFAULT@|${datadir}/|" Moog.f.in > Moog.f
+
+printf "
+Configured with:
+
+Installation prefix ... %s
+X11 library ........... %s
+SuperMongo library .... %s
+
+Run 'make' to compile
+Run 'make install' to install
+
+" $prefix $with_x11 $with_sm