Makefile 1.58 KB
Newer Older
François Trigaux's avatar
François Trigaux committed
1
2
3
4
CC=gcc
CF=gfortran
LD=gcc
LIBS=-lgfortran -lreadinifile
5
6
7
CFLAGS=-g -fPIC
F90FLAGS=-g -fPIC -fimplicit-none -fbacktrace -ffree-line-length-0 -fcheck=all -ffpe-trap=zero,overflow,underflow -finit-real=nan
FFLAGS=-g -fPIC -fimplicit-none -fbacktrace -ffree-line-length-0 -fcheck=all -ffpe-trap=zero,overflow,underflow -finit-real=nan
François Trigaux's avatar
François Trigaux committed
8
9
10
11
12
13
# List of directories
DIRC=src/interface
DIRF90=src/fortran90
DIRF=src/fortran
OBJDIR=obj
BINDIR=bin
14
LIBDIR=lib
François Trigaux's avatar
François Trigaux committed
15
16

# List of objects
17
OBJC=gebt.o
François Trigaux's avatar
François Trigaux committed
18
19
20
21
22
23
24
25
OBJF90= CPUtime.o GlobalDataFun.o TimeFunction.o PrescribedCondition.o InternalData.o Preprocess.o Element.o Member.o System.o  Solve.o EigenSolve.o Analysis.o Wrappers.o
OBJF=ddep.o ma28.o  mc19.o blas.o lapack.o arpack.o

# Add obj/ in front of all objects names
OBJC       := $(OBJC:%.o=$(OBJDIR)/%.o)
OBJF90     := $(OBJF90:%.o=$(OBJDIR)/%.o)
OBJF       := $(OBJF:%.o=$(OBJDIR)/%.o)

26
27
28
29
default: lib

# This default rule is to compile the gebt as an independent library
lib: $(OBJC) $(OBJF90) $(OBJF)
30
	$(LD) $(CFLAGS) -shared -o $(LIBDIR)/libgebt.so $^ $(LIBS)
31
32
33
34
	cp src/interface/*.h ./include/

# Create an executable. Requires a main.c file in the OBJDIR directory
exe: $(OBJC) $(OBJF90) $(OBJF) $(OBJDIR)/main.o
François Trigaux's avatar
François Trigaux committed
35
36
37
38
39
40
41
42
43
44
45
46
47
	$(LD) $(CFLAGS) -o $(BINDIR)/gebt $^ $(LIBS)
	cp $(BINDIR)/gebt run/

$(OBJC): $(OBJDIR)/%.o: $(DIRC)/%.c
	$(CC) $(CFLAGS) -c  $< -o $@ 

$(OBJF90): $(OBJDIR)/%.o: $(DIRF90)/%.f90
	$(CF) $(F90FLAGS) -c $< -o $@ -J$(OBJDIR)

$(OBJF): $(OBJDIR)/%.o: $(DIRF)/%.f
	$(CF) $(FFLAGS) -fallow-argument-mismatch -c -o  $@ $< -J$(OBJDIR)

clean:
48
49
50
51
	rm -vf $(OBJDIR)/*.o
	rm -vf $(OBJDIR)/*.mod
	rm -vf $(BINDIR)/gebt
	rm -vf $(BINDIR)/libgebt.so