Makefile Common templates

Source: Internet
Author: User
Tags mkdir
where Makefile_inlcude is
########################################################################
############ makefile_include##############################################
########## #by rainfish#####################################################
############ #http://blog.csdn.net/bat603######################################
#编译程序所需要的库文件包含路径
Incl_path =/
-I.
#lib文件的包含路径
Lib_path =-l$ (cms_home)/lib-l/usr/local/lib

Include path to #系统库 header file, lib file
Sys_incl_path =
Sys_lib_path =

#SYBASE_LIBS =-lsybct-lsybblk-lsybtcl-lsybcs-lsybcomn-lsybintl-lsybunic
#程序需要的系统库文件
Sys_libs =-LM-LNSL-LDL

#编辑器
ccc=g++
#编译程序时的参数
Ccflags =-g-w-dlinux-ddebug-d_use_macro-dsql_sybase-d_cserver_debug_/
${incl_path} ${sys_incl_path}
#连接程序时的库文件路径
Cppflags = ${lib_path} ${sys_lib_path}
#连接程序时的库文件
Cpplibs = ${libs} ${sys_libs}

#生成静态库
AR = AR
#生成静态库参数
Arflags =-ruv

#SHARE = $ (CCC)

#SHAREFLAGS =-shared-o

#安装程序的路径 Lib and executable programs.
Install_path= $ (PWD)/lib
Install_bin_path= $ (PWD)/bin
Target_path=./

OBJECTS=${SOURCES:%.CPP=%.O}

All: ${clib} ${program}

${clib}: ${objects}
@if [!-D ${target_path}]; Then Mkdir-p ${target_path}; Fi
$ (AR) ${arflags} ${clib} $ (OBJECTS)
#$ (SHARE) ${shareflags} ${clib}.so $ (OBJECTS)

${program}: ${objects}
@if [!-D ${target_path}]; Then Mkdir-p ${target_path}; Fi
$ (CCC)-O $@ ${cppflags} $ (OBJECTS) $ (cpplibs)

. CPP.O:
$ (CCC) $ (ccflags)-O $@-C $<

Install
@if ["X${clib}"!= "X"]; Then Mkdir-p ${install_path}; CP $ (Clib) $ (install_path); Fi
@if ["X${program}"!= "X"]; Then Mkdir-p ${install_bin_path}; CP $ (Program) $ (Install_bin_path); Fi

Clean
@rm-rf ${objects} ${clib} ${program}
@rm-RF Ir.out
@rm-RF core.*
@rm-RF My
@rm-RF

Makefile file is
############################################################
# # Makefile of Sqlite3
############################################################
########## #by rainfish#####################################################
############ #http://blog.csdn.net/bat603######################################
. Suffixes:. cpp

#需要编译的源文件
SOURCES = Sqlite3.cpp #可有多个, separated by spaces
#生成的可执行文件名
Program =sqlite3
#生成的库文件, only static link libraries can be generated
Clib =
#需要的库文件
LIBS =-lsqlite3

Cms_home =.

Include ${cms_home}/makefile.include


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.