commit 033215015d6bd58495b6d72c5591acbda72e3aa7 from: Alexander Arkhipov date: Sun Aug 21 14:43:18 2022 UTC simplify the Makefile commit - aab4ecb3230db0dcbc642eed1587b9fa8d02e383 commit + 033215015d6bd58495b6d72c5591acbda72e3aa7 blob - 20cec39567a184f525c65c0e76a82a9965d2e1ae blob + 4a1ba9270937652c9e291f90d4df8afbb253bfbc --- Makefile +++ Makefile @@ -7,29 +7,27 @@ OBJ = $(BIN:=.o) SRC = $(BIN:=.c) MAN = $(BIN:=.1) -all: $(BIN) +all: options $(BIN) +options: + @echo gpass build options: + @echo " CFLAGS = $(CFLAGS)" + @echo " LDFLAGS = $(LDFLAGS)" + @echo " CC = $(CC)" + $(BIN): $(OBJ) - $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LDFLAGS_EXTRA) + $(CC) -o $@ $(OBJ) $(LDFLAGS) $(OBJ): config.mk .c.o: - $(CC) -DPREFIX=\"$(PREFIX)\"\ - $(CFLAGS) $(CFLAGS_EXTRA) $(CPPFLAGS) $(CPPFLAGS_EXTRA) -c $< + $(CC) -DPREFIX=\"$(PREFIX)\" $(CFLAGS) $(CPPFLAGS) -c $< -debug: clean - $(MAKE)\ - CFLAGS_EXTRA='$(CFLAGS_EXTRA) $(CFLAGS_DEBUG)'\ - CPPFLAGS_EXTRA='$(CPPFLAGS_EXTRA) $(CPPFLAGS_DEBUG)'\ - LDFLAGS_EXTRA='$(LDFLAGS_EXTRA) $(LDFLAGS_DEBUG)' - install: all mkdir -p $(DESTDIR)$(PREFIX)/bin install -m 755 $(BIN) $(DESTDIR)$(PREFIX)/bin/ mkdir -p $(DESTDIR)$(MANPREFIX)/man1 - sed s=/usr/local=$(PREFIX)=g gpass.1\ - >$(DESTDIR)$(MANPREFIX)/man1/gpass.1 + sed s=/usr/local=$(PREFIX)=g gpass.1 >$(DESTDIR)$(MANPREFIX)/man1/gpass.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/gpass.1 mkdir -p $(DESTDIR)$(PREFIX)/share/gpass install -m 644 eff.long $(DESTDIR)$(PREFIX)/share/gpass @@ -39,15 +37,15 @@ uninstall: cd $(DESTDIR)$(MANPREFIX)/man1 && rm -f $(MAN) cd $(DESTDIR)$(PREFIX)/share && rm -rf gpass +clean: + -rm -f $(BIN) $(OBJ) + -rm -f gpass-$(VERSION).tar.gz + -rm -f *.core + dist: clean mkdir -p gpass-$(VERSION) cp -rf README Makefile config.mk eff.long $(SRC) $(MAN) gpass-$(VERSION) tar -czf gpass-$(VERSION).tar.gz gpass-$(VERSION) rm -rf gpass-$(VERSION) -clean: - -rm -f $(BIN) $(OBJ) - -rm -f gpass-$(VERSION).tar.gz - -rm -f *.core - -.PHONY: all debug install uninstall clean dist +.PHONY: all options install uninstall clean dist blob - dbfae525678efaff2ba8accb85e0eee22fc70bff blob + c754a6c3f3456e3d881bca99ff38ea1a827b8012 --- config.mk +++ config.mk @@ -1,17 +1,25 @@ VERSION = 0.1 -# NOTE: avoid equality signs (`=') in PREFIX, or edit the rule install. PREFIX = /usr/local MANPREFIX = $(PREFIX)/man +# Linux +#MANPREFIX = $(PREFIX)/share/man -INCS = -I/usr/local/include -LIBS = -L/usr/local/lib -lm -lsodium +LIBS = -lm -lsodium +# OpenBSD +#INCS = -I/usr/local/include +#LIBS = -L/usr/local/lib -lm -lsodium CC = cc CPPFLAGS = -D_DEFAULT_SOURCE -CFLAGS = -std=c99 -Wall -pedantic $(INCS) +CFLAGS = -std=c99 -Wall -pedantic $(INCS) -O2 LDFLAGS = $(LIBS) -CFLAGS_EXTRA = -fstack-protector-strong -O2 -fPIE -CPPFLAGS_EXTRA = -D_FORTIFY_SOURCE=2 -LDFLAGS_EXTRA = -pie -Wl,-z,relro -Wl,-z,now -CFLAGS_DEBUG = -Wextra -Wformat -Wformat-security -fstack-protector-all -O0 -g + +# Libbsd +#CFLAGS = -std=c99 -Wall -pedantic -O2 -DLIBBSD_OVERLAY -isystem /usr/include/bsd $(INCS) +#LDFLAGS = -lbsd $(LIBS) + +# Debug +#CFLAGS = -std=c99 -Wall -pedantic $(INCS) -Wextra -O0 -g +# Libbsd+debug +#CFLAGS = -std=c99 -Wall -pedantic -DLIBBSD_OVERLAY -isystem /usr/include/bsd $(INCS) -Wextra -O0 -g