diff Makefile @ 2:97097b4b6bfb

Add pwsdump utility The pwsdum utility can dump PasswordSafe database files to a plaintext format and convert this format back into a PasswordSafe database.
author Guido Berhoerster <guido+libpws@berhoerster.name>
date Wed, 01 Apr 2015 14:57:57 +0200
parents e1309515d111
children dfd3ddbdb201
line wrap: on
line diff
--- a/Makefile	Wed Mar 25 17:10:23 2015 +0100
+++ b/Makefile	Wed Apr 01 14:57:57 2015 +0200
@@ -99,38 +99,73 @@
   HAVE_ARC4RANDOM ?=	0
   HAVE_ENDIAN_H ?=	1
   HAVE_SYS_ENDIAN_H ?=	0
+  HAVE_ERR_H ?=		1
   HAVE_GETENTROPY ?=	0
+  HAVE_GETLINE ?=	0
+  HAVE_SETPROGNAME ?=	0
+  HAVE_READPASSPHRASE_H ?= 0
   HAVE_SYS_TREE_H ?=	0
+  HAVE_VIS_H ?=		0
 else ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly),)
   HAVE_ARC4RANDOM ?=	1
   HAVE_ENDIAN_H ?=	0
   HAVE_SYS_ENDIAN_H ?=	1
+  HAVE_ERR_H ?=		1
   HAVE_GETENTROPY ?=	0
+  HAVE_GETLINE ?=	1
+  HAVE_SETPROGNAME ?=	1
+  HAVE_READPASSPHRASE_H ?= 1
   HAVE_SYS_TREE_H ?=	1
+  HAVE_VIS_H ?=		1
 else ifeq ($(OS_NAME),NetBSD)
   HAVE_ARC4RANDOM ?=	1
   HAVE_ENDIAN_H ?=	0
   HAVE_SYS_ENDIAN_H ?=	1
+  HAVE_ERR_H ?=		1
   HAVE_GETENTROPY ?=	0
+  HAVE_GETLINE ?=	1
+  HAVE_SETPROGNAME ?=	1
+  HAVE_READPASSPHRASE_H ?= 0
   HAVE_SYS_TREE_H ?=	1
+  HAVE_VIS_H ?=		1
 else ifeq ($(OS_NAME),OpenBSD)
   HAVE_ARC4RANDOM ?=	1
   HAVE_ENDIAN_H ?=	0
   HAVE_SYS_ENDIAN_H ?=	1
+  HAVE_ERR_H ?=		1
   HAVE_GETENTROPY ?=	1
+  HAVE_GETLINE ?=	1
+  HAVE_SETPROGNAME ?=	1
+  HAVE_READPASSPHRASE_H ?= 1
   HAVE_SYS_TREE_H ?=	1
+  HAVE_VIS_H ?=		1
 else ifeq ($(OS_NAME),SunOS)
   HAVE_ARC4RANDOM ?=	0
   HAVE_ENDIAN_H ?=	0
   HAVE_SYS_ENDIAN_H ?=	0
   HAVE_GETENTROPY ?=	0
+  ifeq ($(OS_RELEASE),5.10)
+    HAVE_ERR_H ?=	0
+    HAVE_GETLINE ?=	0
+  else
+    HAVE_ERR_H ?=	1
+    HAVE_GETLINE ?=	1
+  endif
+  HAVE_SETPROGNAME ?=	0
+  HAVE_READPASSPHRASE_H ?= 0
   HAVE_SYS_TREE_H ?=	0
+  HAVE_VIS_H ?=		0
 else
   HAVE_ARC4RANDOM ?=	0
   HAVE_ENDIAN_H ?=	0
   HAVE_SYS_ENDIAN_H ?=	0
+  HAVE_ERR_H ?=		0
   HAVE_GETENTROPY ?=	0
+  HAVE_GETLINE ?=	0
+  HAVE_SETPROGNAME ?=	0
+  HAVE_READPASSPHRASE_H ?= 0
   HAVE_SYS_TREE_H ?=	0
+  HAVE_VIS_H ?=		0
 endif
 
 LIBPWS_OBJS =		pws.o \
@@ -141,7 +176,10 @@
 LIBPWS_LIB =		$(PACKAGE).a
 LIBPWS_LIB_MEMBERS =	$(LIBPWS_OBJS:%.o=$(LIBPWS_LIB)(%.o))
 
-OBJS =			$(LIBPWS_OBJS)
+PWSDUMP_BIN =		pwsdump
+PWSDUMP_OBJS =		pwsdump.o
+
+OBJS =			$(LIBPWS_OBJS) $(PWSDUMP_OBJS)
 
 LIBPWS_MANPAGES =	libpws.3
 
@@ -212,7 +250,7 @@
 
 .PHONY: all clean clobber dist install
 
-all: $(LIBPWS_LIB) $(MANPAGES)
+all: $(PWSDUMP_BIN) $(LIBPWS_LIB) $(MANPAGES)
 
 doc: $(MANPAGES) $(XHTML_DOCUMENTATION)
 
@@ -226,15 +264,41 @@
   XCPPFLAGS +=	-DHAVE_SYS_ENDIAN_H
 else
   LIBPWS_OBJS += compat/endian.o
+  PWSDUMP_OBJS += compat/endian.o
+endif
+ifeq ($(HAVE_ERR_H),1)
+  XCPPFLAGS +=	-DHAVE_ERR_H
+else
+  PWSDUMP_OBJS += compat/err.o
 endif
 ifeq ($(HAVE_GETENTROPY),1)
   XCPPFLAGS +=	-DHAVE_GETENTROPY
 else
   LIBPWS_OBJS += compat/getentropy.o
 endif
+ifeq ($(HAVE_GETLINE),1)
+  XCPPFLAGS +=	-DHAVE_GETLINE
+else
+  PWSDUMP_OBJS += compat/getline.o
+endif
+ifeq ($(HAVE_READPASSPHRASE_H),1)
+  XCPPFLAGS +=	-DHAVE_READPASSPHRASE_H
+else
+  PWSDUMP_OBJS += compat/readpassphrase.o
+endif
+ifeq ($(HAVE_SETPROGNAME),1)
+  XCPPFLAGS +=	-DHAVE_SETPROGNAME
+else
+  PWSDUMP_OBJS += compat/setprogname.o
+endif
 ifeq ($(HAVE_SYS_TREE_H),1)
   XCPPFLAGS +=	-DHAVE_SYS_TREE_H
 endif
+ifeq ($(HAVE_VIS_H),1)
+  XCPPFLAGS +=	-DHAVE_VIS_H
+else
+  PWSDUMP_OBJS += compat/vis.o compat/unvis.o
+endif
 ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),)
   XCPPFLAGS +=	-I/usr/local/include
   XLDFLAGS +=	-L/usr/local/lib
@@ -258,6 +322,8 @@
 
 $(eval $(call generate-manpage-rule,$(PWS3_FILE_CREATE_MANPAGES)))
 
+$(PWSDUMP_BIN): $(PWSDUMP_OBJS) $(LIBPWS_LIB) -lnettle
+
 %.o: %.c
 	$(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
 	$(COMPILE.c) -o $@ $<
@@ -297,7 +363,7 @@
 	done
 
 clean:
-	rm -f $(LIBPWS_LIB) $(LIBPWS_OBJS) $(MANPAGES) \
+	rm -f $(LIBPWS_LIB) $(PWSDUMP_BIN) $(OBJS) $(MANPAGES) \
 	    $(XHTML_DOCUMENTATION)
 
 clobber: clean