]> git.cameronkatri.com Git - pw-darwin.git/blob - chpass/Makefile
Fix PREFIX logic
[pw-darwin.git] / chpass / Makefile
1 CC ?= aarch64-apple-darwin-clang
2 STRIP ?= aarch64-apple-darwin-strip
3 LDID ?= ldid
4 CFLAGS ?= -arch arm64 -isysroot /home/cameron/Documents/SDK/iPhoneOS14.3.sdk -miphoneos-version-min=13.0
5 LDFLAGS ?=
6 MEMO_PREFIX ?=
7 MEMO_SUB_PREFIX ?= /usr
8 DESTDIR ?=
9
10 SRC := chpass.c \
11 edit.c \
12 field.c \
13 table.c \
14 util.c \
15 ../libutil/pw_util.c \
16 ../libutil/flopen.c \
17 ../libc/gen/pw_scan.c
18
19 all: chpass
20
21 install: install-chpass
22
23 chpass: $(SRC:%.c=%.o) ../ent.xml
24 $(CC) $(LDFLAGS) -o $@ -lcrypt $(SRC:%.c=%.o)
25 $(STRIP) $@
26 $(LDID) -S../ent.xml $@
27
28 %.o: %.c
29 $(CC) $(CFLAGS) -c -o $@ $< -I. -I../libutil -I../libc/gen
30
31 install-chpass: chpass chpass.1
32 install -d $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/bin \
33 $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/share/man/man1
34 install -m4555 chpass $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/bin/chpass
35 ln -sf chpass $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/bin/chfn
36 ln -sf chpass $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/bin/chsh
37 install -Dm644 chpass.1 $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/share/man/man1/chpass.1
38 ln -sf chpass.1 $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/share/man/man1/chfn.1
39 ln -sf chpass.1 $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/share/man/man1/chsh.1
40
41 clean:
42 rm -f chpass $(SRC:%.c=%.o)
43
44 .PHONY: all install install-chpass clean