Linux C Learning Note 01--makefile

Source: Internet
Author: User

Unconsciously graduated five years ago, the previous learning of Linux Basic Forget, re-review up!

Here is the makefile file that you wrote for beginners and looking back

Cc=GCCEXE=C.OUTCCC=g++EEE=cc. Out INC=/home/malth/project/include/LIB=/home/malth/project/lib/#添加文件搜索路经vpath=/home/malth/project/Lib#vpath%.h ~/project/include out=main.o bubbling_sort.o thread.o share_memory.ocfile=main.c bubbling_sort.c thread.c share_memory.cctest:$ (out) @echo compiling start ... #命令前加-minus can ignore command execution error message # "@"The symbol can hide the command, the command executes but does not show the command itself # Debug Discovery*.O file do gcc-o connection generated executable file cannot be gdb debug Gu added *. c files directly generated for selection # $ (CC) $ (out)-static $ (LIB) Slib.a-lpthread-o $ (EXE) $ (CC) $ (CFILE)-i$ (INC)-static $ (LIB) Slib.a-lpthread-g-o $ (EXE) @echo compile successed!#    @-RM-F *. OMAIN.O:MAIN.C $ (CC)-i$ (INC)-C-g main.c common.o:common.c $ (CC)-C-g common.c thread.o:thread.c $ (CC)-C-g THREAD.C bubbling_sort.o:bubbling_sort.c $ (CC)-C-g bubbling_sort.cshare_memory.o:share_memory.c $ (CC)-C-g Share_memory.ccctest:test.cc-RM-Fcc. Out $ (CCC)-O $ (EEE) test.cc###################################################### #create the static LIBRARYSLIB:STATIC_LIB.Oar-RCS SLIB.A STATIC_LIB.OMV-F SLIB.A $ (LIB) STATIC_LIB.O:STATIC_LIB.C $ (CC)-c static_lib.c##################################################### #clean:-RM-F $ (EXE) $ (EEE) *. Olsresult=Result:=$ (words Hello World) All: @echo-N"result is:"@echo $ (result). Phony:all

Linux C Learning Note 01--makefile

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.