zoukankan      html  css  js  c++  java
  • GNU_makefile_template

    #g++ compiler: options
    
    # -std=c++0x enables ISO C++ 11 standard
    # -I.. pulls in the Version_test.h file for conditional compilation
    #      of code the uses features that might not yet be implemented
    CC = g++
    CCFLAGS = -std=c++0x -I..
    
    # Some programs include headers defined in earlier chapters
    # LOCFLAGS used to set tell the compiler where to find a
    # header that is not in the same directory as the source file itself
    # LOCFLAGS will be set in directory level makefiles as needed
    LOCFLAGS =
    
    ### 
    
    ####### To compile without using a makefile
    # To compile an object file from a source file you could execute
    # g++ -std=c++0x -c filename.cc # produces filename.obj
    # To compile an executable file from an object file, you would execute
    # g++ -std=c++0x filename.o      # produces filename.exe
    # To compile an executable file from a source file, you would execute
    # g++ -std=c++0x filename.cc    # produces filename.exe
    #######
    
    # each subdirectory contains a Makefile that lists the executable
    # files that can be made in that directory.  That list is assigned
    # to the make macro named $OBJECTS
    # This rule says that the make target named "all" depends on those
    # files.  Executing "make all" in a subdirectory will cause make
    # to build each .exe file listed in that subdirectory's makefile
    all: $(OBJECTS) 
    
    # rule that says how to make a .o object file from a .cc source file
    # for a given source file in a given directory you could compile it
    # into an object file by executing "make filename.o"
    
    # $< and $@ are macros defined by make
    #     $< refers to the file being processed (i.e., compiled or linked)
    #     $@ refers to the generated file
    %.o: %.cc 
    	$(CC) $(CCFLAGS) $(LOCFLAGS) -c $< -o $@
    
    # rule that says how to make a .exe executable file from a .o object file
    %.exe: %.o 
    	$(CC) $(CCFLAGS) $(LOCFLAGS) $< -o $@
    
    # target to clean up the object files and any core files
    # executing "make clean" in a subdirectory will remove all
    # files named core or any file ending in .obj, or .stackdump
    clean:
    	rm -rf *.o core *.stackdump
    
    # target to remove executable files as well as object and core files
    clobber: clean
    	rm -rf *.exe 
    
  • 相关阅读:
    用Python实现QQ找茬游戏外挂工具
    Python常用模块
    将Qt 动态链接生成的exe及依赖dll打包方法
    Qt之VLFeat SLIC超像素分割(Cpp版)
    android studio下的NDK开发详解(一)
    条件注释判断浏览器版本<!--[if lt IE 9]>
    人脸识别中的八大难题,何时能解
    人脸识别简史与近期进展
    openCV之头文件分析
    看(学习)代码流程
  • 原文地址:https://www.cnblogs.com/qwertWZ/p/4753616.html
Copyright © 2011-2022 走看看