projects/pwm

changeset 25:616385fa1fd9

Build common functions as a library that can be reused
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Wed Sep 20 23:57:51 2017 +0200 (2017-09-20)
parents eb5ce870eb16
children 5bdea77d0c1d
files Makefile
line diff
     1.1 --- a/Makefile	Wed Sep 20 23:49:31 2017 +0200
     1.2 +++ b/Makefile	Wed Sep 20 23:57:51 2017 +0200
     1.3 @@ -145,6 +145,10 @@
     1.4  LIBCOMPAT_LIB =		compat/libcompat.a
     1.5  LIBCOMPAT_LIB_MEMBERS =	$(LIBCOMPAT_OBJS:%.o=$(LIBCOMPAT_LIB)(%.o))
     1.6  
     1.7 +LIBPWM_OBJS =		util.o
     1.8 +LIBPWM_LIB =		libpwm.a
     1.9 +LIBPWM_LIB_MEMBERS =	$(LIBPWM_OBJS:%.o=$(LIBPWM_LIB)(%.o))
    1.10 +
    1.11  PWM_OBJS =		cmd.o \
    1.12  			io.o \
    1.13  			pager.o \
    1.14 @@ -152,11 +156,10 @@
    1.15  			pw.o \
    1.16  			pwfile.o \
    1.17  			pwm.o \
    1.18 -			tok.o \
    1.19 -			util.o
    1.20 +			tok.o
    1.21  PWM_BIN =		$(PACKAGE)
    1.22  
    1.23 -OBJS = $(LIBCOMPAT_OBJS) $(PWM_OBJS)
    1.24 +OBJS = $(LIBCOMPAT_OBJS) $(LIBPWM_OBJS) $(PWM_OBJS)
    1.25  
    1.26  MANPAGES = pwm.1
    1.27  
    1.28 @@ -176,12 +179,12 @@
    1.29  endif
    1.30  ifeq ($(HAVE_ARC4RANDOM),1)
    1.31    XCPPFLAGS +=		-DHAVE_ARC4RANDOM
    1.32 -  PWM_OBJS +=		rand-arc4random.o
    1.33 +  LIBPWM_OBJS +=	rand-arc4random.o
    1.34  else ifeq ($(HAVE_GETRANDOM),1)
    1.35    XCPPFLAGS +=		-DHAVE_GETRANDOM
    1.36 -  PWM_OBJS +=		rand-getrandom.o
    1.37 +  LIBPWM_OBJS +=	rand-getrandom.o
    1.38  else
    1.39 -  PWM_OBJS +=		rand-dev-random.o
    1.40 +  LIBPWM_OBJS +=	rand-dev-random.o
    1.41  endif
    1.42  ifeq ($(HAVE_CLOSEFROM),1)
    1.43    XCPPFLAGS +=		-DHAVE_CLOSEFROM
    1.44 @@ -218,7 +221,9 @@
    1.45  
    1.46  $(LIBCOMPAT_LIB): $(LIBCOMPAT_LIB_MEMBERS)
    1.47  
    1.48 -$(PWM_BIN): $(PWM_OBJS) $(LIBCOMPAT_LIB)
    1.49 +$(LIBPWM_LIB): $(LIBPWM_LIB_MEMBERS)
    1.50 +
    1.51 +$(PWM_BIN): $(PWM_OBJS) $(LIBPWM_LIB) $(LIBCOMPAT_LIB)
    1.52  	$(LINK.o) $^ $(LDLIBS) -o $@
    1.53  
    1.54  $(eval $(call generate-manpage-rule,$(MANPAGES)))
    1.55 @@ -244,7 +249,7 @@
    1.56  	done
    1.57  
    1.58  clean:
    1.59 -	rm -f $(LIBCOMPAT_LIB) $(PWM_BIN) $(OBJS) $(MANPAGES)
    1.60 +	rm -f $(LIBCOMPAT_LIB) $(LIBPWM_LIB) $(PWM_BIN) $(OBJS) $(MANPAGES)
    1.61  
    1.62  clobber: clean
    1.63  	rm -f $(patsubst %.o,%.d,$(OBJS))