<commit_before># Copyright (C) 2013 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
#   Licensed under the Apache License, Version 2.0 (the "License"); you may not
#   use this file except in compliance with the License. You may obtain a copy
#   of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#   WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#   License for the specific language governing permissions and limitations
#   under the License.

SHELL=/bin/bash -e

# If installing into the system directories you probably want to set
#   DESTDIR=/ PREFIX=/usr
ifndef DESTDIR
	export DESTDIR=/opt/dnanexus
endif
ifndef PREFIX
	export PREFIX=/
endif

export DNANEXUS_HOME=$(CURDIR)/..

# For parallel builds, add the following to your .bashrc or other build
# environment initialization file:
#
#   export MAKEFLAGS=-j8

all: api_wrappers cpp src_libs python dx-contigset-to-fasta dx-verify-file

# Client bindings and wrappers
# ============================

toolkit_version:
	(if [ ! -e "$(DNANEXUS_HOME)/src/python/dxpy/toolkit_version.py" ]; then echo "version = \"UNKNOWN_VERSION\"" > "$(DNANEXUS_HOME)/src/python/dxpy/toolkit_version.py"; fi)
	(if [ -d "$(DNANEXUS_HOME)/.git" ]; then echo "version = \"`git describe`\"" > "$(DNANEXUS_HOME)/src/python/dxpy/toolkit_version.py"; fi)

api_wrappers:
	($(CXX) -O -Wall -o ../bin/generateWrapperTable api_wrappers/generateWrapperTable.cpp)
	../bin/generateWrapperTable ../build/list_of_all_routes.txt > ../build/wrapper_table.json
	cat ../build/wrapper_table.json | api_wrappers/generatePythonAPIWrappers.py > python/dxpy/api.py
	cat ../build/wrapper_table.json | api_wrappers/generateCppAPIHWrappers.py > cpp/dxcpp/api.h
	cat ../build/wrapper_table.json | api_wrappers/generateCppAPICCWrappers.py > cpp/dxcpp/api.cc
	cat ../build/wrapper_table.json | api_wrappers/generateJSAPIWrappers.py > javascript/DNAnexusAPI.js
	cat ../build/wrapper_table.json | api_wrappers/generatePerlAPIWrappers.py > perl/lib/DNAnexus/API.pm
	cat ../build/wrapper_table.json | api_wrappers/generateJavaAPIWrappers.py > java/src/main/java/com/dnanexus/DXAPI.java
	touch -r "../build/list_of_all_routes.txt" python/dxpy/api.py cpp/dxcpp/api.h cpp/dxcpp/api.cc \
		javascript/DNAnexusAPI.js perl/lib/DNAnexus/API.pm java/src/main/java/com/dnanexus/DXAPI.java
	rm ../bin/generateWrapperTable

cpp: api_wrappers
	mkdir -p "$(DNANEXUS_HOME)/share/dnanexus/src"
	cp -a cpp "$(DNANEXUS_HOME)/share/dnanexus/src"

src_libs: api_wrappers
	mkdir -p "$(DNANEXUS_HOME)/share/dnanexus/lib/bash"
	install -v bash/* "$(DNANEXUS_HOME)/share/dnanexus/lib/bash"
	mkdir -p "$(DNANEXUS_HOME)/share/dnanexus/lib/javascript"
	install -v javascript/*.* "$(DNANEXUS_HOME)/share/dnanexus/lib/javascript"
	mkdir -p "$(DNANEXUS_HOME)/lib/perl5/DNAnexus"
	install -v perl/lib/DNAnexus.pm "$(DNANEXUS_HOME)/lib/perl5"
	install -v perl/lib/DNAnexus/API.pm "$(DNANEXUS_HOME)/lib/perl5/DNAnexus"

# We are going to install libraries to lib/python2.7 and then move them
# elsewhere (to share/dnanexus/lib/python2.7). Modify PYTHONPATH temporarily so
# setup.py doesn't complain.
python: api_wrappers toolkit_version
	rm -rf "$(DNANEXUS_HOME)/share/dnanexus/lib/python2.7"
	mkdir -p "$(DNANEXUS_HOME)/lib/python2.7/site-packages"
	mkdir -p "$(DNANEXUS_HOME)/share/dnanexus/lib"
	(source ../environment; export PYTHONPATH="$(DNANEXUS_HOME)/lib/python2.7/site-packages:${PYTHONPATH}"; cd python; python2.7 ./setup.py build; python2.7 ./setup.py install --prefix="$(DNANEXUS_HOME)"; mv $(DNANEXUS_HOME)/lib/python2.7 $(DNANEXUS_HOME)/share/dnanexus/lib)

# TODO: fix up perl and java targets

perl: api_wrappers
	(source ../environment; cd perl; dzil build; cd DNAnexus-0.1; perl Makefile.PL; make install DESTDIR="$(DNANEXUS_HOME)/lib/perl5" DESTINSTALLSITELIB="$(DNANEXUS_HOME)/lib/perl5")

java: api_wrappers
	mkdir -p "$(DNANEXUS_HOME)/lib/java"
	(cd java; mvn compile assembly:single)
	cp -f java/target/*.jar "$(DNANEXUS_HOME)/lib/java"<commit_msg>Fix install procedure for source libraries<commit_after># Copyright (C) 2013 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
#   Licensed under the Apache License, Version 2.0 (the "License"); you may not
#   use this file except in compliance with the License. You may obtain a copy
#   of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#   WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#   License for the specific language governing permissions and limitations
#   under the License.

SHELL=/bin/bash -e

# If installing into the system directories you probably want to set
#   DESTDIR=/ PREFIX=/usr
ifndef DESTDIR
	export DESTDIR=/opt/dnanexus
endif
ifndef PREFIX
	export PREFIX=/
endif

export DNANEXUS_HOME=$(CURDIR)/..

# For parallel builds, add the following to your .bashrc or other build
# environment initialization file:
#
#   export MAKEFLAGS=-j8

all: api_wrappers cpp src_libs python dx-contigset-to-fasta dx-verify-file

# Client bindings and wrappers
# ============================

toolkit_version:
	(if [ ! -e "$(DNANEXUS_HOME)/src/python/dxpy/toolkit_version.py" ]; then echo "version = \"UNKNOWN_VERSION\"" > "$(DNANEXUS_HOME)/src/python/dxpy/toolkit_version.py"; fi)
	(if [ -d "$(DNANEXUS_HOME)/.git" ]; then echo "version = \"`git describe`\"" > "$(DNANEXUS_HOME)/src/python/dxpy/toolkit_version.py"; fi)

api_wrappers:
	($(CXX) -O -Wall -o ../bin/generateWrapperTable api_wrappers/generateWrapperTable.cpp)
	../bin/generateWrapperTable ../build/list_of_all_routes.txt > ../build/wrapper_table.json
	cat ../build/wrapper_table.json | api_wrappers/generatePythonAPIWrappers.py > python/dxpy/api.py
	cat ../build/wrapper_table.json | api_wrappers/generateCppAPIHWrappers.py > cpp/dxcpp/api.h
	cat ../build/wrapper_table.json | api_wrappers/generateCppAPICCWrappers.py > cpp/dxcpp/api.cc
	cat ../build/wrapper_table.json | api_wrappers/generateJSAPIWrappers.py > javascript/DNAnexusAPI.js
	cat ../build/wrapper_table.json | api_wrappers/generatePerlAPIWrappers.py > perl/lib/DNAnexus/API.pm
	cat ../build/wrapper_table.json | api_wrappers/generateJavaAPIWrappers.py > java/src/main/java/com/dnanexus/DXAPI.java
	touch -r "../build/list_of_all_routes.txt" python/dxpy/api.py cpp/dxcpp/api.h cpp/dxcpp/api.cc \
		javascript/DNAnexusAPI.js perl/lib/DNAnexus/API.pm java/src/main/java/com/dnanexus/DXAPI.java
	rm ../bin/generateWrapperTable

cpp: api_wrappers
	mkdir -p "$(DNANEXUS_HOME)/share/dnanexus/src"
	cp -a cpp "$(DNANEXUS_HOME)/share/dnanexus/src"

src_libs: api_wrappers
	$(eval DNANEXUS_LIBDIR := "$(DNANEXUS_HOME)/share/dnanexus/lib")
	mkdir -p "$(DNANEXUS_LIBDIR)"
	cp -R -v bash javascript "$(DNANEXUS_LIBDIR)"
	mkdir -p "$(DNANEXUS_HOME)/lib/perl5"
	cp -R -v perl/lib/* "$(DNANEXUS_HOME)/lib/perl5/"

# We are going to install libraries to lib/python2.7 and then move them
# elsewhere (to share/dnanexus/lib/python2.7). Modify PYTHONPATH temporarily so
# setup.py doesn't complain.
python: api_wrappers toolkit_version
	rm -rf "$(DNANEXUS_HOME)/share/dnanexus/lib/python2.7"
	mkdir -p "$(DNANEXUS_HOME)/lib/python2.7/site-packages"
	mkdir -p "$(DNANEXUS_HOME)/share/dnanexus/lib"
	(source ../environment; export PYTHONPATH="$(DNANEXUS_HOME)/lib/python2.7/site-packages:${PYTHONPATH}"; cd python; python2.7 ./setup.py build; python2.7 ./setup.py install --prefix="$(DNANEXUS_HOME)"; mv $(DNANEXUS_HOME)/lib/python2.7 $(DNANEXUS_HOME)/share/dnanexus/lib)

# TODO: fix up perl and java targets

perl: api_wrappers
	(source ../environment; cd perl; dzil build; cd DNAnexus-0.1; perl Makefile.PL; make install DESTDIR="$(DNANEXUS_HOME)/lib/perl5" DESTINSTALLSITELIB="$(DNANEXUS_HOME)/lib/perl5")

java: api_wrappers
	mkdir -p "$(DNANEXUS_HOME)/lib/java"
	(cd java; mvn compile assembly:single)
	cp -f java/target/*.jar "$(DNANEXUS_HOME)/lib/java"
{'fraction_non_alphanumeric': 0.13871282301316432, 'fraction_numerical': 0.007679180887372013, 'mean_word_length': 4.547667342799189, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2072462', 'n_tokens_mistral': 3090, 'n_tokens_neox': 2962, 'n_words': 673}