1# Makefile.am - use automake to generate Makefile.in 2# 3# Copyright (C) 2013-2019 Arthur de Jong 4# 5# This library is free software; you can redistribute it and/or 6# modify it under the terms of the GNU Lesser General Public 7# License as published by the Free Software Foundation; either 8# version 2.1 of the License, or (at your option) any later version. 9# 10# This library is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13# Lesser General Public License for more details. 14# 15# You should have received a copy of the GNU Lesser General Public 16# License along with this library; if not, write to the Free Software 17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18# 02110-1301 USA 19 20utilsdir = $(datadir)/nslcd-utils 21 22utils_PYTHON = cmdline.py nslcd.py getent.py chsh.py shells.py users.py 23nodist_utils_PYTHON = constants.py 24CLEANFILES = $(nodist_utils_PYTHON) 25 26all-local: $(nodist_utils_PYTHON) 27 28# clean up locally created compiled Python files 29clean-local: 30 -rm -rf *.pyc *.pyo __pycache__ 31 32# copy constants module 33constants.py: ../pynslcd/constants.py 34 cp ../pynslcd/constants.py . 35 36# create symbolic links, fix permissions and set Python interpreter 37install-data-hook: 38 $(MKDIR_P) $(DESTDIR)$(bindir) 39 set -ex; for cmd in getent chsh ; do \ 40 [ -L $(DESTDIR)$(bindir)/$$cmd.$(MODULE_NAME) ] || $(LN_S) $(utilsdir)/$$cmd.py $(DESTDIR)$(bindir)/$$cmd.$(MODULE_NAME) ; \ 41 chmod a+rx $(DESTDIR)$(utilsdir)/$$cmd.py ; \ 42 sed -i -e '1 s|^#!.*|#! $(PYTHON)|;1 s|^#! \([^/].*\)|#! /usr/bin/env \1|' $(DESTDIR)$(utilsdir)/$$cmd.py ; \ 43 done 44