comparison Makefile @ 19:5c6155c8e9b6

Handle signals Handled signals are generally blocked and only unblocked when doing blocking I/O, i.e. either when reading commands or printing results. A (possibly queued) signal will then interrupt I/O and can be dealt with in the main loop.
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Fri, 01 Sep 2017 22:33:41 +0200
parents 1e39a251cbe9
children eb5ce870eb16
comparison
equal deleted inserted replaced
18:1e39a251cbe9 19:5c6155c8e9b6
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_ARC4RANDOM ?= 0 80 HAVE_ARC4RANDOM ?= 0
81 HAVE_ASPRINTF ?= 1 81 HAVE_ASPRINTF ?= 1
82 HAVE_CLOSEFROM ?= 0
82 HAVE_ERR_H ?= 1 83 HAVE_ERR_H ?= 1
83 HAVE_GETRANDOM ?= 0 84 HAVE_GETRANDOM ?= 0
84 HAVE_SYS_QUEUE_H ?= 0 85 HAVE_SYS_QUEUE_H ?= 0
85 HAVE_SETPROGNAME ?= 0 86 HAVE_SETPROGNAME ?= 0
86 HAVE_SYS_TREE_H ?= 0 87 HAVE_SYS_TREE_H ?= 0
87 else ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly),) 88 else ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly),)
88 HAVE_ARC4RANDOM ?= 1 89 HAVE_ARC4RANDOM ?= 1
89 HAVE_ASPRINTF ?= 1 90 HAVE_ASPRINTF ?= 1
91 HAVE_CLOSEFROM ?= 1
90 HAVE_ERR_H ?= 1 92 HAVE_ERR_H ?= 1
91 HAVE_GETRANDOM ?= 0 93 HAVE_GETRANDOM ?= 0
92 HAVE_SYS_QUEUE_H ?= 1 94 HAVE_SYS_QUEUE_H ?= 1
93 HAVE_SETPROGNAME ?= 1 95 HAVE_SETPROGNAME ?= 1
94 HAVE_SYS_TREE_H ?= 1 96 HAVE_SYS_TREE_H ?= 1
95 else ifeq ($(OS_NAME),NetBSD) 97 else ifeq ($(OS_NAME),NetBSD)
96 HAVE_ARC4RANDOM ?= 1 98 HAVE_ARC4RANDOM ?= 1
97 HAVE_ASPRINTF ?= 1 99 HAVE_ASPRINTF ?= 1
100 HAVE_CLOSEFROM ?= 1
98 HAVE_ERR_H ?= 1 101 HAVE_ERR_H ?= 1
99 HAVE_GETRANDOM ?= 0 102 HAVE_GETRANDOM ?= 0
100 HAVE_SYS_QUEUE_H ?= 1 103 HAVE_SYS_QUEUE_H ?= 1
101 HAVE_SYS_TREE_H ?= 1 104 HAVE_SYS_TREE_H ?= 1
102 HAVE_SETPROGNAME ?= 1 105 HAVE_SETPROGNAME ?= 1
103 else ifeq ($(OS_NAME),OpenBSD) 106 else ifeq ($(OS_NAME),OpenBSD)
104 HAVE_ARC4RANDOM ?= 1 107 HAVE_ARC4RANDOM ?= 1
105 HAVE_ASPRINTF ?= 1 108 HAVE_ASPRINTF ?= 1
109 HAVE_CLOSEFROM ?= 1
106 HAVE_ERR_H ?= 1 110 HAVE_ERR_H ?= 1
107 HAVE_GETRANDOM ?= 0 111 HAVE_GETRANDOM ?= 0
108 HAVE_SYS_QUEUE_H ?= 1 112 HAVE_SYS_QUEUE_H ?= 1
109 HAVE_SYS_TREE_H ?= 1 113 HAVE_SYS_TREE_H ?= 1
110 HAVE_SETPROGNAME ?= 1 114 HAVE_SETPROGNAME ?= 1
118 HAVE_ARC4RANDOM ?= 1 122 HAVE_ARC4RANDOM ?= 1
119 HAVE_ASPRINTF ?= 1 123 HAVE_ASPRINTF ?= 1
120 HAVE_ERR_H ?= 1 124 HAVE_ERR_H ?= 1
121 HAVE_GETRANDOM ?= 1 125 HAVE_GETRANDOM ?= 1
122 endif 126 endif
127 HAVE_CLOSEFROM ?= 1
123 HAVE_SYS_QUEUE_H ?= 0 128 HAVE_SYS_QUEUE_H ?= 0
124 HAVE_SYS_TREE_H ?= 0 129 HAVE_SYS_TREE_H ?= 0
125 HAVE_SETPROGNAME ?= 0 130 HAVE_SETPROGNAME ?= 0
126 else 131 else
127 HAVE_ARC4RANDOM ?= 0 132 HAVE_ARC4RANDOM ?= 0
128 HAVE_ASPRINTF ?= 0 133 HAVE_ASPRINTF ?= 0
134 HAVE_CLOSEFROM ?= 0
129 HAVE_ERR_H ?= 0 135 HAVE_ERR_H ?= 0
130 HAVE_GETRANDOM ?= 0 136 HAVE_GETRANDOM ?= 0
131 HAVE_SYS_QUEUE_H ?= 0 137 HAVE_SYS_QUEUE_H ?= 0
132 HAVE_SETPROGNAME ?= 0 138 HAVE_SETPROGNAME ?= 0
133 HAVE_SYS_TREE_H ?= 0 139 HAVE_SYS_TREE_H ?= 0
134 endif 140 endif
135 141
136 OBJS = cmd.o \ 142 OBJS = cmd.o \
143 io.o \
137 pager.o \ 144 pager.o \
145 proc.o \
138 pw.o \ 146 pw.o \
139 pwfile.o \ 147 pwfile.o \
140 pwm.o \ 148 pwm.o \
141 tok.o \ 149 tok.o \
142 util.o 150 util.o
163 else ifeq ($(HAVE_GETRANDOM),1) 171 else ifeq ($(HAVE_GETRANDOM),1)
164 XCPPFLAGS += -DHAVE_GETRANDOM 172 XCPPFLAGS += -DHAVE_GETRANDOM
165 OBJS += rand-getrandom.o 173 OBJS += rand-getrandom.o
166 else 174 else
167 OBJS += rand-dev-random.o 175 OBJS += rand-dev-random.o
176 endif
177 ifeq ($(HAVE_CLOSEFROM),1)
178 XCPPFLAGS += -DHAVE_CLOSEFROM
179 else
180 OBJS += compat/closefrom.o
168 endif 181 endif
169 ifeq ($(HAVE_ERR_H),1) 182 ifeq ($(HAVE_ERR_H),1)
170 XCPPFLAGS += -DHAVE_ERR_H 183 XCPPFLAGS += -DHAVE_ERR_H
171 else 184 else
172 OBJS += compat/err.o 185 OBJS += compat/err.o