Examples of multiple makefile

Source: Internet
Author: User
In the previous example, we usually do not put all the source code and makefile in the same directory, especially for larger projects. This is assumed to have led this project, in the LED this project directory has a main directory, the main directory of files for the previous main.c, delay.c and Delay.h,main directory under the makefile as follows:
CC      = SDCC

all:delay.rel main.rel

delay.rel:delay.c
        $ (cc)-C delay.c

main.rel:main.c delay.h
        $ (CC)-C main.c

. Phony:clean clean
:
        -rm delay.asm delay.lst delay.rel delay.sym delay.rst\
                main.asm main.lst Main.rel Main.sym Main.rst
In the main directory, just compile the. c file, do not make the final link, and make the last link under the project root of the previous layer, makefile as follows:
CC      = SDCC

all:led.bin

led.bin:led.ihx
        makebin led.ihx led.bin

Led.ihx:main/delay.rel Main /main.rel
        $ (CC)-O led.ihx main/delay.rel main/main.rel

main/delay.rel main/main.rel:
        CD Main & & Make

. Phony:clean clean
:
        -rm led.bin led.ihx led.lk led.map led.mem
        CD main && do clean


The entire project can be downloaded from here: http://download.csdn.net/detail/mcgrady_tracy/6845081

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.