pinentry-dmenu

a pinentry program based on dmenu
git clone anongit@rnpnr.xyz:pinentry-dmenu.git
Log | Files | Refs | Feed | README | LICENSE

Commit: c16c40ef0195c772aac6d24dc15eabb4a384a550
Parent: c5ae60970e4fef2428b182541e9df772c36060c8
Author: Randy Palamar
Date:   Sat,  5 Nov 2022 18:25:11 -0600

include pinentry files in the main Makefile

no need for a subprocess just to compile a couple files

also remove unused secmem++.h file

Diffstat:
MMakefile | 27+++++++++++++++++++--------
Mconfig.mk | 4++--
Dpinentry/Makefile | 21---------------------
Dpinentry/secmem++.h | 91-------------------------------------------------------------------------------
4 files changed, 21 insertions(+), 122 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,11 +1,24 @@ # pinentry-dmenu - dmenu-like stupid pin entry # See LICENSE file for copyright and license details. +.POSIX: include config.mk SRC = pinentry-dmenu.c drw.c util.c OBJ = $(SRC:.c=.o) -OBJ_PIN = pinentry/pinentry.o pinentry/util.o pinentry/password-cache.o pinentry/argparse.o pinentry/secmem.o +PIN_SRC = \ + pinentry/argparse.c\ + pinentry/password-cache.c\ + pinentry/pinentry.c\ + pinentry/secmem.c\ + pinentry/util.c +PIN_OBJ = $(PIN_SRC:.c=.o) +PIN_DEP = \ + pinentry/argparse.h\ + pinentry/password-cache.h\ + pinentry/pinentry.h\ + pinentry/memory.h\ + pinentry/util.h all: options pinentry-dmenu @@ -16,22 +29,20 @@ options: @echo "CC = $(CC)" .c.o: - $(CC) -c $(CFLAGS) $(INCS) $< + $(CC) -c $(CFLAGS) $(INCS) $(CPPFLAGS) -o $@ -c $< config.h: cp config.def.h $@ $(OBJ): config.h config.mk drw.h -pinentry: - $(MAKE) -C pinentry +$(PIN_OBJ): $(PIN_DEPS) -pinentry-dmenu: pinentry pinentry-dmenu.o drw.o util.o - $(CC) -o $@ $(OBJ) $(OBJ_PIN) $(LDFLAGS) $(LIBS) +pinentry-dmenu: $(OBJ) $(PIN_OBJ) + $(CC) -o $@ $(OBJ) $(PIN_OBJ) $(LDFLAGS) $(LIBS) clean: - rm -f pinentry-dmenu $(OBJ) - $(MAKE) -C pinentry/ clean + rm -f pinentry-dmenu $(OBJ) $(PIN_OBJ) dist: clean mkdir -p pinentry-dmenu-$(VERSION) diff --git a/config.mk b/config.mk @@ -24,8 +24,8 @@ INCS = -I$(X11INC) -I$(FREETYPEINC) LIBS = -lassuan -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 $(CPPFLAGS) +CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS) -DPACKAGE_VERSION=\"$(VERSION)\" -DPACKAGE_BUGREPORT=\"$(BUGREPORT)\" -DHAVE_MLOCK +CFLAGS = -std=c99 -pedantic -Wall -Os LDFLAGS = -s # Compiler and linker diff --git a/pinentry/Makefile b/pinentry/Makefile @@ -1,21 +0,0 @@ -include ../config.mk - -SRC = util.c pinentry.c argparse.c password-cache.c secmem.c -OBJ = ${SRC:.c=.o} -CFLAGS += -DHAVE_MLOCK - -all: pinentry - -.c.o: - @echo CC $< - @${CC} -c ${CFLAGS} $< - -${OBJ}: pinentry.h argparse.h password-cache.h memory.h util.h - -pinentry: pinentry.o argparse.o password-cache.o secmem.o util.o - -clean: - @echo cleaning - @rm -f ${OBJ} - -.PHONY: all clean pinentry diff --git a/pinentry/secmem++.h b/pinentry/secmem++.h @@ -1,91 +0,0 @@ -/* STL allocator for secmem - * Copyright (C) 2008 Marc Mutz <marc@kdab.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SECMEM_SECMEMPP_H__ -#define __SECMEM_SECMEMPP_H__ - -#include "secmem/memory.h" -#include <cstddef> - -namespace secmem { - - template <typename T> - class alloc { - public: - // type definitions: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef T value_type; - - // rebind - template <typename U> - struct rebind { - typedef alloc<U> other; - }; - - // address - pointer address( reference value ) const { - return &value; - } - const_pointer address( const_reference value ) const { - return &value; - } - - // (trivial) ctors and dtors - alloc() {} - alloc( const alloc & ) {} - template <typename U> alloc( const alloc<U> & ) {} - // copy ctor is ok - ~alloc() {} - - // de/allocation - size_type max_size() const { - return secmem_get_max_size(); - } - - pointer allocate( size_type n, void * =0 ) { - return static_cast<pointer>( secmem_malloc( n * sizeof(T) ) ); - } - - void deallocate( pointer p, size_type ) { - secmem_free( p ); - } - - // de/construct - void construct( pointer p, const T & value ) { - void * loc = p; - new (loc)T(value); - } - void destruct( pointer p ) { - p->~T(); - } - }; - - // equality comparison - template <typename T1,typename T2> - bool operator==( const alloc<T1> &, const alloc<T2> & ) { return true; } - template <typename T1, typename T2> - bool operator!=( const alloc<T1> &, const alloc<T2> & ) { return false; } - -} - -#endif /* __SECMEM_SECMEMPP_H__ */