comparison Makefile @ 12:8768fbd09bc5

Add generatepassword command to generate random passwords Refactor and generalize handling of named arguments.
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Thu, 03 Aug 2017 10:22:07 +0200
parents 25e227eba3da
children a08ef0674d8e
comparison
equal deleted inserted replaced
11:85bce13237cf 12:8768fbd09bc5
75 75
76 OS_NAME := $(shell uname -s) 76 OS_NAME := $(shell uname -s)
77 OS_RELEASE := $(shell uname -r) 77 OS_RELEASE := $(shell uname -r)
78 78
79 ifeq ($(OS_NAME),Linux) 79 ifeq ($(OS_NAME),Linux)
80 HAVE_ASPRINTF ?= 1 80 HAVE_ARC4RANDOM ?= 0
81 HAVE_ERR_H ?= 1 81 HAVE_ASPRINTF ?= 1
82 HAVE_ERR_H ?= 1
83 HAVE_GETRANDOM ?= 0
82 HAVE_READPASSPHRASE_H ?= 0 84 HAVE_READPASSPHRASE_H ?= 0
83 HAVE_SETPROGNAME ?= 0 85 HAVE_SETPROGNAME ?= 0
84 HAVE_SYS_TREE_H ?= 0 86 HAVE_SYS_TREE_H ?= 0
85 else ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly),) 87 else ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly),)
86 HAVE_ASPRINTF ?= 1 88 HAVE_ARC4RANDOM ?= 1
87 HAVE_ERR_H ?= 1 89 HAVE_ASPRINTF ?= 1
90 HAVE_ERR_H ?= 1
91 HAVE_GETRANDOM ?= 0
88 HAVE_READPASSPHRASE_H ?= 1 92 HAVE_READPASSPHRASE_H ?= 1
89 HAVE_SETPROGNAME ?= 1 93 HAVE_SETPROGNAME ?= 1
90 HAVE_SYS_TREE_H ?= 1 94 HAVE_SYS_TREE_H ?= 1
91 else ifeq ($(OS_NAME),NetBSD) 95 else ifeq ($(OS_NAME),NetBSD)
92 HAVE_ASPRINTF ?= 1 96 HAVE_ARC4RANDOM ?= 1
93 HAVE_ERR_H ?= 1 97 HAVE_ASPRINTF ?= 1
98 HAVE_ERR_H ?= 1
99 HAVE_GETRANDOM ?= 0
94 HAVE_READPASSPHRASE_H ?= 0 100 HAVE_READPASSPHRASE_H ?= 0
95 HAVE_SYS_TREE_H ?= 1 101 HAVE_SYS_TREE_H ?= 1
96 HAVE_SETPROGNAME ?= 1 102 HAVE_SETPROGNAME ?= 1
97 else ifeq ($(OS_NAME),OpenBSD) 103 else ifeq ($(OS_NAME),OpenBSD)
98 HAVE_ASPRINTF ?= 1 104 HAVE_ARC4RANDOM ?= 1
99 HAVE_ERR_H ?= 1 105 HAVE_ASPRINTF ?= 1
106 HAVE_ERR_H ?= 1
107 HAVE_GETRANDOM ?= 0
100 HAVE_READPASSPHRASE_H ?= 1 108 HAVE_READPASSPHRASE_H ?= 1
101 HAVE_SYS_TREE_H ?= 1 109 HAVE_SYS_TREE_H ?= 1
102 HAVE_SETPROGNAME ?= 1 110 HAVE_SETPROGNAME ?= 1
103 else ifeq ($(OS_NAME),SunOS) 111 else ifeq ($(OS_NAME),SunOS)
104 ifeq ($(OS_RELEASE),5.10) 112 ifeq ($(OS_RELEASE),5.10)
113 HAVE_ARC4RANDOM ?= 0
105 HAVE_ASPRINTF ?= 0 114 HAVE_ASPRINTF ?= 0
106 HAVE_ERR_H ?= 0 115 HAVE_ERR_H ?= 0
116 HAVE_GETRANDOM ?= 0
107 else 117 else
118 HAVE_ARC4RANDOM ?= 1
108 HAVE_ASPRINTF ?= 1 119 HAVE_ASPRINTF ?= 1
109 HAVE_ERR_H ?= 1 120 HAVE_ERR_H ?= 1
121 HAVE_GETRANDOM ?= 1
110 endif 122 endif
111 HAVE_READPASSPHRASE_H ?= 0 123 HAVE_READPASSPHRASE_H ?= 0
112 HAVE_SYS_TREE_H ?= 0 124 HAVE_SYS_TREE_H ?= 0
113 HAVE_SETPROGNAME ?= 0 125 HAVE_SETPROGNAME ?= 0
114 else 126 else
127 HAVE_ARC4RANDOM ?= 0
115 HAVE_ASPRINTF ?= 0 128 HAVE_ASPRINTF ?= 0
116 HAVE_ERR_H ?= 0 129 HAVE_ERR_H ?= 0
130 HAVE_GETRANDOM ?= 0
117 HAVE_READPASSPHRASE_H ?= 0 131 HAVE_READPASSPHRASE_H ?= 0
118 HAVE_SETPROGNAME ?= 0 132 HAVE_SETPROGNAME ?= 0
119 HAVE_SYS_TREE_H ?= 0 133 HAVE_SYS_TREE_H ?= 0
120 endif 134 endif
121 135
122 OBJS = cmd.o \ 136 OBJS = cmd.o \
137 pw.o \
123 pwfile.o \ 138 pwfile.o \
124 pwm.o \ 139 pwm.o \
125 tok.o \ 140 tok.o \
126 util.o 141 util.o
127 142
138 LDLIBS = -lpws -lnettle 153 LDLIBS = -lpws -lnettle
139 ifeq ($(HAVE_ASPRINTF),1) 154 ifeq ($(HAVE_ASPRINTF),1)
140 XCPPFLAGS += -DHAVE_ASPRINTF 155 XCPPFLAGS += -DHAVE_ASPRINTF
141 else 156 else
142 OBJS += compat/asprintf.o 157 OBJS += compat/asprintf.o
158 endif
159 ifeq ($(HAVE_ARC4RANDOM),1)
160 XCPPFLAGS += -DHAVE_ARC4RANDOM
161 OBJS += rand-arc4random.o
162 else ifeq ($(HAVE_GETRANDOM),1)
163 XCPPFLAGS += -DHAVE_GETRANDOM
164 OBJS += rand-getrandom.o
165 else
166 OBJS += rand-dev-random.o
143 endif 167 endif
144 ifeq ($(HAVE_ERR_H),1) 168 ifeq ($(HAVE_ERR_H),1)
145 XCPPFLAGS += -DHAVE_ERR_H 169 XCPPFLAGS += -DHAVE_ERR_H
146 else 170 else
147 OBJS += compat/err.o 171 OBJS += compat/err.o