On the importance of Makefile (ii)-----Linux C Development

Source: Internet
Author: User
Tags mul

Pick up 1 . About the upgrade version of Makefile one: libmath.a:add.o sub.o mul.o devl.o    ar RCS [email protected] $^ADD.O:ADD.C    -C$^    sub.o:sub.c-C $^    mul.o:mul.c-C $^devl.o:devl.c    -C $^. Phony:cleanclean:    -F add.o sub.o MUL.O DEVL.O

2 . version 2obj=add.o sub.o mul.o devl.odest=libmath.a$ (dest): $ (obj)    ar rcs [email protected ] $^%.o:%. C    -$^. Phony:cleanclean:    -F $ (obj)
3 version three: src=$ (wildcard *. c) obj=$ (patsubst%.c,%. O, $ (src)) dest=libmath.a$ (dest): $ (obj    ar RCS [email protected] $^%.o:%. C    -$^. Phony:cleanclean:    -F $ (obj) $ (dest)
1 4. Version four:2src=$ (Wildcard *. C)3obj=$ (Patsubst%.c,%. O, $ (src))4 5Cc=GCC6cflags=-g7ldflags=8cppflags=9 Tendest=libmath.a One#dest =a. out A  -  - $ (dest): $ (obj) theAR RCS [email protected] $^ -#$ (CC) $ (ldflags) $^-o [email protected] -%.o:%. C -$ (CC) $ (CFLAGS)-C $^ +  - . Phony:clean + Clean : A-rm-f $ (obj) $ (dest)

On the importance of Makefile (ii)-----Linux C Development

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.