]> git.cameronkatri.com Git - snaprestore.git/blob - Makefile
Fix build
[snaprestore.git] / Makefile
1 CC ?= aarch64-apple-darwin-clang
2 STRIP ?= aarch64-apple-darwin-strip
3 LDID ?= ldid
4 INSTALL ?= install
5 FAKEROOT ?= fakeroot
6 PREFIX ?= /usr
7 TARGET_SYSROOT ?= /home/cameron/Documents/SDK/iPhoneOS14.2.sdk
8 CFLAGS ?= -arch arm64 -isysroot $(TARGET_SYSROOT) -miphoneos-version-min=13.0
9
10 DEB_MAINTAINER ?= Cameron Katri <me@cameronkatri.com>
11 DEB_ARCH ?= iphoneos-arm
12 SNAPRESTORE_V := 0.3
13 DEB_SNAPRESTORE := $(SNAPRESTORE_V)
14
15 all: build/snaprestore
16
17 build/snaprestore: src/snaprestore.m src/ent.xml
18 mkdir -p build
19 $(CC) $(CFLAGS) -o $@ $< -framework IOKit -framework Foundation -framework CoreServices -fobjc-arc
20 $(STRIP) $@
21 $(LDID) -S$(word 2,$^) $@
22
23 install: build/snaprestore LICENSE
24 $(INSTALL) -Dm755 $< $(DESTDIR)$(PREFIX)/bin/snaprestore
25 $(INSTALL) -Dm644 $(word 2,$^) $(DESTDIR)$(PREFIX)/share/snaprestore/$(word 2,$^)
26
27 package: install
28 rm -rf staging
29 mkdir -p staging
30 cp -a $(DESTDIR)$(PREFIX) staging
31 $(FAKEROOT) chown -R 0:0 staging
32 SIZE=$$(du -s staging | cut -f 1); \
33 $(INSTALL) -Dm755 src/snaprestore.control staging/DEBIAN/control; \
34 sed -i ':a; s/@DEB_SNAPRESTORE@/$(DEB_SNAPRESTORE)/g; ta' staging/DEBIAN/control; \
35 sed -i ':a; s/@DEB_MAINTAINER@/$(DEB_MAINTAINER)/g; ta' staging/DEBIAN/control; \
36 sed -i ':a; s/@DEB_ARCH@/$(DEB_ARCH)/g; ta' staging/DEBIAN/control; \
37 cd staging && find . -type f ! -regex '.*.hg.*' ! -regex '.*?debian-binary.*' ! -regex '.*?DEBIAN.*' -printf '"%P" ' | xargs md5sum > DEBIAN/md5sum; \
38 cd ..; \
39 echo "Installed-Size: $$SIZE" >> staging/DEBIAN/control
40 $(FAKEROOT) dpkg-deb -z9 -b staging build
41 rm -rf staging
42
43 uninstall:
44 rm -f $(DESTDIR)$(PREFIX)/bin/snaprestore
45 rm -rf $(DESTDIR)$(PREFIX)/share/snaprestore
46
47 clean:
48 rm -f build/snaprestore
49
50 .PHONY: all package uninstall clean