Makefile 2.18 KB
Newer Older
1
2
3
4
5
include ../../Make.inc

EXE = pfof_snap

COMMONDIR = ../../common/src/
Roy Fabrice's avatar
Roy Fabrice committed
6
7
OBJDIR=../../obj/
MODDIR=../../mod/
8
9
10
11
12
VPATH= $(COMMONDIR):.

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

Roy Fabrice's avatar
Roy Fabrice committed
37
38
OBJS_NOPREFIX=$(SRC:%.f90=%.o)
OBJS=$(addprefix $(OBJDIR), $(OBJS_NOPREFIX))
Roy Fabrice's avatar
Roy Fabrice committed
39

40
41
42
43
44
45
46
47
48
# 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

49

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

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

Roy Fabrice's avatar
Roy Fabrice committed
62

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

Roy Fabrice's avatar
Roy Fabrice committed
68
69

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

76
cleanall :
77
	@echo "--------------------------------"
78
	@echo cleaning compiled objects, modules and executable
Roy Fabrice's avatar
Roy Fabrice committed
79
	rm -f $(OBJDIR)*.o $(MODDIR)*.mod *~ $(EXE) $(COMMONDIR)/gitversion.h
80

81
82
83
84
85
clean:
	@echo "--------------------------------"
	@echo cleaning executable
	rm -f  $(EXE)

Roy Fabrice's avatar
Roy Fabrice committed
86

87
88
89
90
91
92
93
94
95
# 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
96

97
98
99
100
101
102
103
104
105
106
directories: ${MODDIR} ${OBJDIR}

${OBJDIR}:
	${MKDIR_P} $@

${MODDIR}:
	${MKDIR_P} $@


.PHONY: gitversion clean cleanall directories all