-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.ios
48 lines (37 loc) · 1.32 KB
/
Makefile.ios
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
BINDIR ?= bin
PREFIX ?= usr
DESTDIR ?= /
BUILDDIR := ./build/ios
SRC := $(wildcard src/*.m) $(wildcard src/FindProcess/*.m)
OBJ := $(SRC:%.m=$(BUILDDIR)/%.o)
CFLAGS := -ObjC -O2 -g -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -Isrc/FindProcess
CPPFLAGS := $(CFLAGS)
LDFLAGS := -framework Foundation -framework MobileCoreServices -framework UIKit -Isrc/FindProcess
LDFLAGS_MAC := -framework Foundation -framework CoreServices -framework AppKit -Isrc/FindProcess
LDID := ldid
TARGET := lsdtrip_ios
CC = xcrun -sdk iphoneos clang -arch arm64
.PHONY: all clean
all: $(TARGET)
$(BUILDDIR)/%.o: %.m $(BUILDDIR)/%.d Makefile
@mkdir -p $(dir $@)
@$(CC) -c $(CFLAGS) -o $@ $<
$(DESTDIR)/$(PREFIX)/$(BINDIR):
mkdir -p $@
$(BUILDDIR)/$(TARGET).bin: $(OBJ)
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
$(TARGET): $(BUILDDIR)/$(TARGET).bin
@$(LDID) -Sent.plist $^
@cp $^ $@
install: all | $(DESTDIR)/$(PREFIX)/$(BINDIR)
cp $(TARGET) $(DESTDIR)/$(PREFIX)/$(BINDIR)/
clean:
rm -rf $(TARGET) $(BUILDDIR)/$(TARGET).bin $(BUILDDIR)/*.o $(BUILDDIR)/*.d $(BUILDDIR)/**/*.o $(BUILDDIR)/**/*.d
$(BUILDDIR)/%.d: %.m
@mkdir -p $(dir $@)
@echo generating depends for $<
@set -e; rm -f $@; \
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
-include $(SRC:.m=.d)