Makefile 1.99 KB
Newer Older
1
2
include ../../Make.inc

Roy Fabrice's avatar
Roy Fabrice committed
3
EXE = pfof_snap.exe
4
5
6
7

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

Roy Fabrice's avatar
Roy Fabrice committed
8
SRC = modconstant.f90 	\
Roy Fabrice's avatar
Roy Fabrice committed
9
	type_info_ramses_mod.f90\
10
	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
	modwritehalo.f90	\
	modreadparameters.f90	\
	modfofmpi.f90 		\
Roy Fabrice's avatar
Roy Fabrice committed
24
25
	variables_m.f90	\
	mpi_communicator_m.f90		\
26
	modreadcube.f90 	\
Roy Fabrice's avatar
Roy Fabrice committed
27
28
29
30
31
32
33
	write_dm_cube_m.f90 	\
	write_star_cube_m.f90	\
	read_ramses_part_file_m.f90	\
	select_dm_m.f90	\
	read_ramses_output_m.f90 \
	io_utils_m.f90		\
	parallel_fof_m.f90		\
34
35
	pfof_snap.f90

Roy Fabrice's avatar
Roy Fabrice committed
36
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

Roy Fabrice's avatar
Roy Fabrice committed
47
.SUFFIXES:
Roy Fabrice's avatar
Roy Fabrice committed
48

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

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

Roy Fabrice's avatar
Roy Fabrice committed
61
all: $(EXE)
Roy Fabrice's avatar
Roy Fabrice committed
62

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

Roy Fabrice's avatar
Roy Fabrice committed
66
$(EXE) : gitversion $(OBJS)
67
	@echo "--------------------------------"
68
	@echo $(ROOT_PFOF)
69
	@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

Roy Fabrice's avatar
Roy Fabrice committed
73
clean:
74
	@echo "--------------------------------"
75
	@echo cleaning compiled objects, modules and executable
Roy Fabrice's avatar
Roy Fabrice committed
76
	rm -f *.o *.mod *~ $(EXE) $(COMMONDIR)/gitversion.h
77

Roy Fabrice's avatar
Roy Fabrice committed
78
79
install:
	$(INSTALL) $(EXE) $(BINDIR)
80

Roy Fabrice's avatar
Roy Fabrice committed
81
82
uninstall:
	rm -f $(BINDIR)/$(EXE)
Roy Fabrice's avatar
Roy Fabrice committed
83

84
85
86
87
88
89
90
91
92
# 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
93

94

Roy Fabrice's avatar
Roy Fabrice committed
95
.PHONY: all install uninstall gitversion clean