1# Siesta/Util/SiestaSubroutine/SimpleTest/Makefile
2#
3# Copyright (C) 1996-2016	The SIESTA group
4#  This file is distributed under the terms of the
5#  GNU General Public License: see COPYING in the top directory
6#  or http://www.gnu.org/copyleft/gpl.txt.
7# See Docs/Contributors.txt for a list of contributors.
8#
9# Makefile for Client-Server example
10#
11# JM Soler, A Garcia, E Anglada
12#
13WORK_DIR=$(shell pwd)
14SIESTA_DIR=$(WORK_DIR)/../../../..
15SRC_DIR=$(SIESTA_DIR)/Src
16OBJDIR=Obj
17OBJ_DIR=$(SIESTA_DIR)/$(OBJDIR)
18#
19.SUFFIXES:
20.SUFFIXES: .c .f .F .o .a .f90 .F90
21#
22VPATH=$(SRC_DIR)
23#
24#  simple_pipes_serial     : Simple serial test with pipes version
25#  simple_pipes_parallel   : Simple parallel test with pipes version
26#  simple_sockets_serial   : Simple serial test with sockets version
27#  simple_sockets_parallel : Simple parallel test with sockets version
28#  simple_mpi_serial       : Simple serial test with MPI version
29#  simple_mpi_parallel     : Simple parallel test with MPI version
30#
31# default: simple_pipes_serial simple_sockets_serial clean
32
33all: default
34default: simple_pipes_serial simple_pipes_parallel \
35	simple_sockets_serial simple_sockets_parallel \
36	simple_mpi_serial simple_mpi_parallel
37
38ARCH_MAKE=$(OBJ_DIR)/arch.make
39include $(ARCH_MAKE)
40#
41# Uncomment the following line for debugging support
42#
43#FFLAGS=$(FFLAGS_DEBUG)
44#
45# Routines used by pipes and sockets versions (VPATH knows where they are)
46#
47FSIESTA_PIPES= fsiesta_pipes.o pxf.o
48FSIESTA_SOCKETS= fsockets.o sockets.o fsiesta_sockets.o
49#
50# Siesta libraries used by MPI version
51#
52SIESTA_LIB=libSiestaForces.a
53FDF=libfdf.a
54XMLPARSER=libxmlparser.a
55WXML=libwxml.a
56XC=libSiestaXC.a
57ALL_LIBS= $(SIESTA_LIB) $(FDF) $(WXML) $(XMLPARSER) $(XC) \
58	$(MPI_INTERFACE) $(COMP_LIBS) $(LIBS)
59#
60libs_collected:
61	(cd $(OBJ_DIR) ; \
62	make libSiestaForces.a ; \
63	cp -f *.a *.mod $(WORK_DIR) )
64	touch libs_collected
65#
66# Pipes version
67#
68simple_pipes_serial: $(FSIESTA_PIPES) simple_serial.o
69	$(FC) $(LDFLAGS) -o simple_pipes_serial $(FSIESTA_PIPES) simple_serial.o
70#
71simple_pipes_parallel: $(FSIESTA_PIPES) simple_parallel.o
72	$(FC) $(LDFLAGS) -o simple_pipes_parallel \
73	      $(FSIESTA_PIPES) simple_parallel.o
74#
75# Sockets version
76#
77simple_sockets_serial: $(FSIESTA_SOCKETS) simple_serial.o
78	$(FC) $(LDFLAGS) -o simple_sockets_serial \
79	      $(FSIESTA_SOCKETS) simple_serial.o
80#
81simple_sockets_parallel: $(FSIESTA_SOCKETS) simple_parallel.o
82	$(FC) $(LDFLAGS) -o simple_sockets_parallel \
83	      $(FSIESTA_SOCKETS) simple_parallel.o
84#
85# MPI version
86#
87phonons: libs_collected phonons.o
88	$(FC) $(LDFLAGS) -o phonons phonons.o $(ALL_LIBS)
89#
90simple_mpi_serial: libs_collected simple_serial.o
91	$(FC) $(LDFLAGS) -o simple_mpi_serial simple_serial.o $(ALL_LIBS)
92#
93simple_mpi_parallel: libs_collected simple_mpi_parallel.o
94	$(FC) $(LDFLAGS) -o simple_mpi_parallel \
95	      simple_mpi_parallel.o $(ALL_LIBS)
96#
97intermediate:
98	@echo "==> Cleaning intermediate files ONLY"
99	@echo "==> Use make clean to remove executable files"
100	rm -f *.a *.o *.mod libs_collected
101#
102pristine: clean
103clean:
104	@echo "==> Cleaning all intermediate and executable files"
105	rm -f simple_pipes_serial simple_pipes_parallel
106	rm -f simple_sockets_serial simple_sockets_parallel
107	rm -f simple_mpi_serial simple_mpi_parallel
108	rm -f phonons
109	rm -f *.a *.o *.mod libs_collected
110
111