Makefile 1.83 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
include ../../Make.inc

EXE = pfof_snap

COMMONDIR = ../../common/src/
VPATH= $(COMMONDIR):.

SRC = modhdf5.f90 		\
	modconstant.f90 	\
	modmpicommons.f90 	\
11
12
	modindex.f90		\
	modvarcommons.f90	\
13
14
15
16
17
18
19
	modreadinfo.f90 	\
	modtiming.f90		\
	modreadmeta.f90		\
	modwritemeta.f90	\
	modsort.f90 		\
	compute_halo_properties_mod.f90 \
	modhaloopti.f90		\
20
	modhalo.f90 		\
21
22
23
24
25
26
	modwritehalo.f90	\
	modreadparameters.f90	\
	modfofmpi.f90 		\
	modvariables.f90	\
	modmpicom.f90		\
	modreadcube.f90 	\
27
	modwritedmcube.f90 	\
Roy Fabrice's avatar
Roy Fabrice committed
28
	modwritestarcube.f90	\
29
	read_ramses_part_mod.f90	\
30
	select_dm_mod.f90	\
31
32
33
34
35
36
	modio.f90		\
	modfofpara.f90		\
	pfof_snap.f90

OBJS = $(SRC:%.f90=%.o)

Roy Fabrice's avatar
Roy Fabrice committed
37

38
39
40
41
42
43
44
45
46
# variable containing if git is used or not
ifeq ($(wildcard ../../.git/HEAD ../../.git/index),)
	OBJ_GIT =
	USE_GIT =
else
	USE_GIT = $(shell which git)
	OBJ_GIT = ../../.git/HEAD ../../.git/index
endif

47
48
49
50

%.o:%.f90
	@echo "--------------------------------"
	@echo building $*.o with parameters \
Roy Fabrice's avatar
Roy Fabrice committed
51
52
	FC=$(FC), FCFLAGS=$(FCFLAGS)
	$(FC) -c $(FCFLAGS) $<
53
54
55
56

%.mod:%.f90
	@echo "--------------------------------"
	@echo building $*.mod with parameters \
Roy Fabrice's avatar
Roy Fabrice committed
57
58
	FC=$(FC), FCFLAGS=$(FCFLAGS)
	$(FC) -c $(FCFLAGS) $<
59

Roy Fabrice's avatar
Roy Fabrice committed
60

61
62
release: $(EXE)
all: release
Roy Fabrice's avatar
Roy Fabrice committed
63
64
debug: FCFLAGS = $(DEBUGFLAGS)
debug: $(EXE)
65

Roy Fabrice's avatar
Roy Fabrice committed
66
67

$(EXE) : gitversion $(OBJS)
68
69
	@echo "--------------------------------"
	@echo building $(EXE) with parameters \
Roy Fabrice's avatar
Roy Fabrice committed
70
71
	FC=$(FC), LDFLAGS=$(LDFLAGS)
	$(FC) -g -o $(EXE) $(OBJS) $(LDFLAGS)
72
73
74

clean :
	@echo "--------------------------------"
75
	@echo cleaning compiled objects, modules and executable
76
	rm -f *.o *.mod *~ $(EXE) $(COMMONDIR)/gitversion.h
77

Roy Fabrice's avatar
Roy Fabrice committed
78

79
80
81
82
83
84
85
86
87
# create file for git version
gitversion: $(OBJ_GIT)
ifneq ($(USE_GIT), )
	@cd $(COMMONDIR) ;\
	echo "#define GITVERSION \"$(shell git rev-parse HEAD)\"" > gitversion.h
else
	@cd $(COMMONDIR) ;\
	echo "#define GITVERSION \"no_version_found\"" > gitversion.h
endif
88

89
.PHONY: gitversion clean all