-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (57 loc) · 1.83 KB
/
Makefile
File metadata and controls
71 lines (57 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Copyright (c) 2012, Johannes Feist
# licensed under the MIT open source license, see LICENSE file
.SUFFIXES:
.SUFFIXES: .f90 .o .mod .a .c
# fortran compiler to use
FC=gfortran
# flags to compile with
FCFLAGS=-Wall -O3 -march=native
# flag that tells the compiler where to put the produced module (.mod) files
MODLOCFLAG=-J
# Faddeeva_c.c needs C99
CFLAGS=-std=c99 -Wall -O3 -march=native
# for intel fortran:
ifeq (${USEIFORT},yes)
FC=ifort
FCFLAGS=-warn all -O3 -xHOST
MODLOCFLAG=-module
endif
LIB :=lib/liblaserfields.a
LIBMOD:=lib/laserfields.mod
F90SRCS:=$(wildcard src/*.f90)
CSRCS :=$(wildcard src/*.c)
PROGSRCS:=$(wildcard programs/*.f90)
PROGOBJS:=${PROGSRCS:.f90=.o}
PROGS:=${PROGSRCS:programs/%.f90=bin/%}
DEFAULT: lib
.PHONY : lib progs clean DEFAULT
lib: ${LIB} ${LIBMOD}
progs: ${PROGS}
test: progs
${MAKE} -C test
clean:
${RM} ${LIB} ${LIBMOD} src/*.o src/*.mod programs/*.o bin/*
${MAKE} -C test clean
${LIB} : ${F90SRCS:.f90=.o} ${CSRCS:.c=.o}
${LIBMOD} : ${LIBMOD:lib/%=src/%}
cp $< $@
${PROGOBJS} : INCFLAGS=-Ilib
${PROGOBJS} : ${LIBMOD}
%.o: %.f90
$(FC) $(FCFLAGS) $(INCFLAGS) $(MODLOCFLAG) $(dir $@) -c $< -o $@
%.a :
$(AR) $(ARFLAGS) $@ $^
bin/% : LDFLAGS+=-Llib -llaserfields
bin/% : programs/%.o ${LIB}
$(FC) $(FCFLAGS) $< $(LDFLAGS) -o $@
# this tells make that it can make a .mod file by making the associated .o file
# $(NOOP) is not defined and so does nothing, but it's not an empty rule, which
# would mislead make
%.mod: %.o
$(NOOP)
### dependencies
src/atomic_units.o : src/nrtype.mod
src/laserfields.o : src/laserfields_paramfilehandling.mod src/laserfields_module.mod
src/laserfields_paramfilehandling.o : src/laserfields_module.mod src/nrtype.mod
src/laserfields_module.o : src/atomic_units.mod src/faddeeva.mod src/laserfields_miscfuncs.mod src/nrtype.mod
src/laserfields_miscfuncs.o : src/nrtype.mod