diff options
Diffstat (limited to 'xpp/utils/Makefile')
-rw-r--r-- | xpp/utils/Makefile | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/xpp/utils/Makefile b/xpp/utils/Makefile index 368aee9..788a8a3 100644 --- a/xpp/utils/Makefile +++ b/xpp/utils/Makefile @@ -27,6 +27,8 @@ DATADIR = $(datadir)/zaptel MANDIR = $(mandir)/man8 HOTPLUG_USB_DIR = /etc/hotplug/usb UDEV_RULES_DIR = /etc/udev/rules.d +# Perl disabled by default, until we see it is safe: +#PERLLIBDIR = $(shell eval `perl -V:sitelib`; echo "$$sitelib") XPD_FIRMWARE = $(wildcard ../firmwares/*.hex) XPD_INIT_DATA = $(XPD_FIRMWARE) init_fxo_modes @@ -37,10 +39,21 @@ XPD_INIT = $(wildcard ../init_card_?_*) ../calibrate_slics HOSTCC ?= $(CC) ZAPTEL_DIR ?= ../.. +ifeq (,$(PBX_LIBUSB)) +# No PBX_LIBUSB? Maybe we compile against zaptel-1.2 +# Let's make a poor man detection of libusb +PBX_LIBUSB = $(shell if [ -r /usr/include/usb.h ]; then echo 1; else echo 0; fi) +endif + WCTDM=$(ZAPTEL_DIR)/wctdm.c CFLAGS = -g -Wall $(EXTRA_CFLAGS) +%.8: % + pod2man --section 8 $^ > $@ || $(RM) $@ +PERL_SCRIPTS = zt_registration xpp_sync lszaptel +PERL_MANS = zt_registration.8 xpp_sync.8 lszaptel.8 + TARGETS = init_fxo_modes print_modes adj_clock PROG_INSTALL = genzaptelconf adj_clock MAN_INSTALL = genzaptelconf.8 adj_clock.8 @@ -49,12 +62,22 @@ TARGETS += libhexfile.a fpga_load test_parse PROG_INSTALL += fpga_load MAN_INSTALL += fpga_load.8 endif +ifneq (,$(PERLLIBDIR)) +PROG_INSTALL += $(PERL_SCRIPTS) +MAN_INSTALL += $(PERL_MANS) +endif all: $(TARGETS) -install: all - $(INSTALL) -d $(DESTDIR)$(BINDIR) - $(INSTALL) $(PROG_INSTALL) $(DESTDIR)$(BINDIR)/ +docs: $(PERL_MANS) + +# give an ugly warning if Timer::Hires is missing: +sanity_checks: + perl -c ../calibrate_slics >/dev/null || true + +install: all sanity_checks + $(INSTALL) -d $(DESTDIR)$(SBINDIR) + $(INSTALL) $(PROG_INSTALL) $(DESTDIR)$(SBINDIR)/ $(INSTALL) -d $(DESTDIR)$(DATADIR) $(INSTALL_DATA) $(XPD_INIT_DATA) $(DESTDIR)$(DATADIR)/ $(INSTALL) $(XPD_INIT) $(DESTDIR)$(DATADIR)/ @@ -65,6 +88,17 @@ install: all $(INSTALL) xpp_fxloader $(DESTDIR)$(HOTPLUG_USB_DIR)/ $(INSTALL) -d $(DESTDIR)$(UDEV_RULES_DIR) $(INSTALL_DATA) xpp.rules $(DESTDIR)$(UDEV_RULES_DIR)/ +ifneq (,$(PERLLIBDIR)) + $(INSTALL) -d $(DESTDIR)$(PERLLIBDIR) + for i in Zaptel Zaptel/Xpp; \ + do \ + $(INSTALL) -d "$(DESTDIR)$(PERLLIBDIR)/$$i"; \ + done + for i in Zaptel.pm Zaptel/Xpp/Xbus.pm Zaptel/Xpp/Xpd.pm Zaptel/Xpp.pm Zaptel/Span.pm Zaptel/Chans.pm; \ + do \ + $(INSTALL_DATA) "zconf/$$i" "$(DESTDIR)$(PERLLIBDIR)/$$i"; \ + done +endif libhexfile.a: hexfile.o $(AR) cru $@ $^ |