SlideShare ist ein Scribd-Unternehmen logo
1 von 3
Downloaden Sie, um offline zu lesen
Makefile                                                                             http://dev.emcelettronica.com/print/51790




                         Your Electronics Open Source
           (http://dev.emcelettronica.com)
           Home > Blog > allankliu's blog > Content




           Makefile
           By allankliu
           Created 27/05/2008 - 04:29

           BLOG Microcontrollers

           When I first visited one of our famous TV manufacturers in
           China, I had no idea about the software capability of their
           software team. When I demonstrated my company's TV
           software for their evaluation, the software leader was
           surprised to see the modular software programming in many
           individual files. The software manager even commented,
           quot;Your software structure is very stupid, why do you put all of
           these functions into so many smaller files, instead of one
           single file? It is very head to find the variables in different files
           and requires longer compiling time.quot; I was almost choked by
           his words. But I could not argue with our customer face to face, it is very harmful to our
           business. So I let him to find the real answer, which way is stupid anyway?

           I can figure out why they got such one big file approach and stuck on it. First of all, none of
           this software team had programming background in UNIX, they only knew about DOS and
           Windows. Basically their programming experiences were only MS C++ or Turbo C++, which
           has IDE tools. And they got their first code base from Toshiba, I do not know why Toshiba
           released one single source file for their development, maybe it was a business trick. However
           I realized I need to prove our software advantage over theirs. So I changed one file of my
           software and the big file of their software, and then compile them separately. It requires 3
           minutes to compile their big source file. And it completed compiling of my software with a
           make command in 5 seconds. Even they saw the difference, they still insisted on their points,
           but I knew they re-organized the whole software structure after this training.

           Most of the electronics engineers are not software experts, so they are innocent about many
           important software engineering concepts. Thanks Microsoft and Borland, this kind of innocent
           is all right for a PC programmer. These IDEs have already embedded make utilities. For
           example, nmake for MS C++, tmake for Borland Turbo C++. But most of the early embedded
           development tools did not offer make utility as a package, of course they did not offer IDEs as
           well. At that moment, or even today, a lot of engineers still use a batch file to compile their
           source code. They do not know about split the source into different head files and source
           files. They do not know how to use make to only compile the files changed, instead of whole
           project. They do not know how to use other utility to automatically generate head files from
           configuration files. They have no ideas how to manage a big project at all. I will like to discuss
           these topics in coming weeks, let us start it with makefile.

           Makefile actually is an old concept from UNIX development. Makefile is based upon compiling
           rules for a project and improve the project development efficiency. In a big project, there are
           many files in different folders. Of course you can write a DOS batch file to build whole project.


1 din 3                                                                                                     28.05.2008 11:15
Makefile                                                                                  http://dev.emcelettronica.com/print/51790


           But makefile can judge which steps should be done first, which steps can be ignored, and
           even more complicated goals. All of these are decided by the rules in makefile, instead of
           manually specified. Of course, in order to utilize make features, a project should be written in
           modular programming method, one big file project can just be programmed once anyway. PS:
           The modular programming has many other benefits in software engineering, not only for
           makefile.

           The rule of makefile is:


              target ... : prerequisites ...
                command
                ...
                ...


           That means, in order to build a target (i.e. object files), we should have files of prerequisites
           (i.e. head files), the conversion tools are command (i.e. c compiler). This rules are core of a
           makefile. Here is a simple makefile for GNU make (gmake). One implicit rule is that the
           conversion takes place only if the one of prerequisites files is newer than the target. That
           means it changed since last make. By the way, you must type a table key before command,
           otherwise the gmake will not process it.


              edit : main.o kbd.o command.o display.o 
                  insert.o search.o files.o utils.o
                cc -o edit main.o kbd.o command.o display.o 
                  insert.o search.o files.o utils.o
              main.o : main.c defs.h
                cc -c main.c
              kbd.o : kbd.c defs.h command.h
                cc -c kbd.c
              command.o : command.c defs.h command.h
                cc -c command.c
              display.o : display.c defs.h buffer.h
                cc -c display.c
              insert.o : insert.c defs.h buffer.h
                cc -c insert.c
              search.o : search.c defs.h buffer.h
                cc -c search.c
              files.o : files.c defs.h buffer.h command.h
                cc -c files.c
              utils.o : utils.c defs.h
                cc -c utils.c
              clean :
                rm edit main.o kbd.o command.o display.o 
                  insert.o search.o files.o utils.o


           If defs.h changed, then all related targets, i.e. all *.o files will be generated, and finally edit file
           will be generated. If main.c changed, the makefile will only generate main.o and edit. That is
           rule of a makefile. You can also type quot;make cleanquot; to remove all of the generated files on list
           by executing rm command. The example is small for demonstration purpose, it will be very
           efficient in a huge project like DTV project. If you still stick on DOS batch, every single
           change will test your patient.


2 din 3                                                                                                          28.05.2008 11:15
Makefile                                                                            http://dev.emcelettronica.com/print/51790


           Different make tools have different syntax, in order to unique our embedded system
           development, GNU gmake is a good tools for most of the embedded system. But GNU
           gmake is a quite complicated tool, you might have no interested in its 200-page manuals.
           Personally I recommend the makefile template from AVR freak for your reference, the
           makefile has been separated into common makefile and a project make. This offers a mature
           makefile starting point for your project. You can download the GCC tools from this site, the
           makefile and a demo project is included. You can easily port it to your existing projects on
           8051, PIC, MSP... Don't bother for ARM or MIPS, their tool chains have already integrated
           gmake.

           Makefile has its own issues, recursive make, which splits one central makefile into distributed
           makefile in different folders and sub folders. That is quite common is Linux project. The
           author of Safer C presented an article as Harmful Recursive Makefile. You can read it if you
           are interested in this topic. But AVRfreak's makefile is enough for medium size project.

           In next blog, let us discuss how to use gawk to automatically generated the dependency rules
           of make file. It is funny. You can reuse that principle to generate document as well. I know
           you hate writing documents and synchronize the code changes to your documents in every
           time.

           Reference



                                                  P.Miller's Safer C and makefile




                                            [1]




                                                  AVRFreak web site




                                            [2]




                                                             Trademarks



           Source URL: http://dev.emcelettronica.com/makefile

           Links:
           [1] http://miller.emu.id.au/pmiller/books/rmch/
           [2] http://www.avrfreaks.net/



3 din 3                                                                                                    28.05.2008 11:15

Weitere ähnliche Inhalte

Was ist angesagt?

Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
Composer the right way - SunshinePHP
Composer the right way - SunshinePHPComposer the right way - SunshinePHP
Composer the right way - SunshinePHPRafael Dohms
 
PHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBeneluxPHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBeneluxNick Belhomme
 
Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)Nils Adermann
 
Managing your Drupal project with Composer
Managing your Drupal project with ComposerManaging your Drupal project with Composer
Managing your Drupal project with ComposerMatt Glaman
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with ComposerAdam Englander
 
Getting Started With Subversion
Getting Started With SubversionGetting Started With Subversion
Getting Started With SubversionJordan Hatch
 
Composer - Package Management for PHP. Silver Bullet?
Composer - Package Management for PHP. Silver Bullet?Composer - Package Management for PHP. Silver Bullet?
Composer - Package Management for PHP. Silver Bullet?Kirill Chebunin
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with dockerRuoshi Ling
 
Php Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant KillerPhp Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant KillerJackson F. de A. Mafra
 
CodeIgniter Lab
CodeIgniter LabCodeIgniter Lab
CodeIgniter LabLeo Nguyen
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovskyphp-user-group-minsk
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Clark Everetts
 

Was ist angesagt? (20)

Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Composer the right way - SunshinePHP
Composer the right way - SunshinePHPComposer the right way - SunshinePHP
Composer the right way - SunshinePHP
 
Composer
ComposerComposer
Composer
 
hw1a
hw1ahw1a
hw1a
 
Composer
ComposerComposer
Composer
 
PHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBeneluxPHP Quality Assurance Workshop PHPBenelux
PHP Quality Assurance Workshop PHPBenelux
 
Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)
 
Managing your Drupal project with Composer
Managing your Drupal project with ComposerManaging your Drupal project with Composer
Managing your Drupal project with Composer
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
 
Getting Started With Subversion
Getting Started With SubversionGetting Started With Subversion
Getting Started With Subversion
 
Composer - Package Management for PHP. Silver Bullet?
Composer - Package Management for PHP. Silver Bullet?Composer - Package Management for PHP. Silver Bullet?
Composer - Package Management for PHP. Silver Bullet?
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with docker
 
C in7-days
C in7-daysC in7-days
C in7-days
 
C in7-days
C in7-daysC in7-days
C in7-days
 
Php Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant KillerPhp Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant Killer
 
CodeIgniter Lab
CodeIgniter LabCodeIgniter Lab
CodeIgniter Lab
 
Phalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil ConferencePhalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil Conference
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovsky
 
A05
A05A05
A05
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016
 

Ähnlich wie Makefile

WordPress modern development
WordPress modern developmentWordPress modern development
WordPress modern developmentRoman Veselý
 
Autotools, Design Patterns and more
Autotools, Design Patterns and moreAutotools, Design Patterns and more
Autotools, Design Patterns and moreVicente Bolea
 
Application Development | Delphi Review 2009
Application Development | Delphi Review 2009Application Development | Delphi Review 2009
Application Development | Delphi Review 2009Michael Findling
 
Makefile for python projects
Makefile for python projectsMakefile for python projects
Makefile for python projectsMpho Mphego
 
Introduction to Software Build Technology
Introduction to Software Build TechnologyIntroduction to Software Build Technology
Introduction to Software Build TechnologyPhilip Johnson
 
C++ Restrictions for Game Programming.
C++ Restrictions for Game Programming.C++ Restrictions for Game Programming.
C++ Restrictions for Game Programming.Richard Taylor
 
create_patch_file_v3a.pdf
create_patch_file_v3a.pdfcreate_patch_file_v3a.pdf
create_patch_file_v3a.pdfvilaylala
 
Top 10 IDEs for React.js Developers in 2021
Top 10 IDEs for React.js Developers in 2021Top 10 IDEs for React.js Developers in 2021
Top 10 IDEs for React.js Developers in 2021WrapPixel
 
An Introduction To Linux Development Environment
An Introduction To Linux Development EnvironmentAn Introduction To Linux Development Environment
An Introduction To Linux Development EnvironmentS. M. Hossein Hamidi
 
Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"LogeekNightUkraine
 
What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...Sławomir Zborowski
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notesWE-IT TUTORIALS
 
Trying to Sell PVS-Studio to Google, or New Bugs in Chromium
Trying to Sell PVS-Studio to Google, or New Bugs in ChromiumTrying to Sell PVS-Studio to Google, or New Bugs in Chromium
Trying to Sell PVS-Studio to Google, or New Bugs in ChromiumAndrey Karpov
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkitPaul Jensen
 
Software Build processes and Git
Software Build processes and GitSoftware Build processes and Git
Software Build processes and GitAlec Clews
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made EasyAlon Fliess
 
How to start your open source project
How to start your open source projectHow to start your open source project
How to start your open source projectEslam Diaa
 
The seven pillars of aspnet
The seven pillars of aspnetThe seven pillars of aspnet
The seven pillars of aspnetNethaji Naidu
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics PresentationSudhakar Sharma
 

Ähnlich wie Makefile (20)

WordPress modern development
WordPress modern developmentWordPress modern development
WordPress modern development
 
Autotools, Design Patterns and more
Autotools, Design Patterns and moreAutotools, Design Patterns and more
Autotools, Design Patterns and more
 
Application Development | Delphi Review 2009
Application Development | Delphi Review 2009Application Development | Delphi Review 2009
Application Development | Delphi Review 2009
 
Makefile for python projects
Makefile for python projectsMakefile for python projects
Makefile for python projects
 
Introduction to Software Build Technology
Introduction to Software Build TechnologyIntroduction to Software Build Technology
Introduction to Software Build Technology
 
C++ Restrictions for Game Programming.
C++ Restrictions for Game Programming.C++ Restrictions for Game Programming.
C++ Restrictions for Game Programming.
 
create_patch_file_v3a.pdf
create_patch_file_v3a.pdfcreate_patch_file_v3a.pdf
create_patch_file_v3a.pdf
 
Top 10 IDEs for React.js Developers in 2021
Top 10 IDEs for React.js Developers in 2021Top 10 IDEs for React.js Developers in 2021
Top 10 IDEs for React.js Developers in 2021
 
An Introduction To Linux Development Environment
An Introduction To Linux Development EnvironmentAn Introduction To Linux Development Environment
An Introduction To Linux Development Environment
 
Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"
 
What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
 
Trying to Sell PVS-Studio to Google, or New Bugs in Chromium
Trying to Sell PVS-Studio to Google, or New Bugs in ChromiumTrying to Sell PVS-Studio to Google, or New Bugs in Chromium
Trying to Sell PVS-Studio to Google, or New Bugs in Chromium
 
Part i
Part iPart i
Part i
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkit
 
Software Build processes and Git
Software Build processes and GitSoftware Build processes and Git
Software Build processes and Git
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
How to start your open source project
How to start your open source projectHow to start your open source project
How to start your open source project
 
The seven pillars of aspnet
The seven pillars of aspnetThe seven pillars of aspnet
The seven pillars of aspnet
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics Presentation
 

Mehr von Ionela

IoT with OpenPicus Flyport
IoT with OpenPicus FlyportIoT with OpenPicus Flyport
IoT with OpenPicus FlyportIonela
 
Flyport wifi webserver configuration page
Flyport wifi webserver configuration pageFlyport wifi webserver configuration page
Flyport wifi webserver configuration pageIonela
 
openPicus Proto Nest Datasheet
openPicus Proto Nest DatasheetopenPicus Proto Nest Datasheet
openPicus Proto Nest DatasheetIonela
 
How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with Ionela
 
Openpicus Flyport interfaces the cloud services
Openpicus Flyport interfaces the cloud servicesOpenpicus Flyport interfaces the cloud services
Openpicus Flyport interfaces the cloud servicesIonela
 
Flyport openPicus datasheet
Flyport openPicus datasheetFlyport openPicus datasheet
Flyport openPicus datasheetIonela
 
Windows phone 7 è l’ultima occasione di microsoft 2010-10-18
Windows phone 7 è l’ultima occasione di microsoft   2010-10-18Windows phone 7 è l’ultima occasione di microsoft   2010-10-18
Windows phone 7 è l’ultima occasione di microsoft 2010-10-18Ionela
 
Videocamera cam ball un mare di caratteristiche nella piccola videocamera a ...
Videocamera cam ball  un mare di caratteristiche nella piccola videocamera a ...Videocamera cam ball  un mare di caratteristiche nella piccola videocamera a ...
Videocamera cam ball un mare di caratteristiche nella piccola videocamera a ...Ionela
 
Utente premium 2010-10-17
Utente premium   2010-10-17Utente premium   2010-10-17
Utente premium 2010-10-17Ionela
 
Unity sostituisce gnome su ubuntu 11.04 2010-11-01
Unity sostituisce gnome su ubuntu 11.04   2010-11-01Unity sostituisce gnome su ubuntu 11.04   2010-11-01
Unity sostituisce gnome su ubuntu 11.04 2010-11-01Ionela
 
Una retina artificiale per ridare la vista 2010-11-10
Una retina artificiale per ridare la vista   2010-11-10Una retina artificiale per ridare la vista   2010-11-10
Una retina artificiale per ridare la vista 2010-11-10Ionela
 
Un orologio elettronico completo basato su i2 c rtcc mcp79410 2010-10-29
Un orologio elettronico completo basato su i2 c rtcc mcp79410   2010-10-29Un orologio elettronico completo basato su i2 c rtcc mcp79410   2010-10-29
Un orologio elettronico completo basato su i2 c rtcc mcp79410 2010-10-29Ionela
 
Ultimo lancio discovery delle perdite rinviano l’ultimo lancio dello shuttle...
Ultimo lancio discovery  delle perdite rinviano l’ultimo lancio dello shuttle...Ultimo lancio discovery  delle perdite rinviano l’ultimo lancio dello shuttle...
Ultimo lancio discovery delle perdite rinviano l’ultimo lancio dello shuttle...Ionela
 
Ubuntu passa a wayland 2010-11-08
Ubuntu passa a wayland   2010-11-08Ubuntu passa a wayland   2010-11-08
Ubuntu passa a wayland 2010-11-08Ionela
 
Touchatag un'applicazione di internet delle cose 2010-11-10
Touchatag  un'applicazione di internet delle cose   2010-11-10Touchatag  un'applicazione di internet delle cose   2010-11-10
Touchatag un'applicazione di internet delle cose 2010-11-10Ionela
 
Tianhe 1, il supercomputer cinese - 2010-11-05
Tianhe 1, il supercomputer cinese - 2010-11-05Tianhe 1, il supercomputer cinese - 2010-11-05
Tianhe 1, il supercomputer cinese - 2010-11-05Ionela
 
Thread o processo quale usare - 2010-11-02
Thread o processo  quale usare  - 2010-11-02Thread o processo  quale usare  - 2010-11-02
Thread o processo quale usare - 2010-11-02Ionela
 
Termometro digitale usando pic16 f84a schema elettrico - 2010-11-03
Termometro digitale usando pic16 f84a   schema elettrico - 2010-11-03Termometro digitale usando pic16 f84a   schema elettrico - 2010-11-03
Termometro digitale usando pic16 f84a schema elettrico - 2010-11-03Ionela
 
Telescopio webb il sistema di engineering del telescopio webb della nasa si ...
Telescopio webb  il sistema di engineering del telescopio webb della nasa si ...Telescopio webb  il sistema di engineering del telescopio webb della nasa si ...
Telescopio webb il sistema di engineering del telescopio webb della nasa si ...Ionela
 
Tecnologia light peak intel potrebbe adottarla da inizio 2011, apple a segui...
Tecnologia light peak  intel potrebbe adottarla da inizio 2011, apple a segui...Tecnologia light peak  intel potrebbe adottarla da inizio 2011, apple a segui...
Tecnologia light peak intel potrebbe adottarla da inizio 2011, apple a segui...Ionela
 

Mehr von Ionela (20)

IoT with OpenPicus Flyport
IoT with OpenPicus FlyportIoT with OpenPicus Flyport
IoT with OpenPicus Flyport
 
Flyport wifi webserver configuration page
Flyport wifi webserver configuration pageFlyport wifi webserver configuration page
Flyport wifi webserver configuration page
 
openPicus Proto Nest Datasheet
openPicus Proto Nest DatasheetopenPicus Proto Nest Datasheet
openPicus Proto Nest Datasheet
 
How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with
 
Openpicus Flyport interfaces the cloud services
Openpicus Flyport interfaces the cloud servicesOpenpicus Flyport interfaces the cloud services
Openpicus Flyport interfaces the cloud services
 
Flyport openPicus datasheet
Flyport openPicus datasheetFlyport openPicus datasheet
Flyport openPicus datasheet
 
Windows phone 7 è l’ultima occasione di microsoft 2010-10-18
Windows phone 7 è l’ultima occasione di microsoft   2010-10-18Windows phone 7 è l’ultima occasione di microsoft   2010-10-18
Windows phone 7 è l’ultima occasione di microsoft 2010-10-18
 
Videocamera cam ball un mare di caratteristiche nella piccola videocamera a ...
Videocamera cam ball  un mare di caratteristiche nella piccola videocamera a ...Videocamera cam ball  un mare di caratteristiche nella piccola videocamera a ...
Videocamera cam ball un mare di caratteristiche nella piccola videocamera a ...
 
Utente premium 2010-10-17
Utente premium   2010-10-17Utente premium   2010-10-17
Utente premium 2010-10-17
 
Unity sostituisce gnome su ubuntu 11.04 2010-11-01
Unity sostituisce gnome su ubuntu 11.04   2010-11-01Unity sostituisce gnome su ubuntu 11.04   2010-11-01
Unity sostituisce gnome su ubuntu 11.04 2010-11-01
 
Una retina artificiale per ridare la vista 2010-11-10
Una retina artificiale per ridare la vista   2010-11-10Una retina artificiale per ridare la vista   2010-11-10
Una retina artificiale per ridare la vista 2010-11-10
 
Un orologio elettronico completo basato su i2 c rtcc mcp79410 2010-10-29
Un orologio elettronico completo basato su i2 c rtcc mcp79410   2010-10-29Un orologio elettronico completo basato su i2 c rtcc mcp79410   2010-10-29
Un orologio elettronico completo basato su i2 c rtcc mcp79410 2010-10-29
 
Ultimo lancio discovery delle perdite rinviano l’ultimo lancio dello shuttle...
Ultimo lancio discovery  delle perdite rinviano l’ultimo lancio dello shuttle...Ultimo lancio discovery  delle perdite rinviano l’ultimo lancio dello shuttle...
Ultimo lancio discovery delle perdite rinviano l’ultimo lancio dello shuttle...
 
Ubuntu passa a wayland 2010-11-08
Ubuntu passa a wayland   2010-11-08Ubuntu passa a wayland   2010-11-08
Ubuntu passa a wayland 2010-11-08
 
Touchatag un'applicazione di internet delle cose 2010-11-10
Touchatag  un'applicazione di internet delle cose   2010-11-10Touchatag  un'applicazione di internet delle cose   2010-11-10
Touchatag un'applicazione di internet delle cose 2010-11-10
 
Tianhe 1, il supercomputer cinese - 2010-11-05
Tianhe 1, il supercomputer cinese - 2010-11-05Tianhe 1, il supercomputer cinese - 2010-11-05
Tianhe 1, il supercomputer cinese - 2010-11-05
 
Thread o processo quale usare - 2010-11-02
Thread o processo  quale usare  - 2010-11-02Thread o processo  quale usare  - 2010-11-02
Thread o processo quale usare - 2010-11-02
 
Termometro digitale usando pic16 f84a schema elettrico - 2010-11-03
Termometro digitale usando pic16 f84a   schema elettrico - 2010-11-03Termometro digitale usando pic16 f84a   schema elettrico - 2010-11-03
Termometro digitale usando pic16 f84a schema elettrico - 2010-11-03
 
Telescopio webb il sistema di engineering del telescopio webb della nasa si ...
Telescopio webb  il sistema di engineering del telescopio webb della nasa si ...Telescopio webb  il sistema di engineering del telescopio webb della nasa si ...
Telescopio webb il sistema di engineering del telescopio webb della nasa si ...
 
Tecnologia light peak intel potrebbe adottarla da inizio 2011, apple a segui...
Tecnologia light peak  intel potrebbe adottarla da inizio 2011, apple a segui...Tecnologia light peak  intel potrebbe adottarla da inizio 2011, apple a segui...
Tecnologia light peak intel potrebbe adottarla da inizio 2011, apple a segui...
 

Kürzlich hochgeladen

Call Girls Service Nagpur Maya Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Maya Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Maya Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Maya Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Andheri Call Girls In 9825968104 Mumbai Hot Models
Andheri Call Girls In 9825968104 Mumbai Hot ModelsAndheri Call Girls In 9825968104 Mumbai Hot Models
Andheri Call Girls In 9825968104 Mumbai Hot Modelshematsharma006
 
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...Suhani Kapoor
 
The Economic History of the U.S. Lecture 23.pdf
The Economic History of the U.S. Lecture 23.pdfThe Economic History of the U.S. Lecture 23.pdf
The Economic History of the U.S. Lecture 23.pdfGale Pooley
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceanilsa9823
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
06_Joeri Van Speybroek_Dell_MeetupDora&Cybersecurity.pdf
06_Joeri Van Speybroek_Dell_MeetupDora&Cybersecurity.pdf06_Joeri Van Speybroek_Dell_MeetupDora&Cybersecurity.pdf
06_Joeri Van Speybroek_Dell_MeetupDora&Cybersecurity.pdfFinTech Belgium
 
03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptxFinTech Belgium
 
The Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfThe Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfGale Pooley
 
Instant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School DesignsInstant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School Designsegoetzinger
 
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...shivangimorya083
 
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...ssifa0344
 
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptxOAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptxhiddenlevers
 
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130Suhani Kapoor
 
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure service
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure serviceCall US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure service
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure servicePooja Nehwal
 
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130 Available With Room
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130  Available With RoomVIP Kolkata Call Girl Jodhpur Park 👉 8250192130  Available With Room
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130 Available With Roomdivyansh0kumar0
 
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service NashikHigh Class Call Girls Nashik Maya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
The Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfThe Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfGale Pooley
 

Kürzlich hochgeladen (20)

Call Girls Service Nagpur Maya Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Maya Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Maya Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Maya Call 7001035870 Meet With Nagpur Escorts
 
Andheri Call Girls In 9825968104 Mumbai Hot Models
Andheri Call Girls In 9825968104 Mumbai Hot ModelsAndheri Call Girls In 9825968104 Mumbai Hot Models
Andheri Call Girls In 9825968104 Mumbai Hot Models
 
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...
VIP Call Girls LB Nagar ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With Room...
 
The Economic History of the U.S. Lecture 23.pdf
The Economic History of the U.S. Lecture 23.pdfThe Economic History of the U.S. Lecture 23.pdf
The Economic History of the U.S. Lecture 23.pdf
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
 
06_Joeri Van Speybroek_Dell_MeetupDora&Cybersecurity.pdf
06_Joeri Van Speybroek_Dell_MeetupDora&Cybersecurity.pdf06_Joeri Van Speybroek_Dell_MeetupDora&Cybersecurity.pdf
06_Joeri Van Speybroek_Dell_MeetupDora&Cybersecurity.pdf
 
03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx03_Emmanuel Ndiaye_Degroof Petercam.pptx
03_Emmanuel Ndiaye_Degroof Petercam.pptx
 
The Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfThe Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdf
 
Instant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School DesignsInstant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School Designs
 
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
 
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
Russian Call Girls In Gtb Nagar (Delhi) 9711199012 💋✔💕😘 Naughty Call Girls Se...
 
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
 
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptxOAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
OAT_RI_Ep19 WeighingTheRisks_Apr24_TheYellowMetal.pptx
 
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
VIP Call Girls Service Dilsukhnagar Hyderabad Call +91-8250192130
 
Veritas Interim Report 1 January–31 March 2024
Veritas Interim Report 1 January–31 March 2024Veritas Interim Report 1 January–31 March 2024
Veritas Interim Report 1 January–31 March 2024
 
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure service
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure serviceCall US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure service
Call US 📞 9892124323 ✅ Kurla Call Girls In Kurla ( Mumbai ) secure service
 
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130 Available With Room
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130  Available With RoomVIP Kolkata Call Girl Jodhpur Park 👉 8250192130  Available With Room
VIP Kolkata Call Girl Jodhpur Park 👉 8250192130 Available With Room
 
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service NashikHigh Class Call Girls Nashik Maya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service Nashik
 
The Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfThe Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdf
 

Makefile

  • 1. Makefile http://dev.emcelettronica.com/print/51790 Your Electronics Open Source (http://dev.emcelettronica.com) Home > Blog > allankliu's blog > Content Makefile By allankliu Created 27/05/2008 - 04:29 BLOG Microcontrollers When I first visited one of our famous TV manufacturers in China, I had no idea about the software capability of their software team. When I demonstrated my company's TV software for their evaluation, the software leader was surprised to see the modular software programming in many individual files. The software manager even commented, quot;Your software structure is very stupid, why do you put all of these functions into so many smaller files, instead of one single file? It is very head to find the variables in different files and requires longer compiling time.quot; I was almost choked by his words. But I could not argue with our customer face to face, it is very harmful to our business. So I let him to find the real answer, which way is stupid anyway? I can figure out why they got such one big file approach and stuck on it. First of all, none of this software team had programming background in UNIX, they only knew about DOS and Windows. Basically their programming experiences were only MS C++ or Turbo C++, which has IDE tools. And they got their first code base from Toshiba, I do not know why Toshiba released one single source file for their development, maybe it was a business trick. However I realized I need to prove our software advantage over theirs. So I changed one file of my software and the big file of their software, and then compile them separately. It requires 3 minutes to compile their big source file. And it completed compiling of my software with a make command in 5 seconds. Even they saw the difference, they still insisted on their points, but I knew they re-organized the whole software structure after this training. Most of the electronics engineers are not software experts, so they are innocent about many important software engineering concepts. Thanks Microsoft and Borland, this kind of innocent is all right for a PC programmer. These IDEs have already embedded make utilities. For example, nmake for MS C++, tmake for Borland Turbo C++. But most of the early embedded development tools did not offer make utility as a package, of course they did not offer IDEs as well. At that moment, or even today, a lot of engineers still use a batch file to compile their source code. They do not know about split the source into different head files and source files. They do not know how to use make to only compile the files changed, instead of whole project. They do not know how to use other utility to automatically generate head files from configuration files. They have no ideas how to manage a big project at all. I will like to discuss these topics in coming weeks, let us start it with makefile. Makefile actually is an old concept from UNIX development. Makefile is based upon compiling rules for a project and improve the project development efficiency. In a big project, there are many files in different folders. Of course you can write a DOS batch file to build whole project. 1 din 3 28.05.2008 11:15
  • 2. Makefile http://dev.emcelettronica.com/print/51790 But makefile can judge which steps should be done first, which steps can be ignored, and even more complicated goals. All of these are decided by the rules in makefile, instead of manually specified. Of course, in order to utilize make features, a project should be written in modular programming method, one big file project can just be programmed once anyway. PS: The modular programming has many other benefits in software engineering, not only for makefile. The rule of makefile is: target ... : prerequisites ... command ... ... That means, in order to build a target (i.e. object files), we should have files of prerequisites (i.e. head files), the conversion tools are command (i.e. c compiler). This rules are core of a makefile. Here is a simple makefile for GNU make (gmake). One implicit rule is that the conversion takes place only if the one of prerequisites files is newer than the target. That means it changed since last make. By the way, you must type a table key before command, otherwise the gmake will not process it. edit : main.o kbd.o command.o display.o insert.o search.o files.o utils.o cc -o edit main.o kbd.o command.o display.o insert.o search.o files.o utils.o main.o : main.c defs.h cc -c main.c kbd.o : kbd.c defs.h command.h cc -c kbd.c command.o : command.c defs.h command.h cc -c command.c display.o : display.c defs.h buffer.h cc -c display.c insert.o : insert.c defs.h buffer.h cc -c insert.c search.o : search.c defs.h buffer.h cc -c search.c files.o : files.c defs.h buffer.h command.h cc -c files.c utils.o : utils.c defs.h cc -c utils.c clean : rm edit main.o kbd.o command.o display.o insert.o search.o files.o utils.o If defs.h changed, then all related targets, i.e. all *.o files will be generated, and finally edit file will be generated. If main.c changed, the makefile will only generate main.o and edit. That is rule of a makefile. You can also type quot;make cleanquot; to remove all of the generated files on list by executing rm command. The example is small for demonstration purpose, it will be very efficient in a huge project like DTV project. If you still stick on DOS batch, every single change will test your patient. 2 din 3 28.05.2008 11:15
  • 3. Makefile http://dev.emcelettronica.com/print/51790 Different make tools have different syntax, in order to unique our embedded system development, GNU gmake is a good tools for most of the embedded system. But GNU gmake is a quite complicated tool, you might have no interested in its 200-page manuals. Personally I recommend the makefile template from AVR freak for your reference, the makefile has been separated into common makefile and a project make. This offers a mature makefile starting point for your project. You can download the GCC tools from this site, the makefile and a demo project is included. You can easily port it to your existing projects on 8051, PIC, MSP... Don't bother for ARM or MIPS, their tool chains have already integrated gmake. Makefile has its own issues, recursive make, which splits one central makefile into distributed makefile in different folders and sub folders. That is quite common is Linux project. The author of Safer C presented an article as Harmful Recursive Makefile. You can read it if you are interested in this topic. But AVRfreak's makefile is enough for medium size project. In next blog, let us discuss how to use gawk to automatically generated the dependency rules of make file. It is funny. You can reuse that principle to generate document as well. I know you hate writing documents and synchronize the code changes to your documents in every time. Reference P.Miller's Safer C and makefile [1] AVRFreak web site [2] Trademarks Source URL: http://dev.emcelettronica.com/makefile Links: [1] http://miller.emu.id.au/pmiller/books/rmch/ [2] http://www.avrfreaks.net/ 3 din 3 28.05.2008 11:15