1#
2# Copyright (C) 2003, Northwestern University and Argonne National Laboratory
3# See COPYRIGHT notice in top-level directory.
4#
5# $Id: Makefile.in 2743 2016-12-28 16:23:27Z wkliao $
6#
7# @configure_input@
8
9srcdir = @srcdir@
10VPATH = @srcdir@
11
12include macros.make
13
14PACKAGE_NAME      = @PACKAGE_NAME@
15PACKAGE_VERSION   = @PACKAGE_VERSION@
16PACKAGE_STRING    = @PACKAGE_STRING@
17PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
18
19PACKAGE_FILENAME  = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
20
21INSTALL_SUBDIRS	= src man
22
23SUBDIRS		= src \
24		  test \
25		  scripts \
26		  doc \
27		  man \
28		  benchmarks \
29		  examples
30
31GARBAGE		= pnetcdf_pc
32
33DIST_GARBAGE	= config.cache \
34		  config.status \
35		  config.log \
36		  macros.make \
37		  stamp-h \
38                  pnetcdf.pc \
39                  pnetcdf-config \
40                  check_install
41
42PACKING_LIST	= Makefile.in \
43		  aclocal.m4 \
44		  configure \
45		  configure.in \
46		  macros.make.in \
47		  rules.make \
48		  COPYRIGHT \
49		  CREDITS \
50		  INSTALL \
51		  README \
52		  README.CRAY \
53                  README.Fujitsu \
54                  README.INTEL \
55		  README.IBM \
56                  README.K-Computer \
57		  README.LINUX \
58		  README.SGI \
59		  README.SX \
60                  README.consistency \
61		  README.large_files \
62		  RELEASE_NOTES \
63		  pbs.script \
64		  cobalt.script \
65		  stamp-h.in \
66                  pnetcdf_pc.in \
67                  pnetcdf-config.in \
68                  check_install.in
69
70PACKING_SUBDIRS	= $(SUBDIRS)
71
72all:
73	$(MAKE) $(MFLAGS) -C src
74
75TESTS_SUBDIRS = test examples benchmarks
76TESTS_DIRS = $(TESTS_SUBDIRS:%=tests-%)
77tests: $(TESTS_DIRS)
78$(TESTS_DIRS):
79	$(MAKE) $(MFLAGS) -C $(@:tests-%=%)
80
81check testing:
82	$(MAKE) $(MFLAGS) -C test testing
83
84verbose_check verbose_testing:
85	$(MAKE) $(MFLAGS) -C test verbose_testing
86
87PTEST_SUBDIRS = test examples benchmarks
88PTEST_DIRS = $(PTEST_SUBDIRS:%=ptest-%)
89ptest: tests $(PTEST_DIRS)
90$(PTEST_DIRS):
91ifeq (@enable_coverage@, yes)
92	echo "Parallel test is disabled because coverage analysis was enabled"
93else
94	$(MAKE) $(MFLAGS) -C $(@:ptest-%=%) ptest
95endif
96# make sure ptest runs one directory after another
97ptest-examples: ptest-test
98ptest-benchmarks: ptest-examples
99
100PTESTS_DIRS = $(PTEST_SUBDIRS:%=ptests-%)
101ptests: tests $(PTESTS_DIRS)
102$(PTESTS_DIRS):
103ifeq (@enable_coverage@, yes)
104	echo "Parallel test is disabled because coverage analysis was enabled"
105else
106	$(MAKE) $(MFLAGS) -C $(@:ptests-%=%) ptests
107endif
108# make sure ptests runs one directory after another
109ptests-examples: ptests-test
110ptests-benchmarks: ptests-examples
111
112INSTALLDIRS = $(INSTALL_SUBDIRS:%=install-%)
113install: $(INSTALLDIRS) install_PKGCONFIG install_CONFIG
114	@echo '+----------------------------------------------------------------------------+'
115	@echo '|'
116	@echo '|  PnetCDF has been successfully installed under $(prefix)'
117	@echo '|'
118	@echo '|  * PnetCDF header files are installed in $(prefix)/include'
119	@echo '|  * PnetCDF library file is installed in $(prefix)/lib'
120	@echo '|  * PnetCDF utility programs are installed in $(prefix)/bin'
121	@echo '|  * PnetCDF man pages are installed in $(prefix)/man/man1 and'
122	@echo '|    $(prefix)/man/man3'
123	@echo '|'
124	@echo '|  To compile your PnetCDF programs, please add the following to the command'
125	@echo '|  line, so the compiler can find the PnetCDF header files:'
126	@echo '|      -I$(prefix)/include'
127	@echo '|'
128	@echo '|  Add the following line to link your program to PnetCDF library:'
129	@echo '|      -L$(prefix)/lib -lpnetcdf'
130	@echo '|'
131	@echo '|  PnetCDF is jointly developed by a team at Northwestern University and'
132	@echo '|  Argonne National Laboratory.'
133	@echo '|'
134	@echo '|  Visit PnetCDF web sites for more information'
135	@echo '|      http://cucis.ece.northwestern.edu/projects/PnetCDF'
136	@echo '|      http://trac.mcs.anl.gov/projects/parallel-netcdf'
137	@echo '|'
138	@echo '+----------------------------------------------------------------------------+'
139
140$(INSTALLDIRS):
141	$(MAKE) $(MFLAGS) -C $(@:install-%=%) install
142
143PKGCONFIG_IN = pnetcdf_pc
144PKGCONFIG    = pnetcdf.pc
145
146install_PKGCONFIG:
147	$(RM) -f $(PKGCONFIG)
148	$(SED) -e "s%INSTALL_PREFIX%${prefix}%g" $(PKGCONFIG_IN) > $(PKGCONFIG)
149	$(INSTALL) -d -m 755 $(DESTDIR)$(PREFIX)/libdata/pkgconfig
150	$(INSTALL_DATA) $(PKGCONFIG) $(DESTDIR)$(PREFIX)/libdata/pkgconfig/$(PKGCONFIG)
151
152install_CONFIG:
153	$(INSTALL) -d $(BINDIR)
154	$(INSTALL) -m 755 pnetcdf-config $(BINDIR)/pnetcdf-config
155
156UNINSTALLDIRS = $(INSTALL_SUBDIRS:%=uninstall-%)
157uninstall: $(UNINSTALLDIRS) uninstall_PKGCONFIG uninstall_CONFIG
158$(UNINSTALLDIRS):
159	$(MAKE) $(MFLAGS) -C $(@:uninstall-%=%) uninstall
160
161uninstall_PKGCONFIG:
162	$(RM) -f $(PREFIX)/libdata/pkgconfig/$(PKGCONFIG)
163
164uninstall_CONFIG:
165	$(RM) -f $(BINDIR)/pnetcdf-config
166
167################################################################################
168# Distribution:
169
170# The following rule checks to see that were on the right system.  If we're
171# not, then the distribution mightn't contain the intended ncgen(1) (not
172# to mention that dvips(1) is necessary for building the C++ User's Guide).
173#
174check_system:	FORCE
175	@case "$(OVERRIDE)" in \
176	'') case `uname -sr` in \
177	    'SunOS 5'*) \
178		exit 0;; \
179	    *)  echo 1>&2 "Error: Not on a SunOS 5 system."; \
180		echo 1>&2 "Set macro OVERRIDE to override."; \
181		exit 1;; \
182	    esac;; \
183	*) exit 0;; \
184	esac
185
186# Make a compressed, tar(1) file of the source distribution in the current
187# directory.
188#
189tar.Z:		check_system FORCE
190	$(MAKE) $(MFLAGS) $(PACKAGE_FILENAME).tar.Z
191
192dist: ensure_manifest MANIFEST
193	id=$(PACKAGE_FILENAME) \
194	&& $(RM) -fr $$id \
195	&& $(LN_S) $(srcdir) $$id \
196	&& tar $(TARFLAGS) - `$(SED) "s|^|$$id/|" MANIFEST` | gzip  > $(PACKAGE_FILENAME).tar.gz \
197	&& tar $(TARFLAGS) - `$(SED) "s|^|$$id/|" MANIFEST` | bzip2 > $(PACKAGE_FILENAME).tar.bz2 \
198	&& $(RM) -f $$id MANIFEST
199
200MANIFEST:	FORCE
201	$(MAKE) $(MFLAGS) -s MANIFEST.echo >$@
202
203# Make a compressed, tar(1) file of the source distribution in the
204# appropriate FTP directory.
205#
206# NOTE: Making "ftp" will cause the "tar.Z" file to be made even if it
207# already exists.  This is because the MANIFEST file upon which it
208# depends must be remade every time.  This is not a waste of time,
209# however, if the "tar.Z" target is made in private directories and the
210# "ftp" target is made in the "/upc/$(PACKAGE_FILENAME)/build/" directory.
211#
212ftp:		check_system FORCE
213	$(MAKE) $(MFLAGS) $(FTPDIR)/$(PACKAGE_FILENAME).tar.Z \
214	test -r $(FTPDIR)/$(PACKAGE_FILENAME).tar.Z || exit 0; \
215	    cd $(FTPDIR) || exit 1;
216
217$(FTPDIR)/$(PACKAGE_FILENAME).tar.Z:	$(PACKAGE_FILENAME).tar.Z
218	$(RM) -f $@
219	cp $(PACKAGE_FILENAME).tar.Z $@
220	chmod u+rw,g+rw,o=r $@
221
222# Make a compressed, tar(1) file of the binary distribution in the
223# appropriate FTP directory.
224#
225binftp:		FORCE
226	$(MAKE) $(MFLAGS) $(FTPBINDIR)/$(PACKAGE_FILENAME).tar.Z \
227
228ftpbin:		binftp
229
230$(FTPBINDIR)/$(PACKAGE_FILENAME).tar.Z:
231	$(RM) -f $@
232	id=$(PACKAGE_FILENAME) \
233	&& $(RM) -f $$id \
234	&& $(LN_S) $(prefix) $$id \
235	&& tar $(TARFLAGS) - README $$id/bin $$id/include \
236	    $$id/lib $$id/man | compress > $@ \
237	&& $(RM) -f $$id
238	chmod u+rw,g+rw,o=r $@
239	test -r $(FTPBINDIR)/$(PACKAGE_FILENAME).tar.Z || exit 0; \
240	    cd $(FTPBINDIR) || exit 1;
241
242
243# rule for generating cscope information
244cscope:
245	find $(srcdir) -iname "*.[ch]" > $(srcdir)/cscope.files
246	( cd $(srcdir); cscope -be -i $(srcdir)/cscope.files )
247
248# The following dependency is for configure.in and configure
249# See autoconf manual 2.69, Section 4.8.5 Automatic Remaking
250$(srcdir)/configure: configure.in aclocal.m4
251	cd '$(srcdir)' && autoconf
252
253# autoheader might not change src/lib/ncconfig.h.in so touch a stamp file.
254$(srcdir)/src/lib/ncconfig.h.in: stamp-h.in
255$(srcdir)/stamp-h.in: configure.in aclocal.m4
256	cd '$(srcdir)' && autoheader
257	echo timestamp > '$(srcdir)/stamp-h.in'
258
259src/lib/ncconfig.h: stamp-h
260stamp-h: src/lib/ncconfig.h.in config.status
261	./config.status
262
263Makefile: Makefile.in config.status
264	./config.status
265
266config.status: configure
267	./config.status --recheck
268
269include $(srcdir)/rules.make
270
271
272