Commit: f1bd9876dc4c6328f7a4eddf37e20cd14580fe91 Parent: cad14b559fa2439f943f0a616008d29a4168012a Author: 0x766F6964 Date: Sun, 8 Dec 2019 13:15:00 -0700 add Makefile Diffstat:
A | Makefile | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 42 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile @@ -0,0 +1,42 @@ +.POSIX: + +PREFIX = /usr/local +MANPREFIX = $(PREFIX)/share/man + +CFLAGS = -O2 -Icompat -D_BSD_SOURCE +LDFLAGS = -s -static + +SRC = doas.c env.c persist.c y.tab.c\ + compat/readpassphrase.c\ + compat/reallocarray.c\ + compat/setprogname.c\ + compat/strtonum.c +OBJ = $(SRC:.c=.o) + +all: doas + +.c.o: + $(CC) $(CFLAGS) -o $@ -c $< + +y.tab.c: + yacc parse.y + +clean: + rm -f *.o compat/*.o doas y.tab.c + +doas: $(OBJ) + $(CC) -o $@ $(OBJ) $(LDFLAGS) + +install: doas + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -f doas $(DESTDIR)$(PREFIX)/bin + chmod 4555 $(DESTDIR)$(PREFIX)/bin/doas + mkdir -p $(DESTDIR)$(MANPREFIX)/man5 + cp doas.conf.5 $(DESTDIR)$(MANPREFIX)/man5/ + chmod 644 $(DESTDIR)$(MANPREFIX)/man5/doas.conf.5 + +uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/doas + rm -f $(DESTDIR)$(MANPREFIX)/man5/doas.conf.5 + +.PHONY: all clean install uninstall