Ticket #78: Makefile.2

File Makefile.2, 1.0 KB (added by themaister, 13 years ago)

A bit more generic Makefile.

Line 
1TARGET_LIB = libroar_plugin.so
2TARGET_OBJ = roar-plugin.o
3
4PREFIX ?= /usr
5
6VLC_CFLAGS = $(shell pkg-config vlc-plugin --cflags)
7VLC_LIBS = $(shell pkg-config vlc-plugin --libs)
8VLC_DEFINES = -DMODULE_STRING=\"RoarAudio\"
9
10ROAR_LIBS = $(shell pkg-config libroar --libs)
11ROAR_CFLAGS = $(shell pkg-config libroar --cflags)
12
13ifeq ($(VLC_CFLAGS),)
14   $(error "Cannot find VLC plugin pkg-conf...")
15endif
16ifeq ($(VLC_LIBS),)
17        $(error "Cannot find VLC plugin pkg-conf...")
18endif
19ifeq ($(ROAR_LIBS),)
20   $(error "Cannot find libroar...")
21endif
22
23all: $(TARGET_LIB)
24
25$(TARGET_LIB): $(TARGET_OBJ)
26        $(CC) -o $@ -shared -fPIC $< $(ROAR_LIBS) $(VLC_LIBS)
27
28%.o: %.c
29        $(CC) -c -o $@ $< $(CFLAGS) -fPIC -O2 -g -std=gnu99 $(VLC_CFLAGS) $(VLC_DEFINES) $(ROAR_CFLAGS)
30
31clean:
32        rm -f *.so
33        rm -f *.o
34
35install:
36        mkdir -p $(DESTDIR)$(PREFIX)/lib/vlc/plugins/audio_output
37        install -m755 $(TARGET_LIB) $(DESTDIR)$(PREFIX)/lib/vlc/plugins/audio_output
38
39uninstall:
40        rm -f $(DESTDIR)$(PREFIX)/lib/vlc/plugins/audio_output/$(TARGET_LIB)
41
42.PHONY: clean install uninstall