forked from mofarrell/p2pvc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (37 loc) · 1018 Bytes
/
Makefile
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
CC=gcc
OBJDIR=objs
SRCDIR=src
INCDIR=$(SRCDIR)/inc
CFLAGS+=-I$(INCDIR)
platform=$(shell uname -o)
SRCS=$(wildcard $(SRCDIR)/*.c)
OBJS=$(patsubst $(SRCDIR)/%.c,$(OBJDIR)/%.o,$(SRCS))
CFLAGS+=-O2 -Wall
ifeq ($(platform), GNU/Linux)
CFLAGS+=-DPA_USE_ALSA
else
CFLAGS+=-DPA_USE_COREAUDIO
endif
CFLAGS+=`pkg-config --cflags opencv`
CFLAGS_DEBUG+=-O0 -g3 -Werror -DDEBUG
LDFLAGS+=-lpthread -lncurses -lportaudio -lm
LDFLAGS+=`pkg-config --libs opencv`
all: p2pvc
.PHONY: all clean debug
debug: CC := $(CC) $(CFLAGS_DEBUG)
debug: clean p2pvc
p2pvc: $(OBJS)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
video: CFLAGS := $(CFLAGS) -DVIDEOONLY
video: $(filter-out objs/p2pvc.o, $(OBJS))
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
audio: CFLAGS := $(CFLAGS) -DAUDIOONLY
audio: $(filter-out objs/p2pvc.o, $(OBJS))
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(OBJS): | $(OBJDIR)
$(OBJDIR):
mkdir -p $@
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(wildcard $(INCDIR)/*.h) Makefile
$(CC) $(CFLAGS) $< -c -o $@
clean:
rm -rf $(OBJDIR) audio video p2pvc