Mercurial > projects > pwm
diff 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 |
line wrap: on
line diff
--- a/Makefile Wed Sep 20 23:49:31 2017 +0200 +++ b/Makefile Wed Sep 20 23:57:51 2017 +0200 @@ -145,6 +145,10 @@ LIBCOMPAT_LIB = compat/libcompat.a LIBCOMPAT_LIB_MEMBERS = $(LIBCOMPAT_OBJS:%.o=$(LIBCOMPAT_LIB)(%.o)) +LIBPWM_OBJS = util.o +LIBPWM_LIB = libpwm.a +LIBPWM_LIB_MEMBERS = $(LIBPWM_OBJS:%.o=$(LIBPWM_LIB)(%.o)) + PWM_OBJS = cmd.o \ io.o \ pager.o \ @@ -152,11 +156,10 @@ pw.o \ pwfile.o \ pwm.o \ - tok.o \ - util.o + tok.o PWM_BIN = $(PACKAGE) -OBJS = $(LIBCOMPAT_OBJS) $(PWM_OBJS) +OBJS = $(LIBCOMPAT_OBJS) $(LIBPWM_OBJS) $(PWM_OBJS) MANPAGES = pwm.1 @@ -176,12 +179,12 @@ endif ifeq ($(HAVE_ARC4RANDOM),1) XCPPFLAGS += -DHAVE_ARC4RANDOM - PWM_OBJS += rand-arc4random.o + LIBPWM_OBJS += rand-arc4random.o else ifeq ($(HAVE_GETRANDOM),1) XCPPFLAGS += -DHAVE_GETRANDOM - PWM_OBJS += rand-getrandom.o + LIBPWM_OBJS += rand-getrandom.o else - PWM_OBJS += rand-dev-random.o + LIBPWM_OBJS += rand-dev-random.o endif ifeq ($(HAVE_CLOSEFROM),1) XCPPFLAGS += -DHAVE_CLOSEFROM @@ -218,7 +221,9 @@ $(LIBCOMPAT_LIB): $(LIBCOMPAT_LIB_MEMBERS) -$(PWM_BIN): $(PWM_OBJS) $(LIBCOMPAT_LIB) +$(LIBPWM_LIB): $(LIBPWM_LIB_MEMBERS) + +$(PWM_BIN): $(PWM_OBJS) $(LIBPWM_LIB) $(LIBCOMPAT_LIB) $(LINK.o) $^ $(LDLIBS) -o $@ $(eval $(call generate-manpage-rule,$(MANPAGES))) @@ -244,7 +249,7 @@ done clean: - rm -f $(LIBCOMPAT_LIB) $(PWM_BIN) $(OBJS) $(MANPAGES) + rm -f $(LIBCOMPAT_LIB) $(LIBPWM_LIB) $(PWM_BIN) $(OBJS) $(MANPAGES) clobber: clean rm -f $(patsubst %.o,%.d,$(OBJS))