12 files changed, 40 insertions(+), 15 deletions(-)
M Makefile
D log.c
D log.h
M pustule.lua
R dyn_array.c => src/dyn_array.c
R events.c => src/events.c
A src/log.c
A src/log.h
R lua_mod.c => src/lua_mod.c
R main.c => src/main.c
R pulse.c => src/pulse.c
R pustule.h => src/pustule.h
M Makefile => Makefile +37 -11
@@ 1,21 1,47 @@
+CFLAGS ?= -O2 -Wall -Wextra -DLOG_USE_COLOR
+LDFLAGS ?= -O2 -Wall -Wextra
+
+PREFIX ?= /usr/local
+_INSTDIR = $(DESTDIR)$(PREFIX)
+BINDIR ?= $(_INSTDIR)/bin
+SHAREDIR ?= $(_INSTDIR)/share
+MANDIR ?= $(SHAREDIR)/man
+
+DEPS_CFLAGS = `pkg-config --cflags lua libpulse`
+DEPS_LDFLAGS = `pkg-config --libs lua libpulse`
+OUTDIR = .build
+
+OBJECTS = \
+ $(OUTDIR)/dyn_array.o \
+ $(OUTDIR)/events.o \
+ $(OUTDIR)/lua_mod.o \
+ $(OUTDIR)/main.o \
+ $(OUTDIR)/pulse.o \
+ $(OUTDIR)/log.o
+
all: pustule pustule.1
-CFLAGS ?= -O2
-LDFLAGS ?= -O2
+$(OUTDIR)/%.o: src/%.c src/pustule.h
+ @mkdir -p $(dir $@)
+ $(CC) -std=c99 -c -o $@ $(CFLAGS) $(DEPS_CFLAGS) $<
-DEPS_CFLAGS = -Wall `pkg-config --cflags lua libpulse` -DLOG_USE_COLOR
-DEPS_LDFLAGS = -Wall `pkg-config --libs lua libpulse`
+argparse/libargparse.a: argparse/argparse.c argparse/argparse.h
+ $(MAKE) -C argparse libargparse.a
-pustule: dyn_array.o events.o lua_mod.o main.o pulse.o argparse/argparse.o log.o
+pustule: $(OBJECTS) argparse/libargparse.a
$(CC) -o $@ $^ $(LDFLAGS) $(DEPS_LDFLAGS)
-%.o: %.c pustule.h
- $(CC) -c -o $@ $< $(CFLAGS) $(DEPS_CFLAGS)
-
pustule.1: pustule.1.scd
scdoc < $< > $@
-.PHONY: clean
+.PHONY: clean mrproper install
clean:
- rm -f pustule
- find . -name '*.o' -delete
+ rm -rf $(OUTDIR) pustule pustule.1
+
+mrproper: clean
+ $(MAKE) -C argparse clean
+
+install: all
+ install -Dm755 pustule $(BINDIR)/pustule
+ install -Dm644 pustule.lua $(SHAREDIR)/pustule/pustule.lua
+ install -Dm644 pustule.1 $(MANDIR)/man1/pustule.1
D log.c => log.c +0 -1
@@ 1,1 0,0 @@
-logc/src/log.c>
\ No newline at end of file
D log.h => log.h +0 -1
@@ 1,1 0,0 @@
-logc/src/log.h>
\ No newline at end of file
M pustule.lua => pustule.lua +0 -1
@@ 32,7 32,6 @@
-- "device_added", "device_removed". Listeners can be added for any of these
-- signals using the `pustule.connect_signal()` and
-- `pustule.disconnect_signal()`.
-
--
-- The volume of each input and device (a number between 0 and 1) can be set
-- using the `pustule.set_input_volume()` and `pustule.set_device_volume()`
R dyn_array.c => src/dyn_array.c +0 -0
R events.c => src/events.c +0 -0
A src/log.c => src/log.c +1 -0
@@ 0,0 1,1 @@
+../logc/src/log.c<
\ No newline at end of file
A src/log.h => src/log.h +1 -0
@@ 0,0 1,1 @@
+../logc/src/log.h<
\ No newline at end of file
R lua_mod.c => src/lua_mod.c +0 -0
R main.c => src/main.c +1 -1
@@ 26,7 26,7 @@
#include <lualib.h>
#include <pulse/pulseaudio.h>
-#include "argparse/argparse.h"
+#include "../argparse/argparse.h"
#include "log.h"
#include "pustule.h"
R pulse.c => src/pulse.c +0 -0
R pustule.h => src/pustule.h +0 -0