summaryrefslogtreecommitdiffhomepage
path: root/Makefile
blob: 9704e814e44a2fc3c9309f31c425225c14939e2b (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
TARGET=midiplay-fcgi

SRCS=\
     midiplay.cpp \
     MIDIPlayer.cpp \
     AudioPlayer.cpp \
     config.cpp \

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

CXX=clang++
CXXFLAGS=-Wall -g -O2 -fPIC -std=c++20
# workaround for Debian dh_dwz:
CXXFLAGS+=-gdwarf-4
CXXLIBS=-lfcgi -lreichwein -lfmt -lasound

CC=clang
CFLAGS=-Wall -g -O2 -fPIC
# workaround for Debian dh_dwz:
CFLAGS+=-gdwarf-4
CLIBS=-lasound

all: $(TARGET) aplaymidi-mp

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

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

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

aplaymidi-mp.o: aplaymidi-mp.c
	$(CC) $(CFLAGS) -o $@ -c $^

aplaymidi-mp: aplaymidi-mp.o
	$(CC) $(CFLAGS) -o $@ $^ $(CLIBS)

install:
	mkdir -p $(DESTDIR)/usr/bin
	cp midiplay $(DESTDIR)/usr/bin
	cp aplaymidi-mp $(DESTDIR)/usr/bin
	mkdir -p $(DESTDIR)/usr/lib/midiplay
	cp $(TARGET) $(DESTDIR)/usr/lib/midiplay
	cp -r html $(DESTDIR)/usr/lib/midiplay
	mkdir -p $(DESTDIR)/etc/nginx/sites-available
	cp debian/nginx-sites-available $(DESTDIR)/etc/nginx/sites-available/midiplay

clean:
	-rm -rf *.o $(TARGET) aplaymidi-mp