#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

GNU_makefile_template的更多相关文章

随机推荐

  1. linux别名

    alias: alias   cdn ='cd /opt/lammp' [root@besttest /]# cdn[root@besttest lampp]# 如果想永久生效写进root/.bash ...

  2. 【记忆化搜索】Codeforces Round #295 (Div. 2) B - Two Buttons

    题意:给你一个数字n,有两种操作:减1或乘2,问最多经过几次操作能变成m: 随后发篇随笔普及下memset函数的初始化问题.自己也是涨了好多姿势. 代码 #include<iostream> ...

  3. Fragment生命周期详解

    处理fragement的生命周期 管理fragment的生命周期有些像管理activity的生命周期.Fragment可以生存在三种状态: Resumed: Fragment在一个运行中的activi ...

  4. linux信息查找

    问题: 1. 当使用一台linux机器的时候,常常需要确认当前所用操作系统的版本信息,内核信息等, 操作系统的版本信息可以通过以下命令完成,比如:lsb_release -a:cat /etc/iss ...

  5. MySQL DBA 刚入职时如何快速拥抱新的环境

    方法何其多.这里介绍的是懒人做法.也就是.借助工具   但是.生产环境是不能随便安装程序的.肿么办?   没关系.我们伟大的percona 已经为我们考虑周详鸟      这里.我们要借助三个工具:  ...

  6. Asp.Net MVC 路由 【转】

    原文链接:http://www.asp.net/learn/mvc/ 在这篇教程中,我将为你介绍每个ASP.NET MVC应用程序都具有的一个重要功能,称作ASP.NET路由(ASP.NET Rout ...

  7. 设置transparent是否多此一举

    在css是设置中我们经常会用到background:transparent这一属性设置,表示背景透明.但是background默认的颜色就是透明的!那么设置是否属于多此一举呢?我们浏览网页时经常见到“ ...

  8. Jsoup 的认识和简单使用

    之前做学校软件协会APP的时候,由于自己不会在服务端写接口,所以服务端一直是由另一位Z同学完成的,但是突然Z同学被老师调到泸州帮以前的学长做一个月的临时web开发去了,所以协会APP的接口只做了一部分 ...

  9. SignalR 2.0 系列:SignalR的服务器广播

    英文渣水平,大伙凑合着看吧…… 这是微软官方SignalR 2.0教程Getting Started with ASP.NET SignalR 2.0系列的翻译,这里是第八篇:SignalR的服务器广 ...

  10. Linux/centos/redhat下各种压缩解压缩方式详解

    1.zip命令 zip -r myfile.zip ./* 将当前目录下的所有文件和文件夹全部压缩成myfile.zip文件,-r表示递归压缩子目录下所有文件. 2.unzip unzip -o -d ...