X-Git-Url: https://git.cameronkatri.com/pw-darwin.git/blobdiff_plain/f8169403d8544ad1b4afe9e690f9d0b5e7aa9cac..HEAD:/pw/Makefile diff --git a/pw/Makefile b/pw/Makefile index 69953da..a673ef7 100644 --- a/pw/Makefile +++ b/pw/Makefile @@ -1,19 +1,60 @@ -# $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 ?= +MEMO_PREFIX ?= +MEMO_SUB_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 +all: pw -.if ${MK_TESTS} != "no" -SUBDIR+= tests -.endif +install: install-pw -.include +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)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/share/skel \ + $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/sbin \ + $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/share/man/man5 \ + $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/share/man/man8 + install -m755 pw $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/sbin/pw + install -m644 pw.8 $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_PREFIX)/share/man/man8/pw.8 + install -m644 pw.conf.5 $(DESTDIR)/$(MEMO_PREFIX)$(MEMO_SUB_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