summaryrefslogtreecommitdiffstats
path: root/pw/Makefile
blob: 6aa63083bb0f36270fa83b093a63989f658bd757 (plain) (blame)
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
49
50
51
52
53
54
55
56
57
58
59
CC              ?= aarch64-apple-darwin-clang
STRIP           ?= aarch64-apple-darwin-strip
LDID            ?= ldid
CFLAGS          ?= -arch arm64  -isysroot /home/cameron/Documents/SDK/iPhoneOS14.3.sdk -miphoneos-version-min=13.0
LDFLAGS         ?=
PREFIX          ?= $(MEMO_PREFIX)$(MEMO_SUB_PREFIX)
DESTDIR         ?=

SRC := pw_utils.c \
	pw_user.c \
	pw_conf.c \
	bitmap.c \
	psdate.c \
	pw_nis.c \
	pw.c \
	grupd.c \
	pwupd.c \
	pw_group.c \
	rm_r.c \
	pw_log.c \
	strtounum.c \
	pw_vpw.c \
	cpdir.c

LIBUTILSRC := ../libutil/login_cap.c \
	../libutil/pw_util.c \
	../libutil/gr_util.c \
	../libutil/flopen.c \
	../libutil/login_crypt.c \
	../libutil/_secure_path.c

LIBCSRC := ../libc/stdlib/strtonum.c \
	../libc/gen/pw_scan.c

all: pw

install: install-pw

pw: $(SRC:%.c=%.o) $(LIBCSRC:%.c=%.o) $(LIBUTILSRC:%.c=%.o) ../ent.xml
	$(CC) $(LDFLAGS) -o $@ -lcrypt $(SRC:%.c=%.o) $(LIBCSRC:%.c=%.o) $(LIBUTILSRC:%.c=%.o)
	$(STRIP) $@
	$(LDID) -S../ent.xml $@

%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $< -I. -I../libutil -I../libc/gen

install-pw: pw pw.8 pw.conf.5
	install -d $(DESTDIR)/$(PREFIX)/share/skel \
		$(DESTDIR)/$(PREFIX)/sbin \
		$(DESTDIR)/$(PREFIX)/share/man/man5 \
		$(DESTDIR)/$(PREFIX)/share/man/man8
	install -m755 pw $(DESTDIR)/$(PREFIX)/sbin/pw
	install -m644 pw.8 $(DESTDIR)/$(PREFIX)/share/man/man8/pw.8
	install -m644 pw.conf.5 $(DESTDIR)/$(PREFIX)/share/man/man5/pw.conf.5

clean:
	rm -f pw $(SRC:%.c=%.o) $(LIBCSRC:%.c=%.o) $(LIBUTILSRC:%.c=%.o)

.PHONY: all install install-pw clean