Mercurial > projects > pwm
comparison Makefile @ 26:5bdea77d0c1d
Add pwm-clip utility for setting the X11 CLIPBOARD selection
author | Guido Berhoerster <guido+pwm@berhoerster.name> |
---|---|
date | Thu, 21 Sep 2017 09:45:59 +0200 |
parents | 616385fa1fd9 |
children | 722a45b4028b |
comparison
equal
deleted
inserted
replaced
25:616385fa1fd9 | 26:5bdea77d0c1d |
---|---|
81 ifeq ($(OS_NAME),Linux) | 81 ifeq ($(OS_NAME),Linux) |
82 HAVE_ARC4RANDOM ?= 0 | 82 HAVE_ARC4RANDOM ?= 0 |
83 HAVE_ASPRINTF ?= 1 | 83 HAVE_ASPRINTF ?= 1 |
84 HAVE_CLOSEFROM ?= 0 | 84 HAVE_CLOSEFROM ?= 0 |
85 HAVE_ERR_H ?= 1 | 85 HAVE_ERR_H ?= 1 |
86 HAVE_GETLINE ?= 0 | |
86 HAVE_GETRANDOM ?= 0 | 87 HAVE_GETRANDOM ?= 0 |
87 HAVE_SYS_QUEUE_H ?= 0 | 88 HAVE_SYS_QUEUE_H ?= 0 |
88 HAVE_SETPROGNAME ?= 0 | 89 HAVE_SETPROGNAME ?= 0 |
89 HAVE_SYS_TREE_H ?= 0 | 90 HAVE_SYS_TREE_H ?= 0 |
90 else ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly),) | 91 else ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly),) |
91 HAVE_ARC4RANDOM ?= 1 | 92 HAVE_ARC4RANDOM ?= 1 |
92 HAVE_ASPRINTF ?= 1 | 93 HAVE_ASPRINTF ?= 1 |
93 HAVE_CLOSEFROM ?= 1 | 94 HAVE_CLOSEFROM ?= 1 |
94 HAVE_ERR_H ?= 1 | 95 HAVE_ERR_H ?= 1 |
96 HAVE_GETLINE ?= 1 | |
95 HAVE_GETRANDOM ?= 0 | 97 HAVE_GETRANDOM ?= 0 |
96 HAVE_SYS_QUEUE_H ?= 1 | 98 HAVE_SYS_QUEUE_H ?= 1 |
97 HAVE_SETPROGNAME ?= 1 | 99 HAVE_SETPROGNAME ?= 1 |
98 HAVE_SYS_TREE_H ?= 1 | 100 HAVE_SYS_TREE_H ?= 1 |
99 else ifeq ($(OS_NAME),NetBSD) | 101 else ifeq ($(OS_NAME),NetBSD) |
100 HAVE_ARC4RANDOM ?= 1 | 102 HAVE_ARC4RANDOM ?= 1 |
101 HAVE_ASPRINTF ?= 1 | 103 HAVE_ASPRINTF ?= 1 |
102 HAVE_CLOSEFROM ?= 1 | 104 HAVE_CLOSEFROM ?= 1 |
103 HAVE_ERR_H ?= 1 | 105 HAVE_ERR_H ?= 1 |
106 HAVE_GETLINE ?= 1 | |
104 HAVE_GETRANDOM ?= 0 | 107 HAVE_GETRANDOM ?= 0 |
105 HAVE_SYS_QUEUE_H ?= 1 | 108 HAVE_SYS_QUEUE_H ?= 1 |
106 HAVE_SYS_TREE_H ?= 1 | 109 HAVE_SYS_TREE_H ?= 1 |
107 HAVE_SETPROGNAME ?= 1 | 110 HAVE_SETPROGNAME ?= 1 |
108 else ifeq ($(OS_NAME),OpenBSD) | 111 else ifeq ($(OS_NAME),OpenBSD) |
109 HAVE_ARC4RANDOM ?= 1 | 112 HAVE_ARC4RANDOM ?= 1 |
110 HAVE_ASPRINTF ?= 1 | 113 HAVE_ASPRINTF ?= 1 |
111 HAVE_CLOSEFROM ?= 1 | 114 HAVE_CLOSEFROM ?= 1 |
112 HAVE_ERR_H ?= 1 | 115 HAVE_ERR_H ?= 1 |
116 HAVE_GETLINE ?= 1 | |
113 HAVE_GETRANDOM ?= 0 | 117 HAVE_GETRANDOM ?= 0 |
114 HAVE_SYS_QUEUE_H ?= 1 | 118 HAVE_SYS_QUEUE_H ?= 1 |
115 HAVE_SYS_TREE_H ?= 1 | 119 HAVE_SYS_TREE_H ?= 1 |
116 HAVE_SETPROGNAME ?= 1 | 120 HAVE_SETPROGNAME ?= 1 |
117 else ifeq ($(OS_NAME),SunOS) | 121 else ifeq ($(OS_NAME),SunOS) |
118 ifeq ($(OS_RELEASE),5.10) | 122 ifeq ($(OS_RELEASE),5.10) |
119 HAVE_ARC4RANDOM ?= 0 | 123 HAVE_ARC4RANDOM ?= 0 |
120 HAVE_ASPRINTF ?= 0 | 124 HAVE_ASPRINTF ?= 0 |
121 HAVE_ERR_H ?= 0 | 125 HAVE_ERR_H ?= 0 |
126 HAVE_GETLINE ?= 0 | |
122 HAVE_GETRANDOM ?= 0 | 127 HAVE_GETRANDOM ?= 0 |
123 else | 128 else |
124 HAVE_ARC4RANDOM ?= 1 | 129 HAVE_ARC4RANDOM ?= 1 |
125 HAVE_ASPRINTF ?= 1 | 130 HAVE_ASPRINTF ?= 1 |
126 HAVE_ERR_H ?= 1 | 131 HAVE_ERR_H ?= 1 |
132 HAVE_GETLINE ?= 1 | |
127 HAVE_GETRANDOM ?= 1 | 133 HAVE_GETRANDOM ?= 1 |
128 endif | 134 endif |
129 HAVE_CLOSEFROM ?= 1 | 135 HAVE_CLOSEFROM ?= 1 |
130 HAVE_SYS_QUEUE_H ?= 0 | 136 HAVE_SYS_QUEUE_H ?= 0 |
131 HAVE_SYS_TREE_H ?= 0 | 137 HAVE_SYS_TREE_H ?= 0 |
133 else | 139 else |
134 HAVE_ARC4RANDOM ?= 0 | 140 HAVE_ARC4RANDOM ?= 0 |
135 HAVE_ASPRINTF ?= 0 | 141 HAVE_ASPRINTF ?= 0 |
136 HAVE_CLOSEFROM ?= 0 | 142 HAVE_CLOSEFROM ?= 0 |
137 HAVE_ERR_H ?= 0 | 143 HAVE_ERR_H ?= 0 |
144 HAVE_GETLINE ?= 0 | |
138 HAVE_GETRANDOM ?= 0 | 145 HAVE_GETRANDOM ?= 0 |
139 HAVE_SYS_QUEUE_H ?= 0 | 146 HAVE_SYS_QUEUE_H ?= 0 |
140 HAVE_SETPROGNAME ?= 0 | 147 HAVE_SETPROGNAME ?= 0 |
141 HAVE_SYS_TREE_H ?= 0 | 148 HAVE_SYS_TREE_H ?= 0 |
142 endif | 149 endif |
146 LIBCOMPAT_LIB_MEMBERS = $(LIBCOMPAT_OBJS:%.o=$(LIBCOMPAT_LIB)(%.o)) | 153 LIBCOMPAT_LIB_MEMBERS = $(LIBCOMPAT_OBJS:%.o=$(LIBCOMPAT_LIB)(%.o)) |
147 | 154 |
148 LIBPWM_OBJS = util.o | 155 LIBPWM_OBJS = util.o |
149 LIBPWM_LIB = libpwm.a | 156 LIBPWM_LIB = libpwm.a |
150 LIBPWM_LIB_MEMBERS = $(LIBPWM_OBJS:%.o=$(LIBPWM_LIB)(%.o)) | 157 LIBPWM_LIB_MEMBERS = $(LIBPWM_OBJS:%.o=$(LIBPWM_LIB)(%.o)) |
158 | |
159 PWM_CLIP_OBJS = pwm-clip.o | |
160 PWM_CLIP_BIN = pwm-clip | |
161 PWM_CLIP_MAN1 = pwm-clip.1 | |
151 | 162 |
152 PWM_OBJS = cmd.o \ | 163 PWM_OBJS = cmd.o \ |
153 io.o \ | 164 io.o \ |
154 pager.o \ | 165 pager.o \ |
155 proc.o \ | 166 proc.o \ |
156 pw.o \ | 167 pw.o \ |
157 pwfile.o \ | 168 pwfile.o \ |
158 pwm.o \ | 169 pwm.o \ |
159 tok.o | 170 tok.o |
160 PWM_BIN = $(PACKAGE) | 171 PWM_BIN = $(PACKAGE) |
161 | 172 PWM_MAN1 = pwm.1 |
162 OBJS = $(LIBCOMPAT_OBJS) $(LIBPWM_OBJS) $(PWM_OBJS) | 173 |
163 | 174 OBJS = $(LIBCOMPAT_OBJS) $(LIBPWM_OBJS) $(PWM_CLIP_OBJS) $(PWM_OBJS) |
164 MANPAGES = pwm.1 | 175 |
176 MANPAGES = $(PWM_MAN1) $(PWM_CLIP_MAN1) | |
165 | 177 |
166 .DEFAULT_TARGET = all | 178 .DEFAULT_TARGET = all |
167 | 179 |
168 .PHONY: all clean clobber dist install | 180 .PHONY: all clean clobber dist install |
169 | 181 |
170 all: $(PWM_BIN) $(MANPAGES) | 182 all: $(PWM_BIN) $(PWM_CLIP_BIN) $(MANPAGES) |
171 | 183 |
172 $(PWM_BIN): XCPPFLAGS += -DPACKAGE=\"$(PACKAGE)\" \ | 184 $(PWM_BIN): XCPPFLAGS += -DPACKAGE=\"$(PACKAGE)\" \ |
173 -DVERSION=\"$(VERSION)\" | 185 -DVERSION=\"$(VERSION)\" |
174 $(PWM_BIN): LDLIBS = -ltecla -lcurses -lpws -lnettle | 186 $(PWM_BIN): LDLIBS = -ltecla -lcurses -lpws -lnettle |
187 $(PWM_CLIP_BIN): XCPPFLAGS += -Icompat/include | |
188 $(PWM_CLIP_BIN): LDLIBS = -lnettle | |
175 ifeq ($(HAVE_ASPRINTF),1) | 189 ifeq ($(HAVE_ASPRINTF),1) |
176 XCPPFLAGS += -DHAVE_ASPRINTF | 190 XCPPFLAGS += -DHAVE_ASPRINTF |
177 else | 191 else |
178 LIBCOMPAT_OBJS += compat/asprintf.o | 192 LIBCOMPAT_OBJS += compat/asprintf.o |
179 endif | 193 endif |
194 ifeq ($(HAVE_ERR_H),1) | 208 ifeq ($(HAVE_ERR_H),1) |
195 XCPPFLAGS += -DHAVE_ERR_H | 209 XCPPFLAGS += -DHAVE_ERR_H |
196 else | 210 else |
197 LIBCOMPAT_OBJS += compat/err.o | 211 LIBCOMPAT_OBJS += compat/err.o |
198 endif | 212 endif |
213 ifeq ($(HAVE_GETLINE),1) | |
214 XCPPFLAGS += -DHAVE_GETLINE | |
215 else | |
216 LIBCOMPAT_OBJS += compat/getline.o | |
217 endif | |
199 ifeq ($(HAVE_SETPROGNAME),1) | 218 ifeq ($(HAVE_SETPROGNAME),1) |
200 XCPPFLAGS += -DHAVE_SETPROGNAME | 219 XCPPFLAGS += -DHAVE_SETPROGNAME |
201 else | 220 else |
202 LIBCOMPAT_OBJS += compat/setprogname.o | 221 LIBCOMPAT_OBJS += compat/setprogname.o |
203 endif | 222 endif |
221 | 240 |
222 $(LIBCOMPAT_LIB): $(LIBCOMPAT_LIB_MEMBERS) | 241 $(LIBCOMPAT_LIB): $(LIBCOMPAT_LIB_MEMBERS) |
223 | 242 |
224 $(LIBPWM_LIB): $(LIBPWM_LIB_MEMBERS) | 243 $(LIBPWM_LIB): $(LIBPWM_LIB_MEMBERS) |
225 | 244 |
245 $(PWM_CLIP_BIN): $(PWM_CLIP_OBJS) $(LIBPWM_LIB) $(LIBCOMPAT_LIB) | |
246 $(LINK.o) $^ $(LDLIBS) -o $@ | |
247 | |
248 $(eval $(call generate-manpage-rule,$(PWM_CLIP_MAN1))) | |
249 | |
226 $(PWM_BIN): $(PWM_OBJS) $(LIBPWM_LIB) $(LIBCOMPAT_LIB) | 250 $(PWM_BIN): $(PWM_OBJS) $(LIBPWM_LIB) $(LIBCOMPAT_LIB) |
227 $(LINK.o) $^ $(LDLIBS) -o $@ | 251 $(LINK.o) $^ $(LDLIBS) -o $@ |
228 | 252 |
229 $(eval $(call generate-manpage-rule,$(MANPAGES))) | 253 $(eval $(call generate-manpage-rule,$(PWM_MAN1))) |
230 | 254 |
231 %.o: %.c | 255 %.o: %.c |
232 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d | 256 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d |
233 $(COMPILE.c) -o $@ $< | 257 $(COMPILE.c) -o $@ $< |
234 | 258 |
236 $(AR) $(ARFLAGS) $@ $< | 260 $(AR) $(ARFLAGS) $@ $< |
237 $(RANLIB) $@ | 261 $(RANLIB) $@ |
238 | 262 |
239 install: all | 263 install: all |
240 $(INSTALL.exec) $(PWM_BIN) "$(DESTDIR)$(bindir)/$(PWM_BIN)" | 264 $(INSTALL.exec) $(PWM_BIN) "$(DESTDIR)$(bindir)/$(PWM_BIN)" |
265 $(INSTALL.exec) $(PWM_CLIP_BIN) "$(DESTDIR)$(bindir)/$(PWM_CLIP_BIN)" | |
241 for manpage in $(MANPAGES); do \ | 266 for manpage in $(MANPAGES); do \ |
242 if [ -L $${manpage} ]; then \ | 267 if [ -L $${manpage} ]; then \ |
243 $(INSTALL.link) $${manpage} \ | 268 $(INSTALL.link) $${manpage} \ |
244 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ | 269 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ |
245 else \ | 270 else \ |
247 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ | 272 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ |
248 fi \ | 273 fi \ |
249 done | 274 done |
250 | 275 |
251 clean: | 276 clean: |
252 rm -f $(LIBCOMPAT_LIB) $(LIBPWM_LIB) $(PWM_BIN) $(OBJS) $(MANPAGES) | 277 rm -f $(LIBCOMPAT_LIB) $(LIBPWM_LIB) $(PWM_CLIP_BIN) $(PWM_BIN) \ |
278 $(OBJS) $(MANPAGES) | |
253 | 279 |
254 clobber: clean | 280 clobber: clean |
255 rm -f $(patsubst %.o,%.d,$(OBJS)) | 281 rm -f $(patsubst %.o,%.d,$(OBJS)) |
256 | 282 |
257 dist: clobber | 283 dist: clobber |