1# mgptfast = MPI with its default compiler, optimizations for MGPT
2
3SHELL = /bin/sh
4
5# ---------------------------------------------------------------------
6# compiler/linker settings
7# specify flags and libraries needed for your compiler
8
9CC =		mpicxx
10CCFLAGS =	-O3 -msse3 -funroll-loops
11SHFLAGS =	-fPIC
12DEPFLAGS =	-M
13
14LINK =		mpicxx
15LINKFLAGS =	-g -O
16LIB =
17SIZE =		size
18
19ARCHIVE =	ar
20ARFLAGS =	-rc
21SHLIBFLAGS =	-shared
22
23# ---------------------------------------------------------------------
24# LAMMPS-specific settings, all OPTIONAL
25# specify settings for LAMMPS features you will use
26# if you change any -D setting, do full re-compile after "make clean"
27
28# LAMMPS ifdef settings
29# see possible settings in Section 3.5 of the manual
30
31LMP_INC =	-DLAMMPS_GZIP
32
33# MPI library
34# see discussion in Section 3.4 of the manual
35# MPI wrapper compiler/linker can provide this info
36# can point to dummy MPI library in src/STUBS as in Makefile.serial
37# use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts
38# INC = path for mpi.h, MPI compiler settings
39# PATH = path for MPI library
40# LIB = name of MPI library
41
42MPI_INC =       -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1
43MPI_PATH =
44MPI_LIB =
45
46# FFT library
47# see discussion in Section 3.5.2 of manual
48# can be left blank to use provided KISS FFT library
49# INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings
50# PATH = path for FFT library
51# LIB = name of FFT library
52
53FFT_INC =
54FFT_PATH =
55FFT_LIB =
56
57# JPEG and/or PNG library
58# see discussion in Section 3.5.4 of manual
59# only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC
60# INC = path(s) for jpeglib.h and/or png.h
61# PATH = path(s) for JPEG library and/or PNG library
62# LIB = name(s) of JPEG library and/or PNG library
63
64JPG_INC =
65JPG_PATH =
66JPG_LIB =
67
68# ---------------------------------------------------------------------
69# build rules and dependencies
70# do not edit this section
71
72include Makefile.package.settings
73include Makefile.package
74
75EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC)
76EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
77EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)
78EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS)
79EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS)
80
81# Path to src files
82
83vpath %.cpp ..
84vpath %.h ..
85
86# Link target
87
88$(EXE): main.o $(LMPLIB) $(EXTRA_LINK_DEPENDS)
89	$(LINK) $(LINKFLAGS) main.o $(EXTRA_PATH) $(LMPLINK) $(EXTRA_LIB) $(LIB) -o $@
90	$(SIZE) $@
91
92# Library targets
93
94$(ARLIB): $(OBJ) $(EXTRA_LINK_DEPENDS)
95	@rm -f ../$(ARLIB)
96	$(ARCHIVE) $(ARFLAGS) ../$(ARLIB) $(OBJ)
97	@rm -f $(ARLIB)
98	@ln -s ../$(ARLIB) $(ARLIB)
99
100$(SHLIB): $(OBJ) $(EXTRA_LINK_DEPENDS)
101	$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o ../$(SHLIB) \
102		$(OBJ) $(EXTRA_LIB) $(LIB)
103	@rm -f $(SHLIB)
104	@ln -s ../$(SHLIB) $(SHLIB)
105
106# Compilation rules
107
108%.o:%.cpp
109	$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $<
110
111# Individual dependencies
112
113depend : fastdep.exe $(SRC)
114	@./fastdep.exe $(EXTRA_INC) -- $^ > .depend || exit 1
115
116fastdep.exe: ../DEPEND/fastdep.c
117	cc -O -o $@ $<
118
119sinclude .depend
120