]> git.saurik.com Git - cycript.git/blame_incremental - rules.old
Clean up dependencies now that they are tracked.
[cycript.git] / rules.old
... / ...
CommitLineData
1PACKAGE_TARNAME := @PACKAGE_TARNAME@
2
3CY_ATTACH_GROUP := @CY_ATTACH_GROUP@
4
5ifneq ($(git),)
6version := $(shell $(git) describe --always --tags --dirty="+" --match="v*" | $(sed) -e 's@-\([^-]*\)-\([^-]*\)$$@+\1.\2@;s@^v@@')
7else
8version := @PACKAGE_VERSION@
9endif
10
11lib := lib
12dll := @SO@
13depends ?=
14
15ifdef arch
16deb := $(shell grep ^Package: $(srcdir)/control.in | cut -d ' ' -f 2-)_$(shell grep ^Version: $(srcdir)/control.in | cut -d ' ' -f 2 | $(sed) -e 's/\#/$(version)/')_$(arch).deb
17
18ifeq ($(depends)$(dll),dylib)
19control.tmp: control.in .libs/cycript .libs/$(lib)cycript.dylib
20 $(sed) -e 's/&/'"$$(dpkg-query -S $$(otool -lah .libs/cycript .libs/*.dylib | grep dylib | grep -v ':$$' | $(sed) -e 's/^ *name //;s/ (offset [0-9]*)$$//' | sort -u) 2>/dev/null | $(sed) -e 's/:.*//; /^cycript$$/ d; s/$$/,/' | sort -u | tr '\n' ' ')"'/;s/, $$//;s/#/$(version)/;s/%/$(arch)/' $< >$@
21else
22ifeq ($(depends)$(dll),so)
23control.tmp: control.in .libs/cycript .libs/$(lib)cycript.so
24 $(sed) -e 's/&/'"$$(dpkg-query -S $$(ldd cycript $(lib)cycript.so | $(sed) -e '/:$$/ d; s/^[ \t]*\([^ ]* => \)\?\([^ ]*\) .*/\2/' | sort -u) 2>/dev/null | $(sed) -e 's/:.*//; /^cycript$$/ d; s/$$/,/' | sort -u | tr '\n' ' ')"'/;s/, $$//;s/#/$(version)/;s/%/$(arch)/' $< >$@
25else
26control.tmp: control.in
27 $(sed) -e 's/&/$(depends)/;s/,$$//;s/#/$(version)/;s/%/$(arch)/' $< >$@
28endif
29endif
30
31control: control.tmp
32 [[ -e control ]] && diff control control.tmp &>/dev/null || cp -pRf control.tmp control
33
34$(deb): $(all) control
35 rm -rf package
36 mkdir -p package/DEBIAN
37 cp -pR control package/DEBIAN
38 mkdir -p package/usr/{bin,lib,sbin}
39 cp -pR .libs/$(lib)cycript.0.$(dll) package/usr/lib
40 cp -pR .libs/$(lib)cycript.$(dll) package/usr/lib
41 cp -pR .libs/cycript package/usr/bin
42 dpkg-deb -b package $(deb)
43endif
44
45clean::
46 rm -rf control
47
48libcycript.la: $(code)
49 $(ldid) .libs/$(lib)cycript.$(dll)
50
51cycript: Console.lo libcycript.la $(inject)
52 $(entitle) .libs/cycript
53
54package: $(deb)
55
56install: cycript libcycript.la
57ifneq ($(CY_ATTACH_GROUP),)
58 chgrp $(CY_ATTACH_GROUP) $(DESTDIR)$(bindir)/cycript
59 chmod g+s $(DESTDIR)$(bindir)/cycript
60endif