summaryrefslogtreecommitdiff
path: root/xpp/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/Makefile')
-rw-r--r--xpp/Makefile33
1 files changed, 26 insertions, 7 deletions
diff --git a/xpp/Makefile b/xpp/Makefile
index deaadcf..1588416 100644
--- a/xpp/Makefile
+++ b/xpp/Makefile
@@ -3,18 +3,20 @@ EXTRA_CFLAGS = $(XPP_LOCAL_CFLAGS) \
-DDEBUG \
-DPOLL_DIGITAL_INPUTS \
-DWITH_ECHO_SUPPRESSION \
- -DPROTOCOL_DEBUG \
- -DZAPTEL_EC_TYPEDEF \
+ -DPROTOCOL_DEBUG
-# Useful for Astribank-BRI debugging, and maybe more later on.
-# Requires debugfs support in the kernel.
-# -DXPP_DEBUGFS
+ifneq (,$(filter y m,$(CONFIG_DEBUG_FS)))
+EXTRA_CFLAGS += -DXPP_DEBUGFS
+endif
+ifneq (,$(shell grep -w echo_can_state_t $(ZAPTEL_DIR)/zaptel.h))
+EXTRA_CFLAGS += -DZAPTEL_EC_TYPEDEF
+endif
-DRIVER_DIR = $(SUBDIRS)
+ZAPTEL_DIR = $(SUBDIRS)
obj-m += xpp.o xpd_fxs.o xpd_fxo.o
-HAS_BRISTUFF := $(shell cpp $(CPPFLAGS) -dM $(DRIVER_DIR)/zconfig.h | sed -n 's/^.*CONFIG_ZAPATA_BRI_DCHANS/y/p')
+HAS_BRISTUFF := $(shell cpp $(CPPFLAGS) -dM $(ZAPTEL_DIR)/zconfig.h | sed -n 's/^.*CONFIG_ZAPATA_BRI_DCHANS/y/p')
# Build only supported modules
ifneq (,$(filter y m,$(CONFIG_USB)))
@@ -31,3 +33,20 @@ xpd_bri-y += card_bri.o
ctags:
ctags *.[ch]
+
+# Handle versioning
+XPP_VERSION_STR ?= $(shell if [ -r $(obj)/.version ]; then echo "\"`cat $(obj)/.version`\""; else echo '"Unknown"'; fi)
+clean-files := xpp_version.h
+
+$(obj)/card_fxs.o $(obj)/card_fxo.o $(obj)/card_bri.o $(obj)/xpp_usb.o $(obj)/xpp.o: $(obj)/xpp_version.h
+
+$(obj)/xpp_version.h: FORCE
+ $(Q)echo "Compile for $(XPP_VERSION_STR)"
+ $(Q)echo '#define XPP_VERSION $(XPP_VERSION_STR)' > $@.tmp
+ $(Q)if cmp -s $@.tmp $@ ; then echo; else \
+ mv $@.tmp $@ ; \
+ fi
+ $(Q)rm -f $@.tmp
+
+.PHONY: FORCE
+FORCE: