123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- # gcc compiler
- CC = aarch64-himix100-linux-gcc
- # g++ compiler
- CXX = aarch64-himix100-linux-g++
- # program name
- PROGRAM =MediaServer
- # source directory
- SRCDIRS =./src
- # header directory
- HDRDIRS =./inc ./inc/include ./third ./inc/rapidjson ./inc/dataType ./inc/device
- HDRDIRS += ./third/live555/BasicUsageEnvironment ./third/live555/groupsock ./third/live555/liveMedia ./third/live555/UsageEnvironment
- # binary directory
- BINDIRS =./bin
- # library directory
- LIBDIRS =./lib ./third/libopencv ./third/liblive555 ./third/libffmpeg ./third/llibx264
- ##############################################################################
- # empty character
- EMPTY =
- # gcc option
- CFLAGS =-g -rdynamic -Wall -O0 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DALLOW_RTSP_SERVER_PORT_REUSE=1
- CFLAGS +=$(addprefix -I,$(HDRDIRS))
- # g++ option
- CXXFLAGS=$(CFLAGS)
- # Link flags
- LDFLAGS = $(addprefix -L,$(LIBDIRS)) -Wl,-z,relro,-z,noexecstack,--disable-new-dtags,-rpath,/lib/:/usr/lib/:/usr/app/lib:./third/liblive555:./third/libffmpeg
- LDFLAGS += -lrt -lm -lsecurec -lpthread -lopencv_core -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_videoio
- LDFLAGS += ./third/liblive555/libBasicUsageEnvironment.a ./third/liblive555/libgroupsock.a ./third/liblive555/libliveMedia.a ./third/liblive555/libUsageEnvironment.a
- LDFLAGS += -lBasicUsageEnvironment -lUsageEnvironment -lgroupsock -lliveMedia
- # dependence flag
- DEPFLAGS=-MM -MP
- # source extended
- SRCEXTS =.c .cpp
- # header extended
- HDREXTS =.h .hh
- # source files
- SOURCE =$(foreach d, $(SRCDIRS),$(wildcard $(addprefix $(d)/*,$(SRCEXTS))))
- # head files
- HEADER =$(foreach d, $(HDRDIRS),$(wildcard $(addprefix $(d)/*,$(HDREXTS))))
- # object files
- OBJECT =$(foreach d, $(basename $(notdir $(SOURCE))),$(BINDIRS)/$(d).o)
- # dependance files
- DEPEND =$(patsubst %.o,%.d, $(OBJECT))
- ##############################################################################
- # Stable, don't change
- ifeq ($(PROGRAM), $(EMPTY))
- PROGRAM:=$(BINDIRS)/program
- else
- PROGRAM:=$(BINDIRS)/$(PROGRAM)
- endif
- .PHONY: all object depend clean vclean show help
- # target file
- all:$(PROGRAM)
- $(PROGRAM): $(OBJECT)
- ifeq ($(filter-out %.c, $(SOURCE)), $(EMPTY))
- ifneq ($(SOURCE), $(EMPTY))
- $(CC) -o $@ $(DBGFLAGS) $^ $(LDFLAGS)
- endif
- else
- ifneq ($(SOURCE), $(EMPTY))
- $(CXX) -o $@ $(DBGFLAGS) $^ $(LDFLAGS)
- endif
- endif
- ifndef NODEP
- sinclude $(DEPEND)
- endif
- # object files
- object:$(OBJECT)
- $(BINDIRS)/%.o: $(SRCDIRS)/%.c
- $(CC) $(OPTFLAGS) $(CFLAGS) -o $@ -c $<
- $(BINDIRS)/%.o: $(SRCDIRS)/%.cpp
- $(CXX) $(OPTFLAGS) $(CXXFLAGS) -o $@ -c $<
- # dependance files
- depend:$(DEPEND)
- $(DEPEND): $(SOURCE)
- $(BINDIRS)/%.d: $(SRCDIRS)/%.c
- @$(CC) $(CFLAGS) $(DEPFLAGS) $< | sed 's,\($*\).o[ :]*,$(BINDIRS)/\1.o $@ :,g' >$@
- $(BINDIRS)/%.d: $(SRCDIRS)/%.cpp
- @$(CXX) $(CXXFLAGS) $(DEPFLAGS) $< | sed 's,\($*\).o[ :]*,$(BINDIRS)/\1.o $@ :,g' >$@
- # clean the temporary files
- clean:
- $(RM) ./bin/*.*
- vclean:
- $(RM) $(OBJECT) $(DEPEND) $(PROGRAM)
- show:
- @echo '[File list]:'
- @echo ' PROGRAM NAME :$(PROGRAM)'
- @echo ' SOURCE FILES :$(SOURCE)'
- @echo ' HEADER FILES :$(HEADER)'
- @echo ' OBJECT FILES :$(OBJECT)'
- @echo ' DEPEND FILES :$(DEPEND)'
- help:
- @echo 'Generic Makefile for C/C++ Programs (gcmakefile) version 2.1'
- @echo '[Usage]: make[TARGET]'
- @echo ' all :(=make)compile and link'
- @echo ' object :compile only (not linking)'
- @echo ' depend :(NODEP=yes)[do|donot] generate the dependencies(not compiling)'
- @echo ' clean :clean up the object files and the dependence files'
- @echo ' vclean :clean up all of the generated files(including executable file)'
- @echo ' show :show the hierarchical of the files list'
- @echo ' help :print how to use the makefile manual'
|