From 1983364a101d9543f6d80c45b968aa194e023288 Mon Sep 17 00:00:00 2001
From: Yaroslav Halchenko <debian@onerussian.com>
Date: Fri, 19 Feb 2016 05:06:24 +0000
Subject: [PATCH] BF: adjusted use of $(DESTDIR) so installs fine under DESTDIR

---
 BrainstemSS/Makefile.am                                         | 4 ++--
 BrainstemSS/linux_x86_64/Makefile.am                            | 4 ++--
 GEMS/data/Makefile.am                                           | 4 ++--
 HippoSF/Makefile.am                                             | 4 ++--
 HippoSF/linux_x86_64/Makefile.am                                | 4 ++--
 distribution/average/Buckner_JNeurophysiol11_MNI152/Makefile.am | 4 ++--
 distribution/average/Choi_JNeurophysiol12_MNI152/Makefile.am    | 4 ++--
 distribution/average/Makefile.am                                | 4 ++--
 distribution/average/Yeo_JNeurophysiol11_MNI152/Makefile.am     | 4 ++--
 distribution/average/surf/Makefile.am                           | 4 ++--
 distribution/fsafd/Makefile.am                                  | 4 ++--
 distribution/fsl-extra/Makefile.am                              | 2 +-
 distribution/lib/bem/Makefile.am                                | 4 ++--
 distribution/subjects/Makefile.am                               | 4 ++--
 fsfast/docs/Makefile.am                                         | 4 ++--
 images/Makefile.am                                              | 4 ++--
 matlab/Makefile.am                                              | 8 ++++----
 mri_cvs_register/Makefile.am                                    | 2 +-
 qdec/Makefile.am                                                | 8 ++++----
 talairach_avi/Makefile.am                                       | 4 ++--
 20 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/BrainstemSS/Makefile.am b/BrainstemSS/Makefile.am
index d0d505e..3bcf40e 100644
--- a/BrainstemSS/Makefile.am
+++ b/BrainstemSS/Makefile.am
@@ -21,8 +21,8 @@ segmentBS.sh \
 quantifyBrainstemStructures.sh
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/BrainstemSS/linux_x86_64/Makefile.am b/BrainstemSS/linux_x86_64/Makefile.am
index 3543581..0f47fd7 100644
--- a/BrainstemSS/linux_x86_64/Makefile.am
+++ b/BrainstemSS/linux_x86_64/Makefile.am
@@ -17,8 +17,8 @@ foo_binaryfiles = \
 	SegmentSubject.bin
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL) -m 755 $(foo_binaryfiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL) -m 755 $(foo_binaryfiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/GEMS/data/Makefile.am b/GEMS/data/Makefile.am
index 97a7eb1..cf29198 100644
--- a/GEMS/data/Makefile.am
+++ b/GEMS/data/Makefile.am
@@ -15,8 +15,8 @@ kvlQuantifyHippocampalSubfieldSegmentations.sh.help.xml \
 kvlSegmentHippocampalSubfields.sh.help.xml
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/HippoSF/Makefile.am b/HippoSF/Makefile.am
index 8e015d0..63b4d50 100644
--- a/HippoSF/Makefile.am
+++ b/HippoSF/Makefile.am
@@ -23,8 +23,8 @@ segmentSF_T2.sh \
 quantifyHippocampalSubfields.sh
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/HippoSF/linux_x86_64/Makefile.am b/HippoSF/linux_x86_64/Makefile.am
index 9007d0d..2306657 100644
--- a/HippoSF/linux_x86_64/Makefile.am
+++ b/HippoSF/linux_x86_64/Makefile.am
@@ -21,8 +21,8 @@ foo_binaryfiles = \
 	segmentSubjectT2_autoEstimateAlveusML
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL) -m 755 $(foo_binaryfiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL) -m 755 $(foo_binaryfiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/distribution/average/Buckner_JNeurophysiol11_MNI152/Makefile.am b/distribution/average/Buckner_JNeurophysiol11_MNI152/Makefile.am
index b7fe23b..ab43a5f 100644
--- a/distribution/average/Buckner_JNeurophysiol11_MNI152/Makefile.am
+++ b/distribution/average/Buckner_JNeurophysiol11_MNI152/Makefile.am
@@ -19,8 +19,8 @@ Buckner_JNeurophysiol11_MNI152_README
 
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/distribution/average/Choi_JNeurophysiol12_MNI152/Makefile.am b/distribution/average/Choi_JNeurophysiol12_MNI152/Makefile.am
index 9013ee3..dbb0d3e 100644
--- a/distribution/average/Choi_JNeurophysiol12_MNI152/Makefile.am
+++ b/distribution/average/Choi_JNeurophysiol12_MNI152/Makefile.am
@@ -18,8 +18,8 @@ Choi_JNeurophysiol12_MNI152_README \
 FSL_MNI152_FreeSurferConformed_1mm.nii.gz
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/distribution/average/Makefile.am b/distribution/average/Makefile.am
index d821bb3..5820c63 100644
--- a/distribution/average/Makefile.am
+++ b/distribution/average/Makefile.am
@@ -101,8 +101,8 @@ foo_otherdatafiles=fsaverage.tar.gz fsaverage_sym.tar.gz \
 
 
 install:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 	mkdir -p $(DESTDIR)$(prefix)/subjects
 	rm -Rf $(DESTDIR)$(prefix)/subjects/cvs_avg35
 	rm -Rf $(top_builddir)/distribution/average/cvs_avg35
diff --git a/distribution/average/Yeo_JNeurophysiol11_MNI152/Makefile.am b/distribution/average/Yeo_JNeurophysiol11_MNI152/Makefile.am
index 10a7cc8..a34bb28 100644
--- a/distribution/average/Yeo_JNeurophysiol11_MNI152/Makefile.am
+++ b/distribution/average/Yeo_JNeurophysiol11_MNI152/Makefile.am
@@ -10,8 +10,8 @@ Yeo2011_17Networks_MNI152_FreeSurferConformed1mm.nii.gz Yeo2011_7Networks_ColorL
 Yeo2011_7Networks_MNI152_FreeSurferConformed1mm_LiberalMask.nii.gz Yeo2011_7Networks_MNI152_FreeSurferConformed1mm.nii.gz
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/distribution/average/surf/Makefile.am b/distribution/average/surf/Makefile.am
index 8545083..0b7f373 100644
--- a/distribution/average/surf/Makefile.am
+++ b/distribution/average/surf/Makefile.am
@@ -11,8 +11,8 @@ lh.sphere.ico2.reg  lh.sphere.ico6.reg  rh.sphere.ico2.reg  rh.sphere.ico6.reg \
 lh.sphere.ico3.reg  lh.sphere.ico7.reg  rh.sphere.ico3.reg  rh.sphere.ico7.reg
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/distribution/fsafd/Makefile.am b/distribution/fsafd/Makefile.am
index f5063c9..5df4ca1 100644
--- a/distribution/fsafd/Makefile.am
+++ b/distribution/fsafd/Makefile.am
@@ -24,8 +24,8 @@ foo_datafiles=TalairachingCovariance.adf \
 #	lh.ThicknessMatrix.mgh
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/distribution/fsl-extra/Makefile.am b/distribution/fsl-extra/Makefile.am
index ccb7ae6..9faa08e 100644
--- a/distribution/fsl-extra/Makefile.am
+++ b/distribution/fsl-extra/Makefile.am
@@ -2,7 +2,7 @@
 # Makefile.am
 #
 
-foodir=$(DESTDIR)$(bindir)
+foodir=$(bindir)
 foo_DATA=flirt.newdefault.20080811.sch
 
 EXTRA_DIST=$(foo_DATA)
diff --git a/distribution/lib/bem/Makefile.am b/distribution/lib/bem/Makefile.am
index d10f998..ae9a267 100644
--- a/distribution/lib/bem/Makefile.am
+++ b/distribution/lib/bem/Makefile.am
@@ -8,8 +8,8 @@ foo_datafiles=\
 	inner_skull.dat outer_skull.dat outer_skin.dat
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-		$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+		$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/distribution/subjects/Makefile.am b/distribution/subjects/Makefile.am
index 6ba5738..5c6aa63 100644
--- a/distribution/subjects/Makefile.am
+++ b/distribution/subjects/Makefile.am
@@ -6,8 +6,8 @@ foodir=$(prefix)/subjects
 foo_datafiles=README sample-001.mgz sample-002.mgz
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-		$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+		$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/fsfast/docs/Makefile.am b/fsfast/docs/Makefile.am
index e9b419a..d234d05 100644
--- a/fsfast/docs/Makefile.am
+++ b/fsfast/docs/Makefile.am
@@ -49,8 +49,8 @@ distclean-local:
 	rm -f Makefile
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/images/Makefile.am b/images/Makefile.am
index fad9850..8c5d5ad 100644
--- a/images/Makefile.am
+++ b/images/Makefile.am
@@ -147,8 +147,8 @@ foo_datafiles= $(GIF) $(TIF) \
 	icon_fill_volume.png icon_label_table.xpm
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-		$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+		$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
diff --git a/matlab/Makefile.am b/matlab/Makefile.am
index ede9928..83cf430 100644
--- a/matlab/Makefile.am
+++ b/matlab/Makefile.am
@@ -285,10 +285,10 @@ survivalunifiles_DATA=\
 foo_datafiles=lme/geodesic/geodesic_src.tar.gz
 
 install-data-local:
-	test -z $(survivalexdatafilesdir) || $(mkdir_p) $(survivalexdatafilesdir)
-	$(INSTALL_DATA) $(survivalexdatafiles_datafiles) $(survivalexdatafilesdir)
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(survivalexdatafilesdir) || $(mkdir_p) $(DESTDIR)$(survivalexdatafilesdir)
+	$(INSTALL_DATA) $(survivalexdatafiles_datafiles) $(DESTDIR)$(survivalexdatafilesdir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 
 
diff --git a/mri_cvs_register/Makefile.am b/mri_cvs_register/Makefile.am
index 6d0c017..0a24c3d 100644
--- a/mri_cvs_register/Makefile.am
+++ b/mri_cvs_register/Makefile.am
@@ -4,7 +4,7 @@
 
 dist_bin_SCRIPTS = mri_cvs_register mri_cvs_check mri_cvs_data_copy
 
-foodir=$(DESTDIR)$(bindir)
+foodir=$(bindir)
 foo_DATA= \
 	id.xfm \
 	mri_cvs_requiredfiles.txt
diff --git a/qdec/Makefile.am b/qdec/Makefile.am
index 57cc7e1..c9436e1 100644
--- a/qdec/Makefile.am
+++ b/qdec/Makefile.am
@@ -86,8 +86,8 @@ install-exec-hook:qdec
 	/usr/pubsw/bin/chrpath -d $(DESTDIR)$(bindir)/qdec.bin; fi
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-		$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+		$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 uninstall-hook:
 	rm -f $(DESTDIR)$(bindir)/qdec.bin
@@ -147,8 +147,8 @@ install-exec-hook:
 	/usr/pubsw/bin/chrpath -d $(DESTDIR)$(bindir)/qdec.bin; fi
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-		$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+		$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 uninstall-hook:
 	rm -f $(DESTDIR)$(bindir)/qdec.bin
diff --git a/talairach_avi/Makefile.am b/talairach_avi/Makefile.am
index a3231c6..32e2999 100644
--- a/talairach_avi/Makefile.am
+++ b/talairach_avi/Makefile.am
@@ -267,8 +267,8 @@ copy_ffiles_from_src:
 	done;
 
 install-data-local:
-	test -z $(foodir) || $(mkdir_p) $(foodir)
-	$(INSTALL_DATA) $(foo_datafiles) $(foodir)
+	test -z $(DESTDIR)$(foodir) || $(mkdir_p) $(DESTDIR)$(foodir)
+	$(INSTALL_DATA) $(foo_datafiles) $(DESTDIR)$(foodir)
 
 # Our release target. Include files to be excluded here. They will be
 # found and removed after 'make install' is run during the 'make
-- 
1.9.1

