Linux under a few common makefile templates, pro-Test available

Source: Internet
Author: User

A template that generates a dynamic-link library:

  

1 #######################2 # Makefile3 #######################4 5 # Compile and lib parameter6CC: = g++7LIBS: =8Ldflags: =9Defines: =TenINCLUDE: =-I. OneCFLAGS: = Acxxflags:= -  - # link Parameter the#LIB: =libfunc.so -LIB: =LIBFUNC.A -  - #link + $ (LIB): FUNC.O -$ (CC)-shared-o-fpic-o [email protected] $^ + #compile A FUNC.O:THREAD.C at$ (CC)-c-fpic $^-o [email protected] -  - # Clean - Clean : -RM-FR *.O
View Code

 

Two templates for compiling executable programs:

1 ###########################################2#Makefile forSimple Programs3 ###########################################4Inc=5Lib=-Lpthread6 7Cc=GCC8cc_flag=-Wall9 Tenprg=ThreadTest One#OBJ =thread.o cthreadpool.o cthread.o cworkerthread.o threadpooltest.o Aobj=THREAD.O -  - $ (PRG): $ (OBJ) the$ (CC) $ (INC)-o [email protected] $ (OBJ) $ (LIB) -          - . Suffixes:. C. O cpp - . CPP.O: +$ (CC) $ (cc_flag) $ (INC)-C $*.cpp-o $*. O -  + . Prony:clean A Clean : at@echo"removing linked and compiled files ..." -Rm-f $ (OBJ) $ (PRG)
View Code

Test results:

1 Reference Documentation: 7988192

2 Code path: Https://github.com/DyLanCao/iApply/tree/master/c_example/makefile

Linux under a few common makefile templates, pro-Test available

Related Article

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.