Makefile.ligosoftware_gcc_deps 16.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
SHELL := /bin/bash # Use bash syntax
#
# To run: make env.sh, then source the resulting environment file and run: make
#
# Example command:
# make deps_env.sh -f Makefile.ligosoftware_gcc_deps
# source deps_env.sh
# time make gds -f Makefile.ligosoftware_gcc_deps 1> make.out 2> make.err
#
# If you would like to rebuild only part of the software stack, but it starts
# from the beginning if using the above command, then use the touch (-t) option
# on the previous package.
#
# Example: Rebuild gstreamer:
# make gsl -f Makefile.ligosoftware_gcc_deps -t
# make gstreamer -f Makefile.ligosoftware_gcc_deps

# Determine cluster
CLUSTER:=$(shell hostname -d)

# Set directories and paths
SRC_DIR:=${PWD}/src
TAR_DIR:=tarball
LOGS_DIR:=logs
PATCH_DIR:=${PWD}/patches
INSTALL_DIR:=${DEPS_PATH}
ifeq ($(findstring debian,$(shell cat /etc/os-release | grep ID=)),debian)
	PYTHON_LIB_DIR:=/usr/lib/python2.7/config-x86_64-linux-gnu
	PYTHON_DIR:=${DEPS_PATH}/lib/python2.7/site-packages
else
	PYTHON_LIB_DIR:=/usr/lib64
	PYTHON_DIR:=${DEPS_PATH}/lib64/python2.7/site-packages
endif

# Set package release versions
36 37 38
GDS=gds-2.18.17
LDASTOOLSFRAMECPP=ldas-tools-framecpp-2.6.5
LDASTOOLSAL=ldas-tools-al-2.6.2
39 40 41 42 43 44 45
SWIG=swig-3.0.7
METAIO=metaio-8.5.1
LIBFRAME=libframe-8.30
GSTPYTHON=gst-python-1.14.3
GSTPLUGINSGOOD=gst-plugins-good-1.14.3
GSTPLUGINSBASE=gst-plugins-base-1.14.3
GSTREAMER=gstreamer-1.14.3
46
GSL=gsl-1.16
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
ORC=orc-0.4.26
FFTW=fftw-3.3.8

# Specify target/dependancy files
GDS_TARGET=$(INSTALL_DIR)/lib/libwpipe.so
LDASTOOLSFRAMECPP_TARGET=$(INSTALL_DIR)/lib/libframecpp.so
LDASTOOLSAL_TARGET=$(INSTALL_DIR)/lib/libldastoolsal.so
SWIG_TARGET=$(INSTALL_DIR)/bin/swig
METAIO_TARGET=$(INSTALL_DIR)/lib/libmetaio.so
LIBFRAME_TARGET=$(INSTALL_DIR)/lib/libFrame.so
GSTPYTHON_TARGET=$(INSTALL_DIR)/lib/gstreamer-1.0/libgstpythonplugin.so
GSTGOOD_TARGET=$(INSTALL_DIR)/lib/gstreamer-1.0/libgstpng.so
GSTBASE_TARGET=$(INSTALL_DIR)/lib/libgstapp-1.0.so
GSTREAMER_TARGET=$(INSTALL_DIR)/lib/libgstreamer-1.0.so
GSL_2_TARGET=$(INSTALL_DIR)/lib/pkgconfig/gsl.pc.orig
GSL_1_TARGET=$(INSTALL_DIR)/lib/libgsl.so
ORC_TARGET=$(INSTALL_DIR)/lib/liborc-0.4.so
FFTW_TARGET=$(INSTALL_DIR)/lib/libfftw3.so

# tarballs
GDS_TAR_TARGET=$(TAR_DIR)/$(GDS).tar.gz
LDASTOOLSFRAMECPP_TAR_TARGET=$(TAR_DIR)/$(LDASTOOLSFRAMECPP).tar.gz
LDASTOOLSAL_TAR_TARGET=$(TAR_DIR)/$(LDASTOOLSAL).tar.gz
SWIG_TAR_TARGET=$(TAR_DIR)/$(SWIG).tar.gz
METAIO_TAR_TARGET=$(TAR_DIR)/$(METAIO).tar.gz
LIBFRAME_TAR_TARGET=$(TAR_DIR)/$(LIBFRAME).tar.gz
GSTPYTHON_TAR_TARGET=$(TAR_DIR)/$(GSTPYTHON).tar.xz
GSTGOOD_TAR_TARGET=$(TAR_DIR)/$(GSTPLUGINSGOOD).tar.xz
GSTBASE_TAR_TARGET=$(TAR_DIR)/$(GSTPLUGINSBASE).tar.xz
GSTREAMER_TAR_TARGET=$(TAR_DIR)/$(GSTREAMER).tar.xz
GSL_TAR_TARGET=$(TAR_DIR)/$(GSL).tar.gz
ORC_TAR_TARGET=$(TAR_DIR)/$(ORC).tar.xz
FFTW_TAR_TARGET=$(TAR_DIR)/$(FFTW).tar.gz

# Specify how many processors to run on
#CORES:=$(shell echo `nproc --all`"-2" | bc -l)
CORES:=8

# Escape code
esc=`echo -en "\033"`

# Set colors
RED="${esc}[0;31m"
GREEN="${esc}[0;32m"
YELLOW="${esc}[0;33m"
BLUE="${esc}[0;34m"
WHITE="${esc}[m"

ICC_CIT:=/ldcg/intel/2018u3/bin/compilervars.sh
ICC_LHO:=/ldcg/intel/2018u3/bin/compilervars.sh
ICC_LLO:=/ldcg/intel/2018u3/bin/compilervars.sh
ICC_UWM:=/opt/intel/2018u3/bin/compilervars.sh
ICC_PSU:=/ligo/apps/intel/2017u4/bin/compilervars.sh

all : logs/gds.txt src/kafka_2.11-2.0.0

#####################
# Environment setup #
#####################

deps_env.sh :
	@echo 'unset GST_PLUGIN_PATH PYTHONPATH' > $@
	@echo 'unset LD_LIBRARY_PATH LIBRARY_PATH LD_PRELOAD' >> $@
	@echo 'DEPS_PATH=${PWD}/opt' >> $@
111 112 113
	@echo 'export LDMKLFLAGS=" -L$${MKLROOT}/lib/intel64 -lmkl_rt -lpthread -limf -ldl"' >> $@
	@echo 'export GCCLDMKLFLAGS=" -L$${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_rt -lpthread -limf -ldl"' >> $@
	@echo 'export GCCFLAGS="-fPIC -O3 -march=native -I$${MKLROOT}/include -I$${DEPS_PATH}/include"' >> $@
114 115 116 117 118 119 120 121 122 123 124 125 126
	@echo 'export CFLAGS=$${GCCFLAGS}' >> $@
	@if [[ ${CLUSTER} == *"ligo.caltech.edu" ]] ; then \
		echo "source ${ICC_CIT} intel64" >> $@ ; \
		echo 'LDFLAGS_INTEL="$${GCCLDMKLFLAGS}"' >> $@ ; \
	elif [[ ${CLUSTER} == *"ligo-wa.caltech.edu" ]] ; then \
		echo "source ${ICC_LHO} intel64" >> $@ ; \
		echo 'LDFLAGS_INTEL="$${GCCLDMKLFLAGS}"' >> $@ ; \
	elif [[ ${CLUSTER} == *"ligo-la.caltech.edu" ]] ; then \
		echo "source ${ICC_LLO} intel64" >> $@ ; \
		echo 'LDFLAGS_INTEL="$${GCCLDMKLFLAGS}"' >> $@ ; \
	elif [[ ${CLUSTER} == *"nemo.uwm.edu" ]] ; then \
		echo "source ${ICC_UWM} intel64" >> $@ ; \
		echo 'LDFLAGS_INTEL="$${GCCLDMKLFLAGS}"' >> $@ ; \
127 128
    elif [[ ${CLUSTER} == *"psu.edu" ]] ; then \
        echo "source /opt/rh/devtoolset-7/enable" >> $@ ; \
129 130 131 132 133 134 135 136 137
		echo "source ${ICC_PSU} intel64" >> $@ ; \
		echo 'export LIBRARY_PATH=$${LD_LIBRARY_PATH}' >> $@ ; \
		echo 'LDFLAGS_INTEL="$${GCCLDMKLFLAGS}"' >> $@ ; \
	fi
	@echo 'export LD_LIBRARY_PATH=$${DEPS_PATH}/lib:$${LD_LIBRARY_PATH}' >> $@
	@echo 'export LIBRARY_PATH=$${DEPS_PATH}/lib:$${LIBRARY_PATH}' >> $@
	@echo 'export CC="gcc"' >> $@
	@echo 'export CXX="g++"' >> $@
	@echo 'export MKL_THREADING_LAYER=SEQUENTIAL' >> $@
138
	@echo 'export MKL_INTERFACE_LAYER=LP64' >> $@
139
	@echo '# Force explicit linking of optimized FFTW libraries:' >> $@
140
	@echo 'LDFLAGS="-l:libfftw3.so -l:libfftw3f.so -l:libfftw3_threads.so -l:libfftw3f_threads.so $${LDFLAGS_INTEL} -L$${DEPS_PATH}/opt/lib "' >> $@
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
	@echo '# These are environment variables that do get exported' >> $@
	@echo 'PATH=$${DEPS_PATH}/bin:$${PATH}' >> $@
	@echo 'PKG_CONFIG_PATH=$${DEPS_PATH}/lib/pkgconfig:$${DEPS_PATH}/lib64/pkgconfig:$${PKG_CONFIG_PATH}' >> $@
	@echo 'PYTHONPATH=$${DEPS_PATH}/lib/python2.7/site-packages:$${DEPS_PATH}/lib64/python2.7/site-packages' >> $@
	@echo 'LAL_DATA_PATH=/home/cbc/ROM_data' >> $@
	@echo 'GST_PLUGIN_PATH=$${DEPS_PATH}/lib/gstreamer-1.0' >> $@
	@echo 'GST_REGISTRY_1_0=$${DEPS_PATH}/registry.bin' >> $@
	@echo 'GI_TYPELIB_PATH=$${DEPS_PATH}/lib/girepository-1.0:$${GI_TYPELIB_PATH}' >> $@
	@echo 'KAFKA_JVM_PERFORMANCE_OPTS="-server -XX:MetaspaceSize=96m -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:G1HeapRegionSize=16M -XX:MinMetaspaceFreeRatio=50 -XX:MaxMetaspaceFreeRatio=80"' >> $@
	@echo 'KAFKA_HEAP_OPTS="-Xms8G -Xmx8G"' >> $@
	@echo 'export PATH PKG_CONFIG_PATH PYTHONPATH GST_PLUGIN_PATH DEPS_PATH LDFLAGS LDFLAGS_INTEL LAL_DATA_PATH GST_REGISTRY_1_0 GI_TYPELIB_PATH KAFKA_JVM_PERFORMANCE_OPTS KAFKA_HEAP_OPTS' >> $@

###########
# Install #
###########

src:
	mkdir -p $@

opt/bin:
	mkdir -p $@/bin

opt/config:
	mkdir -p $@/config

opt/libs:
	mkdir -p $@/libs

tarball:
	mkdir -p $@

# KAFKA
tarball/kafka_2.11-2.0.0.tgz: tarball
174
	wget -nc -P tarball https://archive.apache.org/dist/kafka/2.0.0/kafka_2.11-2.0.0.tgz
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198

src/kafka_2.11-2.0.0: tarball/kafka_2.11-2.0.0.tgz src opt/bin opt/config opt/libs
	cd src && tar -xzf ../tarball/kafka_2.11-2.0.0.tgz && cd .. && cp -r src/kafka_2.11-2.0.0/bin/* opt/bin/. && cp src/kafka_2.11-2.0.0/libs/* opt/libs/. && cp src/kafka_2.11-2.0.0/config/* opt/config/.

#####################
# Check time stamps #
#####################

check :
	@if [ -f logs/all.txt ] ; then rm logs/all.txt ; fi ;
	@cat logs/* | uniq > logs/all.txt
	@if [ -f logs/gds.txt ] ; then ls logs/gds.txt >> logs/all.txt ; fi ;
	@ls -ltrh $$(cat logs/all.txt)

# gds
gds : logs/gds.txt

logs/gds.txt : $(LOGS_DIR)/ldas-tools-framecpp.txt $(GDS_TARGET)
	@echo $^ | sed -e "s@ @\n@g" > $@

$(GDS_TARGET) : $(LDASTOOLSFRAMECPP_TARGET)
	@echo $(GREEN)gds$(WHITE) 1>&2
	tar -xzf $(TAR_DIR)/$(GDS).tar.gz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(GDS) && ./configure --enable-online --prefix=$(INSTALL_DIR)
199
	cd $(SRC_DIR)/$(GDS) && make -j$(CORES) && make install -j$(CORES)
200 201 202 203 204 205 206 207 208 209

# ldas-tools-framecpp
ldas-tools-framecpp : logs/ldas-tools-framecpp.txt

logs/ldas-tools-framecpp.txt : $(LOGS_DIR)/ldas-tools-al.txt $(LDASTOOLSFRAMECPP_TARGET)
	@echo $^ | sed -e "s@ @\n@g" > $@

$(LDASTOOLSFRAMECPP_TARGET) : $(LDASTOOLSAL_TARGET)
	@echo $(GREEN)ldas-tools-frmecpp$(WHITE) 1>&2
	tar -xf $(TAR_DIR)/$(LDASTOOLSFRAMECPP).tar.gz -C $(SRC_DIR)
210
	cd $(SRC_DIR)/$(LDASTOOLSFRAMECPP) && ./configure --prefix=$(INSTALL_DIR) --without-doxygen
211 212 213 214 215 216 217 218 219 220 221
	cd $(SRC_DIR)/$(LDASTOOLSFRAMECPP) && make && make install 

# ldas-tools-al
ldas-tools-al : logs/ldas-tools-al.txt

logs/ldas-tools-al.txt : $(LOGS_DIR)/swig.txt $(LDASTOOLSAL_TARGET)
	@echo $^ | sed -e "s@ @\n@g" > $@

$(LDASTOOLSAL_TARGET) : $(SWIG_TARGET)
	@echo $(GREEN)ldas-tools-al$(WHITE) 1>&2
	tar -xf $(TAR_DIR)/$(LDASTOOLSAL).tar.gz -C $(SRC_DIR)
222
	cd $(SRC_DIR)/$(LDASTOOLSAL) && ./configure --prefix=$(INSTALL_DIR) --without-doxygen
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
	cd $(SRC_DIR)/$(LDASTOOLSAL) && make -j$(CORES) && make install -j$(CORES)

# swig
swig : logs/swig.txt

logs/swig.txt : $(LOGS_DIR)/metaio.txt $(SWIG_TARGET)
	@echo $^ | sed -e "s@ @\n@g" > $@

$(SWIG_TARGET) : $(METAIO_TARGET)
	@echo $(GREEN)swig$(WHITE) 1>&2
	tar -xf $(TAR_DIR)/$(SWIG).tar.gz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(SWIG) && ./configure --prefix=$(INSTALL_DIR)
	cd $(SRC_DIR)/$(SWIG) && make -j$(CORES) && make install -j$(CORES)

# metaio
metaio : logs/metaio.txt

logs/metaio.txt : $(LOGS_DIR)/libframe.txt $(METAIO_TARGET)
	@echo $^ | sed -e "s@ @\n@g" > $@

$(METAIO_TARGET) : $(LIBFRAME_TARGET)
	@echo $(GREEN)metaio$(WHITE) 1>&2
	tar -xf $(TAR_DIR)/$(METAIO).tar.gz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(METAIO) && ./configure --prefix=$(INSTALL_DIR) --with-matlab=no
	cd $(SRC_DIR)/$(METAIO) && make -j$(CORES) && make install -j$(CORES)
	# Needed with-matlab option for intel_haswell test

# libframe
libframe : logs/libframe.txt

logs/libframe.txt : $(LOGS_DIR)/gstreamer.txt $(LIBFRAME_TARGET)
	@echo $^ | sed -e "s@ @\n@g" > $@

$(LIBFRAME_TARGET) : $(GSTPYTHON_TARGET)
	@echo $(GREEN)libframe$(WHITE) 1>&2
	tar -xf $(TAR_DIR)/$(LIBFRAME).tar.gz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(LIBFRAME) && ./configure --prefix=$(INSTALL_DIR)
	cd $(SRC_DIR)/$(LIBFRAME) && make -j$(CORES) && make install -j$(CORES)

# gstreamer (all)
gstreamer : logs/gstreamer.txt

logs/gstreamer.txt : $(LOGS_DIR)/gsl.txt $(GSTREAMER_TARGET) $(GSTBASE_TARGET) $(GSTGOOD_TARGET) $(GSTPYTHON_TARGET)
	@echo $^ | sed -e "s@ @\n@g" > $@

# gstreamer plugin python
$(GSTPYTHON_TARGET) : $(GSTGOOD_TARGET)
	@echo $(GREEN)gst-python$(WHITE) 1>&2
	#mkdir -p $(INSTALL_DIR)/lib64/python2.7/site-packages/gi/overrides
	tar -xf $(TAR_DIR)/$(GSTPYTHON).tar.xz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(GSTPYTHON) && ./configure --prefix=$(INSTALL_DIR) --exec-prefix=$(INSTALL_DIR) --with-libpython-dir=$(PYTHON_LIB_DIR) --with-pygi-overrides-dir=$(INSTALL_DIR)/lib/python2.7/site-packages/gi/overrides
	cd $(SRC_DIR)/$(GSTPYTHON) && make -j$(CORES) && make install -j$(CORES)

# gstreamer plugin good
$(GSTGOOD_TARGET) : $(GSTBASE_TARGET)
	@echo $(GREEN)gst-good$(WHITE) 1>&2
	tar -xf $(TAR_DIR)/$(GSTPLUGINSGOOD).tar.xz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(GSTPLUGINSGOOD) && ./configure --disable-gst_v4l2 --prefix=$(INSTALL_DIR)
	cd $(SRC_DIR)/$(GSTPLUGINSGOOD) && make -j$(CORES) && make install -j$(CORES)

# gstreamer plugin base
$(GSTBASE_TARGET) : $(GSTREAMER_TARGET)
	@echo $(GREEN)gst-base$(WHITE) 1>&2
	tar -xf $(TAR_DIR)/$(GSTPLUGINSBASE).tar.xz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(GSTPLUGINSBASE) && ./configure --prefix=$(INSTALL_DIR)
	cd $(SRC_DIR)/$(GSTPLUGINSBASE) && make -j$(CORES) && make install -j$(CORES)

# gstreamer
$(GSTREAMER_TARGET) : logs/gsl.txt
	@echo $(GREEN)gstreamer$(WHITE) 1>&2
	tar -xf $(TAR_DIR)/$(GSTREAMER).tar.xz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(GSTREAMER) && ./configure --prefix=$(INSTALL_DIR)
	cd $(SRC_DIR)/$(GSTREAMER) && make -j$(CORES) && make install -j$(CORES)

# GSL
gsl : logs/gsl.txt

logs/gsl.txt : $(LOGS_DIR)/orc.txt $(GSL_1_TARGET) $(GSL_2_TARGET)
	@echo $^ | sed -e "s@ @\n@g" > $@

## FIXME Hack to make gsl default to atlas for blas
$(GSL_2_TARGET) : $(GSL_1_TARGET)
	cp $(INSTALL_DIR)/lib/pkgconfig/gsl.pc $@
	sed 's:-lgslcblas: $(LDMKLFLAGS):' $@ > $(INSTALL_DIR)/lib/pkgconfig/gsl.pc

$(GSL_1_TARGET) : $(ORC_TARGET)
	@echo $(GREEN)gsl$(WHITE) 1>&2
	tar -xf $(TAR_DIR)/$(GSL).tar.gz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(GSL) && ./configure --prefix=$(INSTALL_DIR)  GSL_CBLAS_LIB='$(LDMKLFLAGS)'
	cd $(SRC_DIR)/$(GSL) && make -j$(CORES) && make install -j$(CORES)

# ORC
orc : logs/orc.txt

logs/orc.txt : $(LOGS_DIR)/fftw.txt $(ORC_TARGET)
	@echo $^ | sed -e "s@ @\n@g" > $@

$(ORC_TARGET) : $(FFTW_TARGET)
	@echo $(GREEN)orc$(WHITE) 1>&2
	tar -xf $(TAR_DIR)/$(ORC).tar.xz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(ORC) && ./configure --prefix=$(INSTALL_DIR)
	cd $(SRC_DIR)/$(ORC) && make -j$(CORES) && make install -j$(CORES)


# fftw
fftw : logs/fftw.txt

logs/fftw.txt : $(LOGS_DIR)/patch.txt $(FFTW_TARGET)
	@echo $^ | sed -e "s@ @\n@g" > $@

# ./configure, make, make install run thrice to install single and double precision, and long double libs 
$(FFTW_TARGET) : $(LOGS_DIR)/patch.txt
	@echo $(GREEN)fftw$(WHITE) 1>&2
	tar -xzf $(TAR_DIR)/$(FFTW).tar.gz -C $(SRC_DIR)
	cd $(SRC_DIR)/$(FFTW) && \
		./configure LDFLAGS="${LDFLAGS_INTEL}" --enable-shared --enable-sse --enable-sse2 --enable-avx --enable-float --enable-fma --enable-avx2 --enable-threads --prefix=$(INSTALL_DIR) && \
		make -j$(CORES) && make install -j$(CORES) && make clean && \
		./configure LDFLAGS="${LDFLAGS_INTEL}" --enable-shared --enable-sse2 --enable-avx --enable-fma --enable-avx2 --enable-threads --prefix=$(INSTALL_DIR) && \
		make -j$(CORES) && make install -j$(CORES) && make clean && \
		./configure LDFLAGS="${LDFLAGS_INTEL}" --enable-shared --enable-fma --enable-threads --enable-long-double --prefix=$(INSTALL_DIR) && \
		make -j$(CORES) && make install -j$(CORES)

#########################
# Download the software #
#########################

# patches
patch : logs/patch.txt

logs/patch.txt : $(LOGS_DIR)/tar.txt
	echo $^ | sed -e "s@ @\n@g" > $@

#tarballs
logs/tar.txt : $(FFTW_TAR_TARGET) $(ORC_TAR_TARGET) $(GSL_TAR_TARGET) $(GSTREAMER_TAR_TARGET) $(GSTBASE_TAR_TARGET) $(GSTGOOD_TAR_TARGET) $(GSTPYTHON_TAR_TARGET) $(LIBFRAME_TAR_TARGET) $(METAIO_TAR_TARGET) $(SWIG_TAR_TARGET) $(LDASTOOLSAL_TAR_TARGET) $(LDASTOOLSFRAMECPP_TAR_TARGET) $(GDS_TAR_TARGET)
	echo $^ | sed -e "s@ @\n@g" > $@

$(GDS_TAR_TARGET) : $(LDASTOOLSFRAMECPP_TAR_TARGET)
	wget --no-check-certificate http://software.ligo.org/lscsoft/source/$(GDS).tar.gz --directory-prefix=$(TAR_DIR) -nc

$(LDASTOOLSFRAMECPP_TAR_TARGET) : $(LDASTOOLSAL_TAR_TARGET)
	wget --no-check-certificate http://software.ligo.org/lscsoft/source/$(LDASTOOLSFRAMECPP).tar.gz --directory-prefix=$(TAR_DIR) -nc

$(LDASTOOLSAL_TAR_TARGET) : $(SWIG_TAR_TARGET)
	wget --no-check-certificate http://software.ligo.org/lscsoft/source/$(LDASTOOLSAL).tar.gz --directory-prefix=$(TAR_DIR) -nc

$(SWIG_TAR_TARGET) : $(METAIO_TAR_TARGET)
	wget --no-check-certificate http://downloads.sourceforge.net/project/swig/swig/$(SWIG)/$(SWIG).tar.gz --directory-prefix=$(TAR_DIR) -nc

$(METAIO_TAR_TARGET) : $(LIBFRAME_TAR_TARGET)
	wget --no-check-certificate http://software.ligo.org/lscsoft/source/$(METAIO).tar.gz --directory-prefix=$(TAR_DIR) -nc

$(LIBFRAME_TAR_TARGET) : $(GSTPYTHON_TAR_TARGET)
	wget --no-check-certificate http://lappweb.in2p3.fr/virgo/FrameL/$(LIBFRAME).tar.gz --directory-prefix=$(TAR_DIR) -nc

$(GSTPYTHON_TAR_TARGET) : $(GSTGOOD_TAR_TARGET)
	wget --no-check-certificate http://gstreamer.freedesktop.org/src/gst-python/$(GSTPYTHON).tar.xz --directory-prefix=$(TAR_DIR) -nc

$(GSTGOOD_TAR_TARGET) : $(GSTBASE_TAR_TARGET)
	wget --no-check-certificate http://gstreamer.freedesktop.org/src/gst-plugins-good/$(GSTPLUGINSGOOD).tar.xz --directory-prefix=$(TAR_DIR) -nc

$(GSTBASE_TAR_TARGET) : $(GSTREAMER_TAR_TARGET)
	wget --no-check-certificate http://gstreamer.freedesktop.org/src/gst-plugins-base/$(GSTPLUGINSBASE).tar.xz --directory-prefix=$(TAR_DIR) -nc

$(GSTREAMER_TAR_TARGET) : $(GSL_TAR_TARGET)
	wget --no-check-certificate http://gstreamer.freedesktop.org/src/gstreamer/$(GSTREAMER).tar.xz --directory-prefix=$(TAR_DIR) -nc

$(GSL_TAR_TARGET) : $(ORC_TAR_TARGET)
	wget --no-check-certificate http://ftp.gnu.org/gnu/gsl/$(GSL).tar.gz --directory-prefix=$(TAR_DIR) -nc

$(ORC_TAR_TARGET) : $(FFTW_TAR_TARGET)
	wget --no-check-certificate http://gstreamer.freedesktop.org/src/orc/$(ORC).tar.xz --directory-prefix=$(TAR_DIR) -nc

$(FFTW_TAR_TARGET) : $(LOGS_DIR)
	wget --no-check-certificate http://www.fftw.org/$(FFTW).tar.gz --directory-prefix=$(TAR_DIR) -nc

# git repos
$(LOGS_DIR) :
	mkdir -p $(SRC_DIR) $(INSTALL_DIR) $(PATCH_DIR) $(TAR_DIR) $(PYTHON_DIR)
	mkdir -p $(LOGS_DIR)

############
# Clean up #
############

clean-all :
	rm -rf $(SRC_DIR) $(INSTALL_DIR) $(PATCH_DIR) $(TAR_DIR) $(LOGS_DIR) $(PYTHON_DIR)
	rm -rf opt git
	rm -rf *.txt

clean-install :
	rm -rf opt/* logs/* src/*

clean-gds :
	rm -rf logs/gds.txt $(GDS_TARGET)

clean-ldas-tools-framecpp :
	rm -rf logs/ldas-tools-framecpp.txt $(LDASTOOLSFRAMECPP_TARGET)

clean-ldas-tools-al :
	rm -rf logs/ldas-tools-al.txt $(LDASTOOLSAL_TARGET)

clean-swig :
	rm -rf logs/swig.txt $(SWIG_TARGET)

clean-metaio :
	rm -rf logs/metaio.txt $(METAIO_TARGET)

clean-libframe :
	rm -rf logs/libframe.txt $(LIBFRAME_TARGET)

clean-gstreamer :
	rm -rf logs/gstreamer.txt $(GSTREAMER_TARGET) $(GSTBASE_TARGET) $(GSTGOOD_TARGET) $(GSTPYTHON_TARGET)

clean-gsl :
	rm -rf logs/gsl.txt $(GSL_1_TARGET) $(GSL_2_TARGET)

clean-orc :
	rm -rf logs/orc.txt $(ORC_TARGET)

clean-fftw :
	rm -rf logs/fftw.txt $(FFTW_TARGET)