-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
85 lines (69 loc) · 2.61 KB
/
Makefile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
SOURCES := $(wildcard *.cpp)
MODULES := $(patsubst %.cpp,%.yate, $(SOURCES))
CONFIGS := $(wildcard $(patsubst %.cpp,%.conf, $(SOURCES)))
TESTS_S := $(wildcard test/*.cpp)
TESTS := $(patsubst %.cpp,%.yate, $(TESTS_S))
YATEDIR?=../yate3.git
ifneq ($(wildcard ${YATEDIR}),)
MOREFLAGS=-I${YATEDIR} -I${YATEDIR}/libs/yscript -L${YATEDIR}
DPKGBPFLAGS=-d
PATH := ${YATEDIR}:$(PATH)
endif
MODSDIR := `yate-config --modules`
CONFDIR := `yate-config --config`
.SUFFIXES: .yate
.PHONY: clean deb
.cpp.yate: $<
g++ -Wall -O2 ${MOREFLAGS} $(DEBUG) `yate-config --c-all` `yate-config --ld-all` -o $@ $^
all: $(MODULES) $(TESTS)
clean:
rm -f $(patsubst %.cpp,%.yate,$(wildcard *.cpp test/*.cpp))
install: $(MODULES) $(CONFIGS) $(TESTS)
install -d $(DESTDIR)$(MODSDIR) $(DESTDIR)$(CONFDIR) $(DESTDIR)$(MODSDIR)/test
for m in $(MODULES); do install -m755 $$m $(DESTDIR)$(MODSDIR); done
for m in $(CONFIGS); do install -m755 $$m $(DESTDIR)$(CONFDIR); done
for m in $(TESTS); do install -m755 $$m $(DESTDIR)$(MODSDIR)/test; done
ifneq ($(wildcard ${YATEDIR}),)
.PHONY: put
put: $(MODULES)
for m in $(MODULES); do install -m755 $$m ${YATEDIR}; done
endif
debug:
$(MAKE) all DEBUG=-g3 MODSTRIP=
ddebug:
$(MAKE) all DEBUG='-g3 -DDEBUG' MODSTRIP=
xdebug:
$(MAKE) all DEBUG='-g3 -DXDEBUG' MODSTRIP=
ndebug:
$(MAKE) all DEBUG='-g0 -DNDEBUG'
deb: debian/control
dpkg-buildpackage -uc -us -rfakeroot ${DPKGBPFLAGS}
debsrc: debian/control
dpkg-buildpackage -S -uc -us -rfakeroot ${DPKGBPFLAGS}
debian/control: Makefile $(SOURCES)
echo -e '/^$$/,$$d\nw' | ed $@; \
for m in $(SOURCES:.cpp=); do \
PKG="yate-extra-$$m"; \
DESCR=`perl -e 'while(<>) { last if /^ \*\s*$$/ } while(<>) { last unless /^ \*\s*$$/ } /^ \*\s*(\S.+)/ && print $$1;' $${m}.cpp`; \
echo "" >> $@; \
echo "Package: $${PKG}" >> $@; \
echo 'Architecture: any' >> $@; \
echo 'Depends: $${shlibs:Depends}, $${misc:Depends}' >> $@; \
echo "Description: $${DESCR}" >> $@; \
echo "debian/tmp$(MODSDIR)/$$m.yate" > debian/$${PKG}.install; \
done
for m in $(CONFIGS:.conf=); do \
PKG="yate-extra-$$m"; \
echo "debian/tmp$(CONFDIR)/$$m.conf" >> debian/$${PKG}.install; \
done
echo "" >> $@; \
echo "Package: yate-extra-tests" >> $@; \
echo 'Architecture: any' >> $@; \
echo 'Depends: $${shlibs:Depends}, $${misc:Depends}' >> $@; \
echo "Description: tests for extra modules" >> $@; \
echo "" > debian/yate-extra-tests.install; \
for m in $(TESTS_S:.cpp=); do \
echo "debian/tmp$(MODSDIR)/$$m.yate" >> debian/yate-extra-tests.install; \
done
sysvipc.yate: sysvipc.cpp
g++ -Wall -O2 ${MOREFLAGS} $(DEBUG) `yate-config --c-all` `yate-config --ld-all` -lyatescript -o $@ $^