]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - pw/Makefile
Assume manpages are compressed with zst
[pw-darwin.git] / pw / Makefile
index 69953da1a6a677d5517510bd6120b35ed44db1c1..dc57d1d2f10dd9e1084b70d4ebfa34790be3d95b 100644 (file)
@@ -1,19 +1,57 @@
-# $FreeBSD$
+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         ?=
+GINSTALL        ?= install
+PREFIX          ?= /usr
+DESTDIR         ?=
 
-PROG=  pw
-MAN=   pw.conf.5 pw.8
-SRCS=  pw.c pw_conf.c pw_user.c pw_group.c pw_log.c pw_nis.c pw_vpw.c \
-       grupd.c pwupd.c fileupd.c psdate.c \
-       bitmap.c cpdir.c rm_r.c
+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
 
-WARNS?=        2
+LIBUTILSRC := ../libutil/login_cap.c \
+       ../libutil/pw_util.c \
+       ../libutil/gr_util.c \
+       ../libutil/flopen.c \
+       ../libutil/login_crypt.c \
+       ../libutil/_secure_path.c
 
-LIBADD=        crypt util sbuf
+LIBCSRC := ../libc/stdlib/strtonum.c \
+       ../libc/gen/pw_scan.c
 
-.include <src.opts.mk>
+all: pw
 
-.if ${MK_TESTS} != "no"
-SUBDIR+=       tests
-.endif
+install: install-pw
 
-.include <bsd.prog.mk>
+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
+       $(GINSTALL) -Dm755 pw $(DESTDIR)/$(PREFIX)/sbin/pw
+       $(GINSTALL) -Dm644 pw.8 $(DESTDIR)/$(PREFIX)/share/man/man8/pw.8
+       $(GINSTALL) -Dm644 pw.conf.5 $(DESTDIR)/$(PREFIX)/share/man/man5/pw.conf.5
+       mkdir -p $(DESTDIR)/$(PREFIX)/share/skel
+
+clean:
+       rm -f pw $(SRC:%.c=%.o) $(LIBCSRC:%.c=%.o) $(LIBUTILSRC:%.c=%.o)
+
+.PHONY: all install install-pw clean