automake: xpp: man-pages and perl-scripts

* Now man-pages and perl-script are handled by xpp/Makefile.am
* Removed from xpp/Makefile.legacy
* Detect perl and set perllibdir in configure.ac
* Handle modules in their own xpp/perl_modules/Makefile.am
* Enclose perl-related stuff in conditional
* Updates for "make dist"

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
Oron Peled 2015-05-18 15:25:03 +00:00 committed by Tzafrir Cohen
parent ee83afa669
commit b054abb7e9
6 changed files with 81 additions and 53 deletions

1
.gitignore vendored
View File

@ -51,6 +51,7 @@ timertest
tonezone.lo tonezone.lo
tonezones.txt tonezones.txt
version.c version.c
xpp/*.check
xpp/.depend xpp/.depend
xpp/.octasic.depend xpp/.octasic.depend
xpp/.perlcheck xpp/.perlcheck

View File

@ -28,10 +28,12 @@ extra_dist='
Makefile Makefile
xpp/Makefile xpp/Makefile
xpp/oct612x/Makefile xpp/oct612x/Makefile
xpp/perl_modules/Makefile
ppp/Makefile.in ppp/Makefile.in
Makefile.in Makefile.in
xpp/Makefile.in xpp/Makefile.in
xpp/oct612x/Makefile.in xpp/oct612x/Makefile.in
xpp/perl_modules/Makefile.in
auxdir/compile auxdir/compile
auxdir/config.guess auxdir/config.guess
auxdir/config.sub auxdir/config.sub

View File

@ -86,6 +86,16 @@ AC_SUBST(DOWNLOAD)
AC_LANG(C) AC_LANG(C)
AC_PATH_PROG([PERL], [perl])
if test "$PERL" = ''; then
AC_MSG_ERROR(perl is mandatory)
fi
AC_MSG_CHECKING(for perl libdir)
eval `"$PERL" -V:sitelib`
AC_SUBST([perllibdir], [`echo "$sitelib"`])
AC_MSG_RESULT([$perllibdir])
AM_CONDITIONAL([PERL], [test "$perllibdir" != ''])
AC_ARG_ENABLE(dev-mode, AC_ARG_ENABLE(dev-mode,
[ --enable-dev-mode Turn on developer mode], [ --enable-dev-mode Turn on developer mode],
[case "${enableval}" in [case "${enableval}" in
@ -247,6 +257,7 @@ AC_CONFIG_FILES([
ppp/Makefile ppp/Makefile
xpp/Makefile xpp/Makefile
xpp/oct612x/Makefile xpp/oct612x/Makefile
xpp/perl_modules/Makefile
]) ])
AC_OUTPUT AC_OUTPUT

View File

@ -4,7 +4,7 @@ LEGACY_MAKE = \
top_srcdir=$(top_srcdir) \ top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) srcdir=$(srcdir)
all-local: all-local: $(perl_checks)
$(LEGACY_MAKE) all $(LEGACY_MAKE) all
clean-local: clean-local:
@ -21,6 +21,44 @@ SUBDIRS =
GLOBAL_CFLAGS = -I$(srcdir) -I$(srcdir)/xtalk GLOBAL_CFLAGS = -I$(srcdir) -I$(srcdir)/xtalk
if PERL
SUBDIRS += perl_modules
%.8: %
@if file "$^" | cut -d: -f2 | grep -q perl; then \
if pod2man --section 8 $^ > $@; then \
echo " GEN $@"; \
else \
rm -f "$@"; \
fi \
fi
%.check: %
@echo " CHECK $^"; \
if ! perl -I./perl_modules -c $^ 2>/dev/null; then \
perl -I./perl_modules -c $^; \
fi
@touch $@
perl_scripts = \
dahdi_registration \
xpp_sync \
lsdahdi \
xpp_blink \
dahdi_genconf \
dahdi_hardware \
twinstar \
#
perl_checks = $(perl_scripts:%=%.check)
perl_mans = $(perl_scripts:%=%.8)
endif
dist_sbin_SCRIPTS = $(perl_scripts)
man_MANS = $(perl_mans)
CLEANFILES = $(perl_checks) $(perl_mans)
if PBX_USB if PBX_USB
SUBDIRS += oct612x SUBDIRS += oct612x
@ -65,9 +103,11 @@ astribank_allow_CFLAGS = $(GLOBAL_CFLAGS)
astribank_allow_LDFLAGS = $(USB_LIB) astribank_allow_LDFLAGS = $(USB_LIB)
astribank_allow_LDADD = libastribank.la astribank_allow_LDADD = libastribank.la
man_MANS = \ man_pages = \
astribank_tool.8 \ astribank_tool.8 \
astribank_hexload.8 \ astribank_hexload.8 \
astribank_allow.8 \ astribank_allow.8 \
astribank_is_starting.8 astribank_is_starting.8
man_MANS += $(man_pages)
endif endif

View File

@ -19,75 +19,25 @@ INSTALL_DATA = $(INSTALL) -m 644
# In 1.4 those are provided by autoconf through makeopts # In 1.4 those are provided by autoconf through makeopts
prefix ?= /usr prefix ?= /usr
datadir ?= $(prefix)/share datadir ?= $(prefix)/share
mandir ?= $(datadir)/man
sysconfdir ?= $(prefix)/etc sysconfdir ?= $(prefix)/etc
udevrulesdir ?= $(sysconfdir)/udev/rules.d udevrulesdir ?= $(sysconfdir)/udev/rules.d
INSTALL ?= install INSTALL ?= install
INSTALL_DATA = $(INSTALL) -m 644 INSTALL_DATA = $(INSTALL) -m 644
SBINDIR = $(prefix)/sbin
DATADIR = $(datadir)/dahdi DATADIR = $(datadir)/dahdi
MANDIR = $(mandir)/man8
PERLLIBDIR := $(shell eval `perl -V:sitelib`; echo "$$sitelib")
PERL_DIRS := $(shell cd perl_modules; find * -name '[A-Z]*' -type d| xargs)
PERL_MODS_PAT := *.pm $(PERL_DIRS:%=%/*.pm)
PERL_MODS := $(shell cd perl_modules; echo $(PERL_MODS_PAT))
# Variables that should be defined above, but need sane defaults: # Variables that should be defined above, but need sane defaults:
# FIXME: Are those values really sane? # FIXME: Are those values really sane?
HOSTCC ?= $(CC) HOSTCC ?= $(CC)
%.8: % all:
pod2man --section 8 $^ > $@ || $(RM) $@
PERL_SCRIPTS = \
dahdi_registration \
xpp_sync \
lsdahdi \
xpp_blink \
dahdi_genconf \
dahdi_hardware \
twinstar \
#
PERL_MANS = $(PERL_SCRIPTS:%=%.8)
TARGETS = .perlcheck
ifneq (,$(PERLLIBDIR))
PROG_INSTALL += $(PERL_SCRIPTS)
TARGETS += $(PERL_MANS)
endif
all: $(TARGETS)
docs: $(PERL_MANS)
install: all install: all
$(INSTALL) -d $(DESTDIR)$(SBINDIR)
$(INSTALL) $(PROG_INSTALL) $(DESTDIR)$(SBINDIR)/
$(INSTALL) -d $(DESTDIR)$(DATADIR) $(INSTALL) -d $(DESTDIR)$(DATADIR)
$(INSTALL) xpp_fxloader astribank_hook $(DESTDIR)$(DATADIR)/ $(INSTALL) xpp_fxloader astribank_hook $(DESTDIR)$(DATADIR)/
$(INSTALL) waitfor_xpds $(DESTDIR)$(DATADIR)/ $(INSTALL) waitfor_xpds $(DESTDIR)$(DATADIR)/
$(INSTALL) -d $(DESTDIR)$(udevrulesdir) $(INSTALL) -d $(DESTDIR)$(udevrulesdir)
$(INSTALL_DATA) xpp.rules $(DESTDIR)$(udevrulesdir)/ $(INSTALL_DATA) xpp.rules $(DESTDIR)$(udevrulesdir)/
$(INSTALL) -d $(DESTDIR)$(MANDIR)
$(INSTALL_DATA) $(PERL_MANS) $(DESTDIR)$(MANDIR)/
ifneq (,$(PERLLIBDIR))
$(INSTALL) -d $(DESTDIR)$(PERLLIBDIR)
for i in $(PERL_DIRS); \
do \
$(INSTALL) -d "$(DESTDIR)$(PERLLIBDIR)/$$i"; \
done
for i in $(PERL_MODS); \
do \
$(INSTALL_DATA) "perl_modules/$$i" "$(DESTDIR)$(PERLLIBDIR)/$$i"; \
done
endif
.perlcheck: $(PERL_SCRIPTS)
for i in $^; do perl -I./perl_modules -c $$i || exit 1; done
touch $@
clean: clean:
$(RM) $(TARGETS)

View File

@ -0,0 +1,24 @@
nobase_perllib_DATA = \
Dahdi.pm \
Dahdi/Hardware.pm \
Dahdi/Xpp/Line.pm \
Dahdi/Xpp/Xbus.pm \
Dahdi/Xpp/Xpd.pm \
Dahdi/Xpp/Mpp.pm \
Dahdi/Span.pm \
Dahdi/Utils.pm \
Dahdi/Chans.pm \
Dahdi/Xpp.pm \
Dahdi/Config/Params.pm \
Dahdi/Config/Gen/Xpporder.pm \
Dahdi/Config/Gen/Spantypes.pm \
Dahdi/Config/Gen/Modules.pm \
Dahdi/Config/Gen/Users.pm \
Dahdi/Config/Gen/Freepbxdb.pm \
Dahdi/Config/Gen/Unicall.pm \
Dahdi/Config/Gen/Chandahdi.pm \
Dahdi/Config/Gen/Assignedspans.pm \
Dahdi/Config/Gen/System.pm \
Dahdi/Config/Gen.pm \
Dahdi/Hardware/USB.pm \
Dahdi/Hardware/PCI.pm