summaryrefslogtreecommitdiffhomepage
path: root/Makefile
blob: 6b1121e5421564beee90490e1c50a65fe34ad3c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
TARGET=click
FCGI_TARGET=click-fcgi

default: $(TARGET) $(FCGI_TARGET)

SRCS= \
  MainLoop.cpp \
  main.cpp \
  MIDI.cpp \
  PCM.cpp \
  config.cpp \
  UI.cpp \
  Timer.cpp \
  debug.cpp \
  cpuload.cpp \
  log.cpp \
  NoteClick.cpp \
  ClockClick.cpp \
  InternalClick.cpp \
  BPMDetect.cpp \
  Touchpad.cpp \
  PIDFile.cpp \
  Temperature.cpp \
  StatusLED.cpp \

HEADERS=$(SRCS:.cpp=.h)

OBJS=$(SRCS:.cpp=.o)

FCGI_SRCS=\
  click-fcgi.cpp \
  config.cpp \
  log.cpp \
  debug.cpp \

FCGI_OBJS=$(FCGI_SRCS:.cpp=.o)

CXX=clang++

ifeq ($(CXXFLAGS),)
CXXFLAGS=-O2 -g
endif

CXXFLAGS+=-std=c++20 -Wall -Wpedantic
# workaround for Debian dh_dwz:
CXXFLAGS+=-gdwarf-4
CXXFLAGS+=-I/usr/include/libevdev-1.0

CXXLIBS=$(shell pkg-config --libs alsa) -lreichwein -lfmt -lasound -levdev -lfcgi

$(TARGET): $(OBJS)
	$(CXX) $^ -o $@ $(CXXLIBS)

$(FCGI_TARGET): $(FCGI_OBJS)
	$(CXX) $^ -o $@ $(CXXLIBS)

%.o: %.cpp
	$(CXX) $(CXXFLAGS) -o $@ -c $<

run-fcgi:
	spawn-fcgi -a 127.0.0.1 -p 9090 -n -- ./click-fcgi

install:
	mkdir -p $(DESTDIR)/usr/bin
	cp $(TARGET) $(DESTDIR)/usr/bin
	mkdir -p $(DESTDIR)/usr/lib/click/media
	cp media/click.s16le $(DESTDIR)/usr/lib/click/media
	mkdir -p $(DESTDIR)/usr/lib/click
	cp $(FCGI_TARGET) $(DESTDIR)/usr/lib/click
	cp -r html $(DESTDIR)/usr/lib/click
	mkdir -p $(DESTDIR)/etc/nginx/sites-available
	cp debian/nginx-sites-available $(DESTDIR)/etc/nginx/sites-available/click

clean:
	rm -f $(TARGET) $(FCGI_TARGET) $(OBJS) $(FCGI_OBJS)

sound:
	ffmpeg -i media/click.wav -f s16le media/click.s16le