2016-03-14 10:26:59 +00:00
########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2016, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
#########################################################################
SHELL = /bin/sh
#########################################################################
# High-level targets
#########################################################################
2016-06-03 10:56:53 +01:00
# Include only platform-independent builds in all
all : docs install -pip -requirements pip src
2016-03-14 10:26:59 +00:00
2016-06-03 10:56:53 +01:00
# Include all clean sub-targets in clean
clean : clean -dist clean -docs clean -pip clean -appbundle clean -src
2016-03-14 10:26:59 +00:00
#########################################################################
# Python PIP package
#########################################################################
ERROR_PERMISSIONS = by 'make install-pip-requirements' . The user must have permission to add files to site-packages for Python installation/virtual environment
IS_WHEEL_INSTALLED = 0
WHEEL_CHECK_CMD = which pip & > /dev/null && pip list wheel | grep wheel 2> /dev/null
WHEEL_INSTALL_CMD = pip install wheel
IS_PIP_INSTALLED = 0
PIP_INSTALL_CMD = easy_install pip
PIP_CHECK_CMD = which pip & > /dev/null && pip show pip | grep Metadata-Version 2>/dev/null
PGADMIN_SRC_DIR = pgadmin4
PGADMIN_EGG = ${ PGADMIN_SRC_DIR } .egg-info
PGADMIN_BUILD = build
2016-06-02 13:56:56 +01:00
PGADMIN_MACBUILD = mac-build
2016-06-03 10:56:53 +01:00
PGADMIN_SRCBUILD = src-build
2016-03-15 11:46:04 +00:00
PGADMIN_DIST = dist
2016-03-14 10:26:59 +00:00
PGADMIN_MANIFEST = MANIFEST.in
PGADMIN_INSTALL_CMD = pip install --use-wheel --find-links= ${ PGADMIN_DIST } ${ PGADMIN_SRC_DIR }
define create_manifest
2016-03-15 11:46:04 +00:00
@printf 'recursive-include ${PGADMIN_SRC_DIR} *\nglobal-exclude pgadmin4.db *.pyc' > ${PGADMIN_MANIFEST}
2016-03-14 10:26:59 +00:00
endef
define build
python pkg/pip/setup_pip.py bdist_wheel
endef
install-pip-requirements :
ifeq ( $( shell $ {PIP_CHECK_CMD }) ,)
${PIP_INSTALL_CMD}
$( eval IS_PIP_INSTALLED =1)
endif
ifeq ( $( shell $ {WHEEL_CHECK_CMD }) ,)
${WHEEL_INSTALL_CMD}
$( eval IS_WHEEL_INSTALLED =1)
endif
pip :
ifeq ( $( shell $ {PIP_CHECK_CMD }) ,)
@if [ $( value IS_PIP_INSTALLED ) -ne 1 ]; \
then \
echo >&2 "Install pip ${ERROR_PERMISSIONS}" ; \
false; \
fi
endif
ifeq ( $( shell $ {WHEEL_CHECK_CMD }) ,)
@if [ $( value IS_WHEEL_INSTALLED ) -ne 1 ]; \
then \
echo >&2 "Install wheel ${ERROR_PERMISSIONS}" ; \
false; \
fi
endif
2016-03-15 11:46:04 +00:00
rm -rf ${PGADMIN_SRC_DIR}
2016-03-14 10:26:59 +00:00
cp -r web ${PGADMIN_SRC_DIR}
$( call create_manifest )
$( call build )
install-pip :
${ PGADMIN_INSTALL_CMD }
2016-06-02 13:56:56 +01:00
appbundle : docs
./pkg/mac/build.sh
docs :
LC_ALL = en_US.UTF-8 LANG = en_US.UTF-8 $( MAKE) -C docs/en_US -f Makefile.sphinx html
clean-docs :
LC_ALL = en_US.UTF-8 LANG = en_US.UTF-8 $( MAKE) -C docs/en_US -f Makefile.sphinx clean
2016-03-14 10:26:59 +00:00
clean-pip :
rm -rf ${ PGADMIN_SRC_DIR }
rm -rf ${ PGADMIN_EGG }
rm -rf ${ PGADMIN_BUILD }
rm -f ${ PGADMIN_MANIFEST }
2016-06-02 13:56:56 +01:00
clean-appbundle :
rm -rf ${ PGADMIN_MACBUILD }
rm -rf ${ PGADMIN_DIST } /pgadmin4*.dmg*
2016-06-03 10:56:53 +01:00
src :
./pkg/src/build.sh
clean-src :
rm -rf ${ PGADMIN_SRCBUILD }
rm -rf ${ PGADMIN_DIST } /pgadmin4*.tar.gz
clean-dist :
rm -rf ${ PGADMIN_DIST }
2016-06-02 13:56:56 +01:00
.PHONY : docs