2013-10-19 09:53:37 -04:00
|
|
|
MAJOR:=$(shell bash -c 'source version.sh ; echo $$MAJOR')
|
|
|
|
|
BUILD:=$(shell bash -c 'source version.sh ; echo $$BUILD')
|
|
|
|
|
OS_NAME:=$(shell bash -c 'source version.sh ; echo $$OS_NAME')
|
|
|
|
|
ifeq "$(OS_NAME)" "win"
|
|
|
|
|
PIP=$(shell pwd)/virtualenv/Scripts/pip
|
|
|
|
|
VIRTUALENV_PKGS_DIR=$(shell pwd)/virtualenv/Lib/site-packages
|
|
|
|
|
else
|
|
|
|
|
PIP=$(shell pwd)/virtualenv/bin/pip
|
|
|
|
|
VIRTUALENV_PKGS_DIR=$(shell pwd)/virtualenv/lib/site-packages
|
|
|
|
|
endif
|
|
|
|
|
VIRTUALENV=$(shell which virtualenv)
|
|
|
|
|
PYTHON=$(shell which python)
|
|
|
|
|
|
|
|
|
|
PYTHON_FILES=setup.py mercy/version.py $(shell find mercy -iname "*py")
|
2013-10-19 10:37:30 -04:00
|
|
|
PYTHON_SDIST=./dist/mercy-$(MAJOR)-$(BUILD).tar.gz
|
2013-10-19 09:53:37 -04:00
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
clean:
|
|
|
|
|
rm -fr dist/*
|
|
|
|
|
find mercy -iname "*pyc" -exec rm -vf \{\} \;
|
2013-10-19 10:37:30 -04:00
|
|
|
cd puppet && make clean
|
|
|
|
|
|
|
|
|
|
############## Targets for puppet module
|
|
|
|
|
|
|
|
|
|
puppet/version.sh: version.sh
|
|
|
|
|
cp version.sh $@
|
|
|
|
|
|
|
|
|
|
.PHONY: puppet
|
|
|
|
|
puppet: puppet_dist
|
|
|
|
|
|
|
|
|
|
.PHONY: puppet_dist
|
|
|
|
|
puppet_dist: puppet/version.sh
|
|
|
|
|
cd puppet && make dist
|
|
|
|
|
|
|
|
|
|
.PHONY: puppet_install
|
|
|
|
|
puppet_install: puppet/version.sh
|
|
|
|
|
cd puppet && make install
|
|
|
|
|
|
|
|
|
|
.PHONY: puppet_uninstall
|
|
|
|
|
puppet_uninstall: puppet/version.sh
|
|
|
|
|
cd puppet && make uninstall
|
|
|
|
|
|
|
|
|
|
################ /puppet module
|
|
|
|
|
|
|
|
|
|
############### Targets for python app
|
|
|
|
|
|
|
|
|
|
dist: $(PYTHON_SDIST) puppet
|
2013-10-19 09:53:37 -04:00
|
|
|
|
|
|
|
|
sdist: $(PYTHON_SDIST)
|
|
|
|
|
|
|
|
|
|
mercy/version.py: version.sh
|
2013-10-19 22:28:46 -04:00
|
|
|
bash -c 'source version.sh && echo "VERSION=\"$${MAJOR}-$${BUILD}\"" > $@'
|
2013-10-19 09:53:37 -04:00
|
|
|
|
|
|
|
|
$(PYTHON_SDIST): $(PYTHON_FILES)
|
2013-10-19 10:37:30 -04:00
|
|
|
$(PYTHON) setup.py sdist --formats=gztar
|
2013-10-19 09:53:37 -04:00
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
|
rm -fr $(VIRTUALENV_PKGS_DIR)/mercy-* || echo 'not installed'
|
|
|
|
|
|
2013-10-19 10:37:30 -04:00
|
|
|
install: $(PYTHON_SDIST) virtualenv
|
2013-10-19 09:53:37 -04:00
|
|
|
$(PIP) install $(PYTHON_SDIST) --upgrade
|
2013-10-19 10:37:30 -04:00
|
|
|
|
|
|
|
|
.PHONY: virtualenv
|
|
|
|
|
virtualenv:
|
|
|
|
|
if [ ! -e $(PIP) ]; then \
|
|
|
|
|
$(VIRTUALENV) --no-site-packages --distribute virtualenv ; \
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
################## /python app
|
2013-10-19 22:28:46 -04:00
|
|
|
|
|
|
|
|
################## Targets for supporting development work
|
|
|
|
|
|
|
|
|
|
databases: databases/fda_ndc.zip databases/drugbank.xml.zip
|
|
|
|
|
|
|
|
|
|
.PHONY: databases/fda_ndc.zip
|
|
|
|
|
databases/fda_ndc.zip:
|
|
|
|
|
rm -fr databases/fda_ndc*
|
|
|
|
|
mkdir -p databases/fda_ndc
|
|
|
|
|
rm -f fda_ndc.zip
|
|
|
|
|
DBPAGE=$$(wget -O - http://www.fda.gov/Drugs/InformationOnDrugs/default.htm --quiet | grep -Eo 'National Drug Code Directory Search(</strong>)*(</a>)*(<br />)*<a href="[a-zA-Z0-9\:/\.]+">More information about the database</a>' | cut -d \" -f 2); \
|
|
|
|
|
LINK=$$(wget -O - http://www.fda.gov/$${DBPAGE} --quiet | grep ">NDC Database File" | cut -d \" -f 2) ; \
|
|
|
|
|
wget -O $@ http://www.fda.gov/$${LINK}
|
|
|
|
|
cd databases/fda_ndc && unzip -e ../fda_ndc.zip
|
|
|
|
|
|
|
|
|
|
.PHONY: databases/drugbank.xml.zip
|
|
|
|
|
databases/drugbank.xml.zip:
|
|
|
|
|
rm -fr databases/drugbank*
|
|
|
|
|
mkdir -p databases/drugbank
|
|
|
|
|
wget -O $@ http://www.drugbank.ca/system/downloads/current/drugbank.xml.zip
|
|
|
|
|
cd databases/drugbank && unzip -e ../drugbank.xml.zip
|