The makefile system!

This commit is contained in:
2018-09-18 15:46:56 +02:00
parent a482552637
commit 02a1bd5547
9 changed files with 219 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
*%
+96
View File
@@ -0,0 +1,96 @@
# Makeinclude-Datei für Linux-amd64 (generisch für alle PC-Artigen rechner)
# ACHTUNG: Rechner-spezifische einstellungen haben bei Linux-amd64 nochmal
# jeweils eigene makeinclude-dateien, die vor dieser hier included
# werden.
###########################################################################
# 1. Compiler
# Compiler (non-MPI)
CXX = g++
CC = gcc
FC = gfortran
# Compiler (MPI)
MPICXX = mpic++ # OpenMPI-Version
MPIF90 = mpif90
#MPICXX = mpicxx.mpich-shmem -CC=icc # Arbeitsplatzrechner
#MPICXX = mpicxx -CC=icc # MPICH-Version
#MPICXX = /opt/mpich-mx/bin/mpicxx -CC=icc # MPICH-Version
# portland Compiler. no it doesn't work
#CC = pgcc
#CXX = pgCC
#FC = pgf90
#MPICXX = mpicc -cc=pgcc
#MPICXX = mpiCC -CC=pgCC -L ~/pgi/linux86-64/8.0/mpi/mpich/lib/
###########################################################################
# 2. Includes und Linker-Flags für verschiedene Bibliotheken
# Intel's lustige Numerik-Bibliotheken
X_LAPACK_LIBS = -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lguide -lpthread
X_MKL_LIBS = -lmkl_em64t -lmkl_cdft -lmkl_cdft_core -lmkl_intel_lp64 -lmkl_blacs_ilp64 -lmkl_intel_thread -lmkl_core -lguide
# HDF4, HDF5 und HDF5-parallel
X_HDF_LIBS = -lmfhdf -ldf -lz -ljpeg
X_HDF5_LIBS = -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lz -lhdf5_cpp -lhdf5_hl -lhdf5
X_HDF5_INC = -I/usr/include/hdf5/serial
X_HDF5P_LIBS = -L/usr/lib/x86_64-linux-gnu/hdf5/openmpi -lz -lhdf5_hl -lhdf5
X_HDF5P_INC = -I/usr/include/hdf5/openmpi
# FFTW2
X_FFTW2_LIBS = -lfftw
X_FFTW2_INC =
# FFTW3
X_FFTW3_LIBS = -lfftw3
X_FFTW3_INC =
# Diverser anderer krams.
X_COMPLEX_LIB =
X_MPI_LIBS =
X_OPENMP = -openmp #OpenMP für Intel-Compiler
#X_FFLAGS = -a -k
X_F77_LIB = /usr/lib/libf2c.a
X_THREADS = -lpthread
X_SYS =
X_OPENMP = -openmp
LIBNUMREC = -lnumrec_mt -lF77
###########################################################################
# 3. Nützliche Variablen für den Buildvorgang
# Die eigentlichen OFLAGS werden bei Linux-amd64 aus den noch spezifischeren
# Makeincludes gesetzt, und hier dann nur reingedrückt.
X_OFLAGS = -Ofast $(X_OPT) -fpermissive
## Teilchen-Fliesskommagenauigkeit
# Entweder long double...
X_OFLAGS += -DPART_REAL=double
# Oder einfaches double
# X_OFLAGS += -DPART_REAL=double
#X_LIB = $(X_LIB) -static
# Unnützes Makro, das eh standard ist.
INSTALL = install
###########################################################################
# 4. Weitere Variablen, die (evtl!) irgendwo zur Makefile-Steuerung verwendet
# werden (teilweise redundant, teilweise kaputt)
CPU_TYPE := $(shell cat /proc/cpuinfo|grep Quad| wc -l ) + $(shell cat /proc/cpuinfo|grep i7| wc -l )
# Mehrere kaputte svn-makros
REVNUM = 0
#COMMIT =
#UP =
# Höchst unsicheres Makro, das irgendwo zum clean machen, und random-dateien-löschen
# verwendet wird.
X_CLEAN = rm -rf ../*~ ../*% *.o *.a core ../core
###########################################################################
# 5. Nutzlose Make-Targets, die niemand jemals aufruft.
test: X_OFLAGS = -Ofast $(X_OPT) -ip -static -prec-sqrt -DTESTMODE=" \" ''' TESTMODE ''' \" "
+2
View File
@@ -0,0 +1,2 @@
X_OPT = -march=native
include $(HOMEBASE)/src/makeinclude/Linux-amd64
+2
View File
@@ -0,0 +1,2 @@
X_OPT = -march=native
include $(HOMEBASE)/src/makeinclude/Linux-amd64
+2
View File
@@ -0,0 +1,2 @@
X_OPT = -march=native
include $(HOMEBASE)/src/makeinclude/Linux-amd64
+43
View File
@@ -0,0 +1,43 @@
#X_OFLAGS = -O3 -fno-exceptions
#X_OFLAGS = -O3 -fschedule-insns -fno-rtti-information -fno-exceptions
#X_OFLAGS = -O9 -ccarg -ffast-math -ccarg -O5 -m686
#X_HDF_LIBS = -lmfhdf -ldf -lz -ljpeg
X_HDF5_LIBS = -ljpeg -lz -lhdf5_cpp -lhdf5_hl -lhdf5
X_COMPLEX_LIB =
X_FFLAGS = -a
X_F77_LIB = /usr/lib/libf2c.a
X_THREADS = -lpthread
X_SYS =
REV= " \"$(shell svn info $(PWD)/../. | grep Revision) \" "
X_OFLAGS = -O3 -xO -ip -prec-sqrt -DSVN_REV=$(REV)
#X_LIB = $(X_LIB) -static
test: X_OFLAGS = -O3 -xO -ip -static -prec-sqrt -DTESTMODE=" \" ''' TESTMODE ''' \" "
REVNUM = "$(shell svn info $(HOMEBASE)/src/ | grep Revision | tr -d "Revision: ")"
COMMIT = $(shell svn diff $(HOMEBASE)/src/)
UP =$(shell svn diff $(HOMEBASE)/src/ -r `svn info $(HOMEBASE)/src/ | grep Revision | tr -d "Revision: "`)
svn:
test -n $(COMMIT)
test -n $(UP)
X_CLEAN = rm -rf ../*~ ../*% *.o *.a core ../core
INSTALL = install
CXX = icc
MPICXX = mpicxx -CC=icc
CC = cc
FC = fort77
LIBNUMREC = -lnumrec_mt -lF77
+10
View File
@@ -0,0 +1,10 @@
include $(HOMEBASE)/src/makeinclude/ostype.mak
.SUFFIXES:
%:
@test -d $(X_OSTYPE) || mkdir $(X_OSTYPE)
@cd $(X_OSTYPE); $(MAKE) -f../makefile2 $@
all:
+18
View File
@@ -0,0 +1,18 @@
include $(HOMEBASE)/src/makeinclude/ostype.mak
include $(HOMEBASE)/src/makeinclude/$(X_OSTYPE)
VPATH = ..
X_ROOT_DIR = $(HOMEBASE)
X_INC_DIR = $(X_ROOT_DIR)/include
X_LIB_DIR = $(X_ROOT_DIR)/lib/$(X_OSTYPE)
X_INC = -I$(X_ROOT_DIR)/include # -I$(X_ROOT_DIR)/src/blitz/$(X_OSTYPE)
X_LIB = -L$(X_ROOT_DIR)/lib/$(X_OSTYPE)
MOD_DATA = 644
MOD_EXEC = 755
%.a :
$(AR) $(ARFLAGS) $@ $^
LINK.o = $(CXX) $(LDFLAGS) $(TARGET_ARCH)
+45
View File
@@ -0,0 +1,45 @@
X_OSTYPE ?= $(shell uname)-$(shell uname -m | sed -e s/x86_64/amd64/ -e s/.86/386/ -e 's/\/800//')
ifeq ($(X_OSTYPE),Linux-amd64)
X_MODEL_NAME := $(shell cat /proc/cpuinfo | grep "model name")
ifneq (,$(findstring Intel,$(X_MODEL_NAME)))
# intel
ifneq (,$(findstring i5,$(X_MODEL_NAME)))
# core i5
X_OSTYPE := Linux-amd64-corei7
else
ifneq (,$(findstring i7,$(X_MODEL_NAME)))
# core i7
X_OSTYPE := Linux-amd64-corei7
else
ifneq (,$(findstring E55,$(X_MODEL_NAME)))
#Nehalems
X_OSTYPE := Linux-amd64-corei7
else
ifneq (,$(findstring E56,$(X_MODEL_NAME)))
#Nehalems
X_OSTYPE := Linux-amd64-corei7
else
ifneq (,$(findstring X55,$(X_MODEL_NAME)))
#Nehalems
X_OSTYPE := Linux-amd64-corei7
else
#core 2
X_OSTYPE := Linux-amd64-core2
endif
endif
endif
endif
endif
else
#amd
ifneq (,$(findstring X6,$(X_MODEL_NAME)))
X_OSTYPE := Linux-amd64-hexacore
else
X_OSTYPE := Linux-amd64-opteron
endif
endif
else
# other OS
endif