Commit: 09602160b7434d213738d4630950862c1010abaa
Parent: b1dc580b60bbac8cacaa47d1cb2b8a6765c5d143
Author: Randy Palamar
Date: Thu, 3 Nov 2022 20:31:40 -0600
update makefile to be closer to upstream dmenu
also move LIBS out of LDFLAGS and INCS out of CFLAGS to make packaging
easier
Diffstat:
4 files changed, 32 insertions(+), 42 deletions(-)
diff --git a/Makefile b/Makefile
@@ -4,63 +4,54 @@
include config.mk
SRC = pinentry-dmenu.c drw.c util.c
-OBJ = ${SRC:.c=.o}
+OBJ = $(SRC:.c=.o)
OBJ_PIN = pinentry/pinentry.o pinentry/util.o pinentry/password-cache.o pinentry/argparse.o pinentry/secmem.o
all: options pinentry-dmenu
options:
@echo pinentry-dmenu build options:
- @echo "CFLAGS = ${CFLAGS}"
- @echo "LDFLAGS = ${LDFLAGS}"
- @echo "CC = ${CC}"
+ @echo "CFLAGS = $(CFLAGS)"
+ @echo "LDFLAGS = $(LDFLAGS)"
+ @echo "CC = $(CC)"
.c.o:
- @echo CC $<
- @${CC} -c ${CFLAGS} $<
+ $(CC) -c $(CFLAGS) $(INCS) $<
config.h:
- @echo creating $@ from config.def.h
- @cp config.def.h $@
+ cp config.def.h $@
-${OBJ}: config.h config.mk drw.h
+$(OBJ): config.h config.mk drw.h
pinentry:
$(MAKE) -C pinentry
pinentry-dmenu: pinentry pinentry-dmenu.o drw.o util.o
- @echo CC -o $@
- @${CC} -o $@ ${OBJ} ${OBJ_PIN} ${LDFLAGS} -lassuan -lgpgme -lgpg-error
+ $(CC) -o $@ $(OBJ) $(OBJ_PIN) $(LDFLAGS) $(LIBS)
clean:
- @echo cleaning
- @rm -f pinentry-dmenu ${OBJ}
+ rm -f pinentry-dmenu $(OBJ)
$(MAKE) -C pinentry/ clean
dist: clean
- @echo creating dist tarball
- @mkdir -p dmenu-${VERSION}
- @cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1 \
- drw.h util.h dmenu_path dmenu_run stest.1 ${SRC} \
- dmenu-${VERSION}
- @tar -cf dmenu-${VERSION}.tar dmenu-${VERSION}
- @gzip dmenu-${VERSION}.tar
- @rm -rf dmenu-${VERSION}
+ mkdir -p pinentry-dmenu-$(VERSION)
+ cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1 \
+ drw.h util.h $(SRC) \
+ pinentry-dmenu-$(VERSION)
+ tar -cf pinentry-dmenu-$(VERSION).tar pinentry-dmenu-$(VERSION)
+ gzip pinentry-dmenu-$(VERSION).tar
+ rm -rf pinentry-dmenu-$(VERSION)
install: all
- @echo installing executable to ${DESTDIR}${PREFIX}/bin
- @mkdir -p ${DESTDIR}${PREFIX}/bin
- @cp -f pinentry-dmenu ${DESTDIR}${PREFIX}/bin
- @chmod 755 ${DESTDIR}${PREFIX}/bin/pinentry-dmenu
- @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
- @mkdir -p ${DESTDIR}${MANPREFIX}/man1
- @sed "s/VERSION/${VERSION}/g;s/DATE/${DATE}/g;s/BUGREPORT/${BUGREPORT}/g" < pinentry-dmenu.1 > ${DESTDIR}${MANPREFIX}/man1/pinentry-dmenu.1
- @chmod 644 ${DESTDIR}${MANPREFIX}/man1/pinentry-dmenu.1
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ cp -f pinentry-dmenu $(DESTDIR)$(PREFIX)/bin
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/pinentry-dmenu
+ mkdir -p $(DESTDIR)$(MANPREFIX)/man1
+ sed "s/VERSION/$(VERSION)/g" < pinentry-dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/pinentry-dmenu.1
+ chmod 644 $(DESTDIR)$(MANPREFIX)/man1/pinentry-dmenu.1
uninstall:
- @echo removing executable from ${DESTDIR}${PREFIX}/bin
- @rm -f ${DESTDIR}${PREFIX}/bin/pinentry-dmenu
- @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
- @rm -f ${DESTDIR}${MANPREFIX}/man1/pinentry-dmenu.1
+ rm -f $(DESTDIR)$(PREFIX)/bin/pinentry-dmenu
+ rm -f $(DESTDIR)$(MANPREFIX)/man1/pinentry-dmenu.1
.PHONY: all options clean dist install pinentry uninstall
diff --git a/config.h b/config.def.h
diff --git a/config.mk b/config.mk
@@ -1,11 +1,10 @@
# Pinentry settings
-DATE = $$(date +'%B %Y')
VERSION = 0.1
BUGREPORT = https:\/\/github.com\/ritze\/pinentry-dmenu
# Paths
PREFIX = /usr/local
-MANPREFIX = ${PREFIX}/share/man
+MANPREFIX = $(PREFIX)/share/man
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
@@ -18,16 +17,16 @@ XINERAMAFLAGS = -DXINERAMA
FREETYPELIBS = -lfontconfig -lXft
FREETYPEINC = /usr/include/freetype2
# OpenBSD (uncomment)
-#FREETYPEINC = ${X11INC}/freetype2
+#FREETYPEINC = $(X11INC)/freetype2
# Includes and libs
-INCS = -I${X11INC} -I${FREETYPEINC}
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
+INCS = -I$(X11INC) -I$(FREETYPEINC)
+LIBS = -lassuan -lgpgme -lgpg-error -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS)
# Flags
-CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} -DPACKAGE_VERSION=\"${VERSION}\" -DPACKAGE_BUGREPORT=\"${BUGREPORT}\"
-CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
-LDFLAGS = -s ${LIBS}
+CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS) -DPACKAGE_VERSION=\"$(VERSION)\" -DPACKAGE_BUGREPORT=\"$(BUGREPORT)\"
+CFLAGS = -std=c99 -pedantic -Wall -Os $(CPPFLAGS)
+LDFLAGS = -s
# Compiler and linker
CC = cc
diff --git a/pinentry-dmenu.1 b/pinentry-dmenu.1
@@ -1,4 +1,4 @@
-.TH PINENTRY-DMENU 1 "DATE" pinentry-dmenu\-VERSION "pinentry-dmenu Manual"
+.TH PINENTRY-DMENU 1 pinentry-dmenu\-VERSION "pinentry-dmenu Manual"
.SH NAME