Linux GCC make file format 4-clear version

Source: Internet
Author: User

Contains 3 folders and a file makefile

The directory structure is as follows:

Makefile

INC/Hello. h

Main/Main. c

Src/Hello. c

Make the MAKEFILE file out, so that the generated. O and executable files are all out. After cleaning, the files will be clean and the structure will be clear.

The file content is as follows:

Makefile )::

# String declaration <br/> objects = Main. O hello. O </P> <p> # command <br/> app: $ (objects) <br/> CC-O app $ (objects) <br/> main. o: Main/main. c hello. h <br/> CC-C main/main. c <br/> hello. o: src/hello. c stdio. h <br/> CC-C src/hello. c </P> <p> # search paths <br/> vpath %. h/usr/include Inc </P> <p> # clean the intermediate files <br/>. phony: Clean <br/> clean: <br/> RM app $ (objects) <br/>

Hello. h:

Void Hello (char name []);

Main. C:

# Include <stdio. h> <br/> # include ".. /INC/hello. H "<br/> // The second hello. h shoshould in "" <br/> int main () <br/> {<br/> Hello ("GCC"); <br/> printf ("Haha Linux Ubuntu! /N "); <br/> return 0; <br/>}

The second file, hello. H, must use "". If <> is used, GCC only searches the system directory and does not search the current directory.

Is "" in the user directory, <> in the system directory, This is not strict on Windows, it seems very strict in Linux

Hello. C:

# Include <stdio. h> </P> <p> void Hello (char name []) <br/> {<br/> printf ("Hello % s! /N ", name); <br/>}< br/>

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.