comparison 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
comparison
equal deleted inserted replaced
1:e1309515d111 2:97097b4b6bfb
97 97
98 ifeq ($(OS_NAME),Linux) 98 ifeq ($(OS_NAME),Linux)
99 HAVE_ARC4RANDOM ?= 0 99 HAVE_ARC4RANDOM ?= 0
100 HAVE_ENDIAN_H ?= 1 100 HAVE_ENDIAN_H ?= 1
101 HAVE_SYS_ENDIAN_H ?= 0 101 HAVE_SYS_ENDIAN_H ?= 0
102 HAVE_GETENTROPY ?= 0 102 HAVE_ERR_H ?= 1
103 HAVE_GETENTROPY ?= 0
104 HAVE_GETLINE ?= 0
105 HAVE_SETPROGNAME ?= 0
106 HAVE_READPASSPHRASE_H ?= 0
103 HAVE_SYS_TREE_H ?= 0 107 HAVE_SYS_TREE_H ?= 0
108 HAVE_VIS_H ?= 0
104 else ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly),) 109 else ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly),)
105 HAVE_ARC4RANDOM ?= 1 110 HAVE_ARC4RANDOM ?= 1
106 HAVE_ENDIAN_H ?= 0 111 HAVE_ENDIAN_H ?= 0
107 HAVE_SYS_ENDIAN_H ?= 1 112 HAVE_SYS_ENDIAN_H ?= 1
108 HAVE_GETENTROPY ?= 0 113 HAVE_ERR_H ?= 1
114 HAVE_GETENTROPY ?= 0
115 HAVE_GETLINE ?= 1
116 HAVE_SETPROGNAME ?= 1
117 HAVE_READPASSPHRASE_H ?= 1
109 HAVE_SYS_TREE_H ?= 1 118 HAVE_SYS_TREE_H ?= 1
119 HAVE_VIS_H ?= 1
110 else ifeq ($(OS_NAME),NetBSD) 120 else ifeq ($(OS_NAME),NetBSD)
111 HAVE_ARC4RANDOM ?= 1 121 HAVE_ARC4RANDOM ?= 1
112 HAVE_ENDIAN_H ?= 0 122 HAVE_ENDIAN_H ?= 0
113 HAVE_SYS_ENDIAN_H ?= 1 123 HAVE_SYS_ENDIAN_H ?= 1
114 HAVE_GETENTROPY ?= 0 124 HAVE_ERR_H ?= 1
125 HAVE_GETENTROPY ?= 0
126 HAVE_GETLINE ?= 1
127 HAVE_SETPROGNAME ?= 1
128 HAVE_READPASSPHRASE_H ?= 0
115 HAVE_SYS_TREE_H ?= 1 129 HAVE_SYS_TREE_H ?= 1
130 HAVE_VIS_H ?= 1
116 else ifeq ($(OS_NAME),OpenBSD) 131 else ifeq ($(OS_NAME),OpenBSD)
117 HAVE_ARC4RANDOM ?= 1 132 HAVE_ARC4RANDOM ?= 1
118 HAVE_ENDIAN_H ?= 0 133 HAVE_ENDIAN_H ?= 0
119 HAVE_SYS_ENDIAN_H ?= 1 134 HAVE_SYS_ENDIAN_H ?= 1
135 HAVE_ERR_H ?= 1
120 HAVE_GETENTROPY ?= 1 136 HAVE_GETENTROPY ?= 1
137 HAVE_GETLINE ?= 1
138 HAVE_SETPROGNAME ?= 1
139 HAVE_READPASSPHRASE_H ?= 1
121 HAVE_SYS_TREE_H ?= 1 140 HAVE_SYS_TREE_H ?= 1
141 HAVE_VIS_H ?= 1
122 else ifeq ($(OS_NAME),SunOS) 142 else ifeq ($(OS_NAME),SunOS)
123 HAVE_ARC4RANDOM ?= 0 143 HAVE_ARC4RANDOM ?= 0
124 HAVE_ENDIAN_H ?= 0 144 HAVE_ENDIAN_H ?= 0
125 HAVE_SYS_ENDIAN_H ?= 0 145 HAVE_SYS_ENDIAN_H ?= 0
126 HAVE_GETENTROPY ?= 0 146 HAVE_GETENTROPY ?= 0
147 ifeq ($(OS_RELEASE),5.10)
148 HAVE_ERR_H ?= 0
149 HAVE_GETLINE ?= 0
150 else
151 HAVE_ERR_H ?= 1
152 HAVE_GETLINE ?= 1
153 endif
154 HAVE_SETPROGNAME ?= 0
155 HAVE_READPASSPHRASE_H ?= 0
127 HAVE_SYS_TREE_H ?= 0 156 HAVE_SYS_TREE_H ?= 0
157 HAVE_VIS_H ?= 0
128 else 158 else
129 HAVE_ARC4RANDOM ?= 0 159 HAVE_ARC4RANDOM ?= 0
130 HAVE_ENDIAN_H ?= 0 160 HAVE_ENDIAN_H ?= 0
131 HAVE_SYS_ENDIAN_H ?= 0 161 HAVE_SYS_ENDIAN_H ?= 0
132 HAVE_GETENTROPY ?= 0 162 HAVE_ERR_H ?= 0
163 HAVE_GETENTROPY ?= 0
164 HAVE_GETLINE ?= 0
165 HAVE_SETPROGNAME ?= 0
166 HAVE_READPASSPHRASE_H ?= 0
133 HAVE_SYS_TREE_H ?= 0 167 HAVE_SYS_TREE_H ?= 0
168 HAVE_VIS_H ?= 0
134 endif 169 endif
135 170
136 LIBPWS_OBJS = pws.o \ 171 LIBPWS_OBJS = pws.o \
137 pws-file.o \ 172 pws-file.o \
138 pws-record.o \ 173 pws-record.o \
139 pws-field.o \ 174 pws-field.o \
140 pws-random.o 175 pws-random.o
141 LIBPWS_LIB = $(PACKAGE).a 176 LIBPWS_LIB = $(PACKAGE).a
142 LIBPWS_LIB_MEMBERS = $(LIBPWS_OBJS:%.o=$(LIBPWS_LIB)(%.o)) 177 LIBPWS_LIB_MEMBERS = $(LIBPWS_OBJS:%.o=$(LIBPWS_LIB)(%.o))
143 178
144 OBJS = $(LIBPWS_OBJS) 179 PWSDUMP_BIN = pwsdump
180 PWSDUMP_OBJS = pwsdump.o
181
182 OBJS = $(LIBPWS_OBJS) $(PWSDUMP_OBJS)
145 183
146 LIBPWS_MANPAGES = libpws.3 184 LIBPWS_MANPAGES = libpws.3
147 185
148 PWS_INIT_MANPAGES = pws_init.3 \ 186 PWS_INIT_MANPAGES = pws_init.3 \
149 pws_finalize.3 \ 187 pws_finalize.3 \
210 248
211 .DEFAULT_TARGET = all 249 .DEFAULT_TARGET = all
212 250
213 .PHONY: all clean clobber dist install 251 .PHONY: all clean clobber dist install
214 252
215 all: $(LIBPWS_LIB) $(MANPAGES) 253 all: $(PWSDUMP_BIN) $(LIBPWS_LIB) $(MANPAGES)
216 254
217 doc: $(MANPAGES) $(XHTML_DOCUMENTATION) 255 doc: $(MANPAGES) $(XHTML_DOCUMENTATION)
218 256
219 XCPPFLAGS = -Iinclude 257 XCPPFLAGS = -Iinclude
220 ifeq ($(HAVE_ARC4RANDOM),1) 258 ifeq ($(HAVE_ARC4RANDOM),1)
224 XCPPFLAGS += -DHAVE_ENDIAN_H 262 XCPPFLAGS += -DHAVE_ENDIAN_H
225 else ifeq ($(HAVE_SYS_ENDIAN_H),1) 263 else ifeq ($(HAVE_SYS_ENDIAN_H),1)
226 XCPPFLAGS += -DHAVE_SYS_ENDIAN_H 264 XCPPFLAGS += -DHAVE_SYS_ENDIAN_H
227 else 265 else
228 LIBPWS_OBJS += compat/endian.o 266 LIBPWS_OBJS += compat/endian.o
267 PWSDUMP_OBJS += compat/endian.o
268 endif
269 ifeq ($(HAVE_ERR_H),1)
270 XCPPFLAGS += -DHAVE_ERR_H
271 else
272 PWSDUMP_OBJS += compat/err.o
229 endif 273 endif
230 ifeq ($(HAVE_GETENTROPY),1) 274 ifeq ($(HAVE_GETENTROPY),1)
231 XCPPFLAGS += -DHAVE_GETENTROPY 275 XCPPFLAGS += -DHAVE_GETENTROPY
232 else 276 else
233 LIBPWS_OBJS += compat/getentropy.o 277 LIBPWS_OBJS += compat/getentropy.o
234 endif 278 endif
279 ifeq ($(HAVE_GETLINE),1)
280 XCPPFLAGS += -DHAVE_GETLINE
281 else
282 PWSDUMP_OBJS += compat/getline.o
283 endif
284 ifeq ($(HAVE_READPASSPHRASE_H),1)
285 XCPPFLAGS += -DHAVE_READPASSPHRASE_H
286 else
287 PWSDUMP_OBJS += compat/readpassphrase.o
288 endif
289 ifeq ($(HAVE_SETPROGNAME),1)
290 XCPPFLAGS += -DHAVE_SETPROGNAME
291 else
292 PWSDUMP_OBJS += compat/setprogname.o
293 endif
235 ifeq ($(HAVE_SYS_TREE_H),1) 294 ifeq ($(HAVE_SYS_TREE_H),1)
236 XCPPFLAGS += -DHAVE_SYS_TREE_H 295 XCPPFLAGS += -DHAVE_SYS_TREE_H
296 endif
297 ifeq ($(HAVE_VIS_H),1)
298 XCPPFLAGS += -DHAVE_VIS_H
299 else
300 PWSDUMP_OBJS += compat/vis.o compat/unvis.o
237 endif 301 endif
238 ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),) 302 ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),)
239 XCPPFLAGS += -I/usr/local/include 303 XCPPFLAGS += -I/usr/local/include
240 XLDFLAGS += -L/usr/local/lib 304 XLDFLAGS += -L/usr/local/lib
241 else ifeq ($(OS_NAME),NetBSD) 305 else ifeq ($(OS_NAME),NetBSD)
255 $(eval $(call generate-manpage-rule,$(LIBPWS_MANPAGES))) 319 $(eval $(call generate-manpage-rule,$(LIBPWS_MANPAGES)))
256 320
257 $(eval $(call generate-manpage-rule,$(PWS_INIT_MANPAGES))) 321 $(eval $(call generate-manpage-rule,$(PWS_INIT_MANPAGES)))
258 322
259 $(eval $(call generate-manpage-rule,$(PWS3_FILE_CREATE_MANPAGES))) 323 $(eval $(call generate-manpage-rule,$(PWS3_FILE_CREATE_MANPAGES)))
324
325 $(PWSDUMP_BIN): $(PWSDUMP_OBJS) $(LIBPWS_LIB) -lnettle
260 326
261 %.o: %.c 327 %.o: %.c
262 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d 328 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
263 $(COMPILE.c) -o $@ $< 329 $(COMPILE.c) -o $@ $<
264 330
295 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ 361 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
296 fi \ 362 fi \
297 done 363 done
298 364
299 clean: 365 clean:
300 rm -f $(LIBPWS_LIB) $(LIBPWS_OBJS) $(MANPAGES) \ 366 rm -f $(LIBPWS_LIB) $(PWSDUMP_BIN) $(OBJS) $(MANPAGES) \
301 $(XHTML_DOCUMENTATION) 367 $(XHTML_DOCUMENTATION)
302 368
303 clobber: clean 369 clobber: clean
304 rm -f $(patsubst %.o,%.d,$(OBJS)) 370 rm -f $(patsubst %.o,%.d,$(OBJS))
305 371