Mercurial > projects > pwm
comparison Makefile @ 25:616385fa1fd9
Build common functions as a library that can be reused
author | Guido Berhoerster <guido+pwm@berhoerster.name> |
---|---|
date | Wed, 20 Sep 2017 23:57:51 +0200 |
parents | eb5ce870eb16 |
children | 5bdea77d0c1d |
comparison
equal
deleted
inserted
replaced
24:eb5ce870eb16 | 25:616385fa1fd9 |
---|---|
143 | 143 |
144 LIBCOMPAT_OBJS = compat/compat.o | 144 LIBCOMPAT_OBJS = compat/compat.o |
145 LIBCOMPAT_LIB = compat/libcompat.a | 145 LIBCOMPAT_LIB = compat/libcompat.a |
146 LIBCOMPAT_LIB_MEMBERS = $(LIBCOMPAT_OBJS:%.o=$(LIBCOMPAT_LIB)(%.o)) | 146 LIBCOMPAT_LIB_MEMBERS = $(LIBCOMPAT_OBJS:%.o=$(LIBCOMPAT_LIB)(%.o)) |
147 | 147 |
148 LIBPWM_OBJS = util.o | |
149 LIBPWM_LIB = libpwm.a | |
150 LIBPWM_LIB_MEMBERS = $(LIBPWM_OBJS:%.o=$(LIBPWM_LIB)(%.o)) | |
151 | |
148 PWM_OBJS = cmd.o \ | 152 PWM_OBJS = cmd.o \ |
149 io.o \ | 153 io.o \ |
150 pager.o \ | 154 pager.o \ |
151 proc.o \ | 155 proc.o \ |
152 pw.o \ | 156 pw.o \ |
153 pwfile.o \ | 157 pwfile.o \ |
154 pwm.o \ | 158 pwm.o \ |
155 tok.o \ | 159 tok.o |
156 util.o | |
157 PWM_BIN = $(PACKAGE) | 160 PWM_BIN = $(PACKAGE) |
158 | 161 |
159 OBJS = $(LIBCOMPAT_OBJS) $(PWM_OBJS) | 162 OBJS = $(LIBCOMPAT_OBJS) $(LIBPWM_OBJS) $(PWM_OBJS) |
160 | 163 |
161 MANPAGES = pwm.1 | 164 MANPAGES = pwm.1 |
162 | 165 |
163 .DEFAULT_TARGET = all | 166 .DEFAULT_TARGET = all |
164 | 167 |
174 else | 177 else |
175 LIBCOMPAT_OBJS += compat/asprintf.o | 178 LIBCOMPAT_OBJS += compat/asprintf.o |
176 endif | 179 endif |
177 ifeq ($(HAVE_ARC4RANDOM),1) | 180 ifeq ($(HAVE_ARC4RANDOM),1) |
178 XCPPFLAGS += -DHAVE_ARC4RANDOM | 181 XCPPFLAGS += -DHAVE_ARC4RANDOM |
179 PWM_OBJS += rand-arc4random.o | 182 LIBPWM_OBJS += rand-arc4random.o |
180 else ifeq ($(HAVE_GETRANDOM),1) | 183 else ifeq ($(HAVE_GETRANDOM),1) |
181 XCPPFLAGS += -DHAVE_GETRANDOM | 184 XCPPFLAGS += -DHAVE_GETRANDOM |
182 PWM_OBJS += rand-getrandom.o | 185 LIBPWM_OBJS += rand-getrandom.o |
183 else | 186 else |
184 PWM_OBJS += rand-dev-random.o | 187 LIBPWM_OBJS += rand-dev-random.o |
185 endif | 188 endif |
186 ifeq ($(HAVE_CLOSEFROM),1) | 189 ifeq ($(HAVE_CLOSEFROM),1) |
187 XCPPFLAGS += -DHAVE_CLOSEFROM | 190 XCPPFLAGS += -DHAVE_CLOSEFROM |
188 else | 191 else |
189 LIBCOMPAT_OBJS += compat/closefrom.o | 192 LIBCOMPAT_OBJS += compat/closefrom.o |
216 XLDFLAGS += -L/usr/xpg4/lib -R/usr/xpg4/lib | 219 XLDFLAGS += -L/usr/xpg4/lib -R/usr/xpg4/lib |
217 endif | 220 endif |
218 | 221 |
219 $(LIBCOMPAT_LIB): $(LIBCOMPAT_LIB_MEMBERS) | 222 $(LIBCOMPAT_LIB): $(LIBCOMPAT_LIB_MEMBERS) |
220 | 223 |
221 $(PWM_BIN): $(PWM_OBJS) $(LIBCOMPAT_LIB) | 224 $(LIBPWM_LIB): $(LIBPWM_LIB_MEMBERS) |
225 | |
226 $(PWM_BIN): $(PWM_OBJS) $(LIBPWM_LIB) $(LIBCOMPAT_LIB) | |
222 $(LINK.o) $^ $(LDLIBS) -o $@ | 227 $(LINK.o) $^ $(LDLIBS) -o $@ |
223 | 228 |
224 $(eval $(call generate-manpage-rule,$(MANPAGES))) | 229 $(eval $(call generate-manpage-rule,$(MANPAGES))) |
225 | 230 |
226 %.o: %.c | 231 %.o: %.c |
242 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ | 247 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ |
243 fi \ | 248 fi \ |
244 done | 249 done |
245 | 250 |
246 clean: | 251 clean: |
247 rm -f $(LIBCOMPAT_LIB) $(PWM_BIN) $(OBJS) $(MANPAGES) | 252 rm -f $(LIBCOMPAT_LIB) $(LIBPWM_LIB) $(PWM_BIN) $(OBJS) $(MANPAGES) |
248 | 253 |
249 clobber: clean | 254 clobber: clean |
250 rm -f $(patsubst %.o,%.d,$(OBJS)) | 255 rm -f $(patsubst %.o,%.d,$(OBJS)) |
251 | 256 |
252 dist: clobber | 257 dist: clobber |