生活随笔
收集整理的這篇文章主要介紹了
今天写的一个makefile,备份下
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
功能:把中間.o文件輸出到指定的目錄
CROSS_COMPILE?= arm-hisiv200-linux-CXX = $(CROSS_COMPILE)g++
CC = $(CROSS_COMPILE)gccTOP = $(PWD)
vpath %.cpp $(TOP)/src
vpath %.o $(TOP)/OUT $(TOP)/SRCINCLUDES = -I$(live555top)/UsageEnvironment/include -I$(live555top)/groupsock/include -I$(live555top)/liveMedia/include -I$(live555top)/BasicUsageEnvironment/include
CXXFLAGS=-g
CXXFLAGS += $(INCLUDES) $(LIBS)
OBJDIR = $(TOP)/OUT
SRCS = $(wildcard $(TOP)/src/*.cpp)
dir=$(notdir $(SRCS))
OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(dir))
all: mediaserver#$@
mediaserver: $(OBJS)$(CXX) -o mediaserver $^ $(CXXFLAGS)cp mediaserver /mnt/yk$(OBJDIR)/%.o:%.cpp$(CXX) -c -o $@ $< $(CXXFLAGS)live555top = /workplace/mywork/test/live-armUSAGE_ENVIRONMENT_DIR = $(live555top)/UsageEnvironment
USAGE_ENVIRONMENT_LIB = $(USAGE_ENVIRONMENT_DIR)/libUsageEnvironment.a
BASIC_USAGE_ENVIRONMENT_DIR = $(live555top)/BasicUsageEnvironment
BASIC_USAGE_ENVIRONMENT_LIB = $(BASIC_USAGE_ENVIRONMENT_DIR)/libBasicUsageEnvironment.a
LIVEMEDIA_DIR = $(live555top)/liveMedia
LIVEMEDIA_LIB = $(LIVEMEDIA_DIR)/libliveMedia.a
GROUPSOCK_DIR = $(live555top)/groupsock
GROUPSOCK_LIB = $(GROUPSOCK_DIR)/libgroupsock.a
LOCAL_LIBS = $(LIVEMEDIA_LIB) $(GROUPSOCK_LIB) \$(BASIC_USAGE_ENVIRONMENT_LIB) $(USAGE_ENVIRONMENT_LIB)
LIBS = $(LOCAL_LIBS) $(LIBS_FOR_CONSOLE_APPLICATION)live555MediaServer$(EXE): $(MEDIA_SERVER_OBJS) $(LOCAL_LIBS)$(LINK)$@ $(CONSOLE_LINK_OPTS) $(MEDIA_SERVER_OBJS) $(LIBS)print:echo $(SRCS)echo $(OBJS)echo $(OBJDIR)/%.oecho "".PHONY: clean
clean:rm $(OBJS) rm mediaserver
參考:
http://blog.csdn.net/liangkaiming/article/details/6267357
http://bbs.csdn.net/topics/30077726
總結
以上是生活随笔為你收集整理的今天写的一个makefile,备份下的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。