summaryrefslogtreecommitdiff
blob: 8388ccd6214b055f1d813926d52e73f1a74330aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--- chan_bluetooth/Makefile.orig	2005-01-26 19:15:55.917041040 +0000
+++ chan_bluetooth/Makefile	2005-01-26 19:21:53.654656656 +0000
@@ -1,17 +1,32 @@
-BLT_DIR  = $(shell dirname $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
-BLT_OBJS = $(BLT_DIR)/.tmp/chan_bluetooth.o
+BLT_OBJS = .tmp/chan_bluetooth.o
 
-ifeq ($(strip ${MAKEFILE_LIST}), Makefile)
-thisshouldnotberun:
-	@echo " --- Please read the README and INSTALL file!"
-endif
 
-$(BLT_DIR)/.tmp/chan_bluetooth.o: $(BLT_DIR)/chan_bluetooth.c
-	$(CC) -c -I$(BLT_DIR) $(CFLAGS) -o $@ $<
+CC=gcc
+SOLINK=$(shell /usr/bin/asterisk-config --solink)
+CFLAGS=$(shell /usr/bin/asterisk-config --cflags) -fPIC -DPIC
 
-chan_bluetooth.so: $(BLT_DIR)/.tmp $(BLT_OBJS)
+ASTETCDIR=$(shell /usr/bin/asterisk-config --sysconfdir)
+ASTMODDIR=$(shell /usr/bin/asterisk-config --modulesdir)
+
+all: .depend chan_bluetooth.so
+
+.tmp/chan_bluetooth.o: chan_bluetooth.c
+	$(CC) -c -I. $(CFLAGS) -o $@ $<
+
+chan_bluetooth.so: .tmp $(BLT_OBJS)
 	$(CC) $(SOLINK) -o $@ $(BLT_OBJS) -lbluetooth
 
-$(BLT_DIR)/.tmp:
-	mkdir -p $(BLT_DIR)/.tmp
+.tmp:
+	mkdir -p .tmp
+
+.depend:
+	@if [ ! -x /usr/bin/asterisk-config ]; then \
+		echo "/usr/bin/asterisk-config not found!"; \
+		exit 255; \
+	fi
 
+install:
+	if [ ! -d $(DESTDIR)$(ASTETCDIR) ]; then mkdir -p $(DESTDIR)$(ASTETCDIR); fi
+	install -m600 conf/bluetooth.conf $(DESTDIR)$(ASTETCDIR)
+	if [ ! -d $(DESTDIR)$(ASTMODDIR) ]; then mkdir -p $(DESTDIR)$(ASTMODDIR); fi
+	install -m755 chan_bluetooth.so $(DESTDIR)$(ASTMODDIR)