forked from ProcursusTeam/launchctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (23 loc) · 974 Bytes
/
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
PREFIX ?=
DESTDIR ?=
SRC := attach.c blame.c bootstrap.c enable.c env.c error.c examine.c kickstart.c
SRC += kill.c launchctl.c limit.c list.c load.c manager.c plist.c print.c reboot.c
SRC += remove.c runstats.c start_stop.c userswitch.c version.c xpc_helper.c
SRC += plistpatch.m
CFLAGS += -fobjc-arc -Werror
ifeq ($(DEBUG),1)
CFLAGS += -O0 -g -fsanitize=address,undefined -fno-omit-frame-pointer
LDFLAGS += -O0 -g -fsanitize=address,undefined -fno-omit-frame-pointer
endif
all: launchctl
%.o: %.m
$(CC) $(CFLAGS) -c $< -o $@
launchctl: $(SRC:.c=.o) $(SRC:.m=.o) Info.plist launchctl.xml
$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.o,$^) $(LOADLIBES) $(LDLIBS) -o $@ -Wl,-sectcreate,__TEXT,__info_plist,Info.plist
ldid -Icom.apple.xpc.launchctl -Slaunchctl.xml -Cadhoc launchctl
clean:
rm -rf launchctl launchctl.dSYM *.o
install: launchctl
install -d $(DESTDIR)$(PREFIX)/bin/
install -m755 launchctl $(DESTDIR)$(PREFIX)/bin/launchctl
.PHONY: all clean install