-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
109 lines (75 loc) · 2.21 KB
/
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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
SYSTEM?=linux
DESTDIR?=/usr/local/
CC=g++
CXX=g++
AR=ar
CFLAGS=-O3 -Wno-deprecated -Wno-deprecated-declarations -fPIC
INSTALL=/usr/bin/install
BUILD_DIR=build
DIST_DIR=dist
LIB_DIR=lib
SRC_DIR=src
INCLUDES=-Iinclude -Isrc -Iext/include
LIBS=-Lext/lib
#different os configurations
############################
ifeq ($(SYSTEM),linux)
# Preprocessor directives
CFLAGS+=-DSYSTEM_LINUX
LDFLAGS_S=-lpthread -lz -lm -lva -llzma -lX11 -lEGL -lGLESv2 \
-lavformat -lavcodec -lavutil -lswresample -lswscale
LDFLAGS_L=-lpthread -lz -lm -lva -llzma -lX11 -lEGL -lGLESv2 \
-lavformat -lavcodec -lavutil -lswresample -lswscale
OBJ_L= render/BGRARender.o \
display/XCDisplay.o \
display/XCDisplay_x11.o
OBJ_S=xcast.o
endif
ifeq ($(SYSTEM),rasp)
# Preprocessor directives
CFLAGS+=-DSYSTEM_RASP
CFLAGS+=-DRPI_NO_X
CFLAGS+=-I/opt/vc/include
CFLAGS+=-I/opt/vc/include/interface/vcos/pthreads
CFLAGS+=-I/opt/vc/include/interface/vmcs_host/linux
LIBS+=-L/opt/vc/lib
LDFLAGS=-lEGL -lGLESv2 -lbcm_host -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lm -lilclient
LDFLAGS_S=$(LDFLAGS)
LDFLAGS_L=$(LDFLAGS)
OBJ_L= codec/RaspPlayer.o \
display/XCDisplay.o \
display/XCDisplay_rasp.o
OBJ_S=xcast.o
endif
OBJECTS_S=$(addprefix $(BUILD_DIR)/, $(OBJ_S))
OBJECTS_L=$(addprefix $(BUILD_DIR)/, $(OBJ_L))
############################
APP=xcast
LIB=xcast
.PHONY: all debug app install uninstall clean
all: lib app
debug: CXX += -DDEBUG -g
debug: CC += -DDEBUG -g
debug: all
$(BUILD_DIR):
@mkdir -p $(BUILD_DIR)
$(OBJECTS_S): | $(BUILD_DIR)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
@dirname $@ | xargs mkdir -p
$(CC) $(CFLAGS) $(INCLUDES) -c $^ -o $@
app: $(OBJECTS_L) $(OBJECTS_S)
@mkdir -p $(DIST_DIR)
$(CC) $^ $(LIBS) $(LDFLAGS_S) -o $(DIST_DIR)/$(APP)
lib: $(OBJECTS_L)
@mkdir -p $(LIB_DIR)
$(CC) -shared -Wl,-soname,lib$(LIB).so.1 $(LIBS) $(LDFLAGS_L) -o $(LIB_DIR)/lib$(LIB).so.1.0 $^
ln -sf $(LIB_DIR)/lib$(LIB).so.1.0 $(LIB_DIR)/lib$(LIB).so.1
ln -sf $(LIB_DIR)/lib$(LIB).so.1.0 $(LIB_DIR)/lib$(LIB).so
$(AR) rcs $(LIB_DIR)/lib$(LIB).a $^
install: $(DIST_DIR)/$(APP)
$(INSTALL) -d $(DESTDIR)bin
$(INSTALL) -t $(DESTDIR)bin $(DIST_DIR)/$(APP)
uninstall:
$(RM) -f $(DESTDIR)bin/$(APP)
clean:
rm -rf $(BUILD_DIR) $(DIST_DIR) $(LIB_DIR)