summaryrefslogtreecommitdiff
path: root/xpp/utils/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/utils/Makefile')
-rw-r--r--xpp/utils/Makefile31
1 files changed, 15 insertions, 16 deletions
diff --git a/xpp/utils/Makefile b/xpp/utils/Makefile
index 7824278..4934b21 100644
--- a/xpp/utils/Makefile
+++ b/xpp/utils/Makefile
@@ -1,21 +1,16 @@
PEDANTIC = -ansi -pedantic -std=c99
+# TODO: temporarity reverting autoconf-related changes.
+# Those changes are not to be applied to 1.4.
RANLIB = ranlib
+INSTALL = install
+INSTALL_DATA = install -m 644
-TOPDIR ?= ../..
-
-# In 1.4 those are provided by autoconf through makeopts
-prefix ?= /usr
-datadir ?= $(prefix)/share
-mandir ?= $(datadir)/man
-INSTALL ?= install
-
-INSTALL_DATA = $(INSTALL) -m 644
-
-BINDIR = $(prefix)/sbin
-DATADIR = $(datadir)/zaptel
-MANDIR = $(mandir)/man8
+BINDIR = /usr/sbin
+DATADIR = /usr/share/zaptel
+MANDIR = /usr/share/man/man8
HOTPLUG_USB_DIR = /etc/hotplug/usb
+UDEV_RULES_DIR = /etc/udev/rules.d
XPD_FIRMWARE = $(wildcard ../firmwares/*.hex)
XPD_INIT_DATA = $(XPD_FIRMWARE) init_fxo_modes
@@ -24,8 +19,8 @@ XPD_INIT = $(wildcard ../init_card_?_*) ../calibrate_slics
# Variables that should be defined above, but need sane defaults:
# FIXME: Are those values really sane?
HOSTCC ?= $(CC)
-PBX_LIBUSB ?= 1
-DRIVER_DIR ?= $(TOPDIR)
+CONFIG_USB ?= y
+DRIVER_DIR ?= ../..
WCTDM=$(DRIVER_DIR)/wctdm.c
@@ -34,7 +29,7 @@ CFLAGS = -g -Wall $(EXTRA_CFLAGS)
TARGETS = init_fxo_modes print_modes adj_clock
PROG_INSTALL = genzaptelconf adj_clock
MAN_INSTALL = genzaptelconf.8 adj_clock.8
-ifeq ($(PBX_LIBUSB),1)
+ifneq (,$(filter y m,$(CONFIG_USB)))
TARGETS += libhexfile.a fpga_load test_parse
PROG_INSTALL += fpga_load
MAN_INSTALL += fpga_load.8
@@ -53,6 +48,8 @@ install: all
$(INSTALL) -d $(DESTDIR)$(HOTPLUG_USB_DIR)
$(INSTALL_DATA) xpp_fxloader.usermap $(DESTDIR)$(HOTPLUG_USB_DIR)/
$(INSTALL) xpp_fxloader $(DESTDIR)$(HOTPLUG_USB_DIR)/
+ $(INSTALL) -d $(DESTDIR)$(UDEV_RULES_DIR)
+ $(INSTALL_DATA) xpp.rules $(DESTDIR)$(UDEV_RULES_DIR)/
libhexfile.a: hexfile.o
$(AR) cru $@ $^
@@ -61,6 +58,8 @@ libhexfile.a: hexfile.o
fpga_load: fpga_load.o libhexfile.a
$(CC) -L. -o $@ $@.o $(EXTRA_LIBS) -lhexfile -lusb
+fpga_load.o: CFLAGS+=-D_GNU_SOURCE # We use memrchr()
+
hexfile.o: hexfile.c hexfile.h
$(CC) $(CFLAGS) $(PEDANTIC) -c $<