projects/pwm

diff Makefile @ 26:5bdea77d0c1d

Add pwm-clip utility for setting the X11 CLIPBOARD selection
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Thu Sep 21 09:45:59 2017 +0200 (2017-09-21)
parents 616385fa1fd9
children 722a45b4028b
line diff
     1.1 --- a/Makefile	Wed Sep 20 23:57:51 2017 +0200
     1.2 +++ b/Makefile	Thu Sep 21 09:45:59 2017 +0200
     1.3 @@ -83,6 +83,7 @@
     1.4    HAVE_ASPRINTF ?=	1
     1.5    HAVE_CLOSEFROM ?=	0
     1.6    HAVE_ERR_H ?=		1
     1.7 +  HAVE_GETLINE ?=	0
     1.8    HAVE_GETRANDOM ?=	0
     1.9    HAVE_SYS_QUEUE_H ?=	0
    1.10    HAVE_SETPROGNAME ?=	0
    1.11 @@ -92,6 +93,7 @@
    1.12    HAVE_ASPRINTF ?=	1
    1.13    HAVE_CLOSEFROM ?=	1
    1.14    HAVE_ERR_H ?=		1
    1.15 +  HAVE_GETLINE ?=	1
    1.16    HAVE_GETRANDOM ?=	0
    1.17    HAVE_SYS_QUEUE_H ?=	1
    1.18    HAVE_SETPROGNAME ?=	1
    1.19 @@ -101,6 +103,7 @@
    1.20    HAVE_ASPRINTF ?=	1
    1.21    HAVE_CLOSEFROM ?=	1
    1.22    HAVE_ERR_H ?=		1
    1.23 +  HAVE_GETLINE ?=	1
    1.24    HAVE_GETRANDOM ?=	0
    1.25    HAVE_SYS_QUEUE_H ?=	1
    1.26    HAVE_SYS_TREE_H ?=	1
    1.27 @@ -110,6 +113,7 @@
    1.28    HAVE_ASPRINTF ?=	1
    1.29    HAVE_CLOSEFROM ?=	1
    1.30    HAVE_ERR_H ?=		1
    1.31 +  HAVE_GETLINE ?=	1
    1.32    HAVE_GETRANDOM ?=	0
    1.33    HAVE_SYS_QUEUE_H ?=	1
    1.34    HAVE_SYS_TREE_H ?=	1
    1.35 @@ -119,11 +123,13 @@
    1.36      HAVE_ARC4RANDOM ?=	0
    1.37      HAVE_ASPRINTF ?=	0
    1.38      HAVE_ERR_H ?=	0
    1.39 +    HAVE_GETLINE ?=	0
    1.40      HAVE_GETRANDOM ?=	0
    1.41    else
    1.42      HAVE_ARC4RANDOM ?=	1
    1.43      HAVE_ASPRINTF ?=	1
    1.44      HAVE_ERR_H ?=	1
    1.45 +    HAVE_GETLINE ?=	1
    1.46      HAVE_GETRANDOM ?=	1
    1.47    endif
    1.48    HAVE_CLOSEFROM ?=	1
    1.49 @@ -135,6 +141,7 @@
    1.50    HAVE_ASPRINTF ?=	0
    1.51    HAVE_CLOSEFROM ?=	0
    1.52    HAVE_ERR_H ?=		0
    1.53 +  HAVE_GETLINE ?=	0
    1.54    HAVE_GETRANDOM ?=	0
    1.55    HAVE_SYS_QUEUE_H ?=	0
    1.56    HAVE_SETPROGNAME ?=	0
    1.57 @@ -149,6 +156,10 @@
    1.58  LIBPWM_LIB =		libpwm.a
    1.59  LIBPWM_LIB_MEMBERS =	$(LIBPWM_OBJS:%.o=$(LIBPWM_LIB)(%.o))
    1.60  
    1.61 +PWM_CLIP_OBJS =		pwm-clip.o
    1.62 +PWM_CLIP_BIN =		pwm-clip
    1.63 +PWM_CLIP_MAN1 =		pwm-clip.1
    1.64 +
    1.65  PWM_OBJS =		cmd.o \
    1.66  			io.o \
    1.67  			pager.o \
    1.68 @@ -158,20 +169,23 @@
    1.69  			pwm.o \
    1.70  			tok.o
    1.71  PWM_BIN =		$(PACKAGE)
    1.72 +PWM_MAN1 =		pwm.1
    1.73  
    1.74 -OBJS = $(LIBCOMPAT_OBJS) $(LIBPWM_OBJS) $(PWM_OBJS)
    1.75 +OBJS = $(LIBCOMPAT_OBJS) $(LIBPWM_OBJS) $(PWM_CLIP_OBJS) $(PWM_OBJS)
    1.76  
    1.77 -MANPAGES = pwm.1
    1.78 +MANPAGES = $(PWM_MAN1) $(PWM_CLIP_MAN1)
    1.79  
    1.80  .DEFAULT_TARGET = all
    1.81  
    1.82  .PHONY: all clean clobber dist install
    1.83  
    1.84 -all: $(PWM_BIN) $(MANPAGES)
    1.85 +all: $(PWM_BIN) $(PWM_CLIP_BIN) $(MANPAGES)
    1.86  
    1.87  $(PWM_BIN): XCPPFLAGS += -DPACKAGE=\"$(PACKAGE)\" \
    1.88  			-DVERSION=\"$(VERSION)\"
    1.89  $(PWM_BIN): LDLIBS =	-ltecla -lcurses -lpws -lnettle
    1.90 +$(PWM_CLIP_BIN): XCPPFLAGS += -Icompat/include
    1.91 +$(PWM_CLIP_BIN): LDLIBS = -lnettle
    1.92  ifeq ($(HAVE_ASPRINTF),1)
    1.93    XCPPFLAGS +=		-DHAVE_ASPRINTF
    1.94  else
    1.95 @@ -196,6 +210,11 @@
    1.96  else
    1.97    LIBCOMPAT_OBJS +=	compat/err.o
    1.98  endif
    1.99 +ifeq ($(HAVE_GETLINE),1)
   1.100 +  XCPPFLAGS +=		-DHAVE_GETLINE
   1.101 +else
   1.102 +  LIBCOMPAT_OBJS +=	compat/getline.o
   1.103 +endif
   1.104  ifeq ($(HAVE_SETPROGNAME),1)
   1.105    XCPPFLAGS +=		-DHAVE_SETPROGNAME
   1.106  else
   1.107 @@ -223,10 +242,15 @@
   1.108  
   1.109  $(LIBPWM_LIB): $(LIBPWM_LIB_MEMBERS)
   1.110  
   1.111 +$(PWM_CLIP_BIN): $(PWM_CLIP_OBJS) $(LIBPWM_LIB) $(LIBCOMPAT_LIB)
   1.112 +	$(LINK.o) $^ $(LDLIBS) -o $@
   1.113 +
   1.114 +$(eval $(call generate-manpage-rule,$(PWM_CLIP_MAN1)))
   1.115 +
   1.116  $(PWM_BIN): $(PWM_OBJS) $(LIBPWM_LIB) $(LIBCOMPAT_LIB)
   1.117  	$(LINK.o) $^ $(LDLIBS) -o $@
   1.118  
   1.119 -$(eval $(call generate-manpage-rule,$(MANPAGES)))
   1.120 +$(eval $(call generate-manpage-rule,$(PWM_MAN1)))
   1.121  
   1.122  %.o: %.c
   1.123  	$(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
   1.124 @@ -238,6 +262,7 @@
   1.125  
   1.126  install: all
   1.127  	$(INSTALL.exec) $(PWM_BIN) "$(DESTDIR)$(bindir)/$(PWM_BIN)"
   1.128 +	$(INSTALL.exec) $(PWM_CLIP_BIN) "$(DESTDIR)$(bindir)/$(PWM_CLIP_BIN)"
   1.129  	for manpage in $(MANPAGES); do \
   1.130  	    if [ -L $${manpage} ]; then \
   1.131  	        $(INSTALL.link) $${manpage} \
   1.132 @@ -249,7 +274,8 @@
   1.133  	done
   1.134  
   1.135  clean:
   1.136 -	rm -f $(LIBCOMPAT_LIB) $(LIBPWM_LIB) $(PWM_BIN) $(OBJS) $(MANPAGES)
   1.137 +	rm -f $(LIBCOMPAT_LIB) $(LIBPWM_LIB) $(PWM_CLIP_BIN) $(PWM_BIN) \
   1.138 +	    $(OBJS) $(MANPAGES)
   1.139  
   1.140  clobber: clean
   1.141  	rm -f $(patsubst %.o,%.d,$(OBJS))