-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
58 lines (46 loc) · 1.78 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
# 简化第一版
# OBJS 代替 依赖文件
# CC 代替 gcc
# CFLAGS 代替 编译命令
# 简化第二版
# $^ 代替 构造所需文件列表所有文件的名字
# $< 代替 构造所需文件列表第一个文件的名字
# RM 代替 rm -f
# $@ 代替 目标文件
# 简化第三版
# 6-11行代码相似性很强,可以提取出一个公式模版
# %.o:%.c
# $(CC) $^ $(CFLAGS) -o $@
# 百分号相当于一个通配符
PREFIX = ../dfmirage/bin64
INCLUDES = -I../dfmirage -I. -I./thread -I./exception -I../dfmirage/libyuv/include -I../dfmirage/libx264/libx264-x64/include -I../dfmirage/IPCamera64/include -I../dfmirage/ffmpeg64/include -Imingw64/include
DEFINES = -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1
# 启用ffmpeg编码
DEFINES += -DENABLED_FFMPEG_ENCODER
# 启用ffmpeg日志
#DEFINES += -DENABLED_FFMPEG_LOG
# 计算FPS
DEFINES += -DENABLED_TEST_FPS
# 使用libyuv转换(RGB32->YV12)
DEFINES += -DENABLED_LIBYUV_CONVERT
LINK_OPTS = -L../dfmirage/libyuv/lib -L../dfmirage/libx264/libx264-x64/lib -L../dfmirage/IPCamera64/lib -L../dfmirage/ffmpeg64/lib -Lmingw32/i686-w64-mingw32/lib/
LINK_LIBS = -lgdi32 -lws2_32 -llibx264 -llibEasyIPCamera -lavcodec -lavutil -lswscale -llibyuv
CC = g++
CFLAGS = -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads $(DEFINES) $(INCLUDES)
EXE_NAME = EasyScreenCapture
SRC := $(wildcard *.cpp libx264/*.cpp libyuv/*.cpp thread/*.cpp exception/*.cpp)
OBJS := $(SRC:%.cpp=%.o)
#all:
# @echo $(SRC)
$(EXE_NAME):$(OBJS)
$(CC) $^ -o $@ $(LINK_OPTS) $(LINK_LIBS)
%.o:%.cpp
$(CC) $< $(CFLAGS) -o $@
#main.o:main.c
# $(CC) $^ $(CFLAGS) -o $@
#sem_comm.o:sem_comm.c
# $(CC) $^ $(CFLAGS) -o $@
install: $(EXE_NAME)
cp -r $(EXE_NAME) $(PREFIX)
clean:
$(RM) *.o $(EXE_NAME) -r