-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
173 lines (131 loc) · 5.29 KB
/
Copy pathMakefile
File metadata and controls
173 lines (131 loc) · 5.29 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
###############################################################################
#
# Generic Makefile for C/C++ Program
#
# Author: whyglinux (whyglinux AT hotmail DOT com)
# Date: 2006/03/04
# Description:
# The makefile searches in <SRCDIRS> directories for the source files
# with extensions specified in <SOURCE_EXT>, then compiles the sources
# and finally produces the <PROGRAM>, the executable file, by linking
# the objectives.
# Usage:
# $ make compile and link the program.
# $ make objs compile only (no linking. Rarely used).
# $ make clean clean the objectives and dependencies.
# $ make cleanall clean the objectives, dependencies and executable.
# $ make rebuild rebuild the program. The same as make clean && make all.
#==============================================================================
## Customizing Section: adjust the following if necessary.
##=============================================================================
#MEDIASDK_INSTALL_FOLDER = /home/vcloud/proj/MSDK
# The executable file name.
# It must be specified.
# PROGRAM := a.out # the executable name
PROGRAM := libvaenc.so
# The directories in which source files reside.
# At least one path should be specified.
# SRCDIRS := . # current directory
SRCDIRS := .
# The source file types (headers excluded).
# At least one type should be specified.
# The valid suffixes are among of .c, .C, .cc, .cpp, .CPP, .c++, .cp, or .cxx.
# SRCEXTS := .c # C program
# SRCEXTS := .cpp # C++ program
# SRCEXTS := .c .cpp # C/C++ program
SRCEXTS :=.c
# The flags used by the cpp (man cpp for more).
# CPPFLAGS := -Wall -Werror # show all warnings and take them as errors
CPPFLAGS := -Wall
# The compiling flags used only for C.
# If it is a C++ program, no need to set these flags.
# If it is a C and C++ merging program, set these flags for the C parts.
CFLAGS := -fPIC -DHAVE_VA_X11
CFLAGS += -Wall
# The compiling flags used only for C++.
# If it is a C program, no need to set these flags.
# If it is a C and C++ merging program, set these flags for the C++ parts.
CXXFLAGS :=
CXXFLAGS +=
# The library and the link options ( C and C++ common).
#LDFLAGS := $(MEDIASDK_INSTALL_FOLDER)/samples/_build/lin_x64/release/sample_encode/libsample_encode.so
LDFLAGS := -fPIC -shared /usr/local/lib/libva.so /usr/local/lib/libva-x11.so #/usr/local/lib/libX11.so
LDFLAGS +=
## Implict Section: change the following only when necessary.
##=============================================================================
# The C program compiler. Uncomment it to specify yours explicitly.
CC = gcc -g
# The C++ program compiler. Uncomment it to specify yours explicitly.
#CXX = g++
# Uncomment the 2 lines to compile C programs as C++ ones.
#CC = $(CXX)
#CFLAGS = $(CXXFLAGS)
# The command used to delete file.
#RM = rm -f
## Stable Section: usually no need to be changed. But you can add more.
##=============================================================================
SHELL = /bin/sh
SOURCES = $(foreach d,$(SRCDIRS),$(wildcard $(addprefix $(d)/*,$(SRCEXTS))))
OBJS = $(foreach x,$(SRCEXTS), \
$(patsubst %$(x),%.o,$(filter %$(x),$(SOURCES))))
DEPS = $(patsubst %.o,%.d,$(OBJS))
.PHONY : all objs clean cleanall rebuild
all : $(PROGRAM)
# Rules for creating the dependency files (.d).
#---------------------------------------------------
%.d : %.c
@$(CC) -MM -MD $(CFLAGS) $<
%.d : %.C
@$(CC) -MM -MD $(CXXFLAGS) $<
%.d : %.cc
@$(CC) -MM -MD $(CXXFLAGS) $<
%.d : %.cpp
@$(CC) -MM -MD $(CXXFLAGS) $<
%.d : %.CPP
@$(CC) -MM -MD $(CXXFLAGS) $<
%.d : %.c++
@$(CC) -MM -MD $(CXXFLAGS) $<
%.d : %.cp
@$(CC) -MM -MD $(CXXFLAGS) $<
%.d : %.cxx
@$(CC) -MM -MD $(CXXFLAGS) $<
# Rules for producing the objects.
#---------------------------------------------------
objs : $(OBJS)
%.o : %.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
%.o : %.C
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
%.o : %.cc
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
%.o : %.cpp
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
%.o : %.CPP
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
%.o : %.c++
$(CXX -c $(CPPFLAGS) $(CXXFLAGS) $<
%.o : %.cp
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
%.o : %.cxx
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
# Rules for producing the executable.
#----------------------------------------------
$(PROGRAM) : $(OBJS)
ifeq ($(strip $(SRCEXTS)), .c) # C file
$(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
else # C++ file
$(CXX) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
endif
-include $(DEPS)
rebuild: clean all
#add
install:all
sudo cp $(PROGRAM) /usr/local/lib/
sudo cp buffdef.h /usr/local/include/
sudo cp vaenclib.h /usr/local/include/
clean :
@$(RM) *.o *.d
cleanall: clean
@$(RM) $(PROGRAM) $(PROGRAM).exe
### End of the Makefile ## Suggestions are welcome ## All rights reserved ###
###############################################################################