473,836 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What are makefiles useful for?

Someone can explain me what are makefiles useful for? Couldn't i write
shell script instead of makefiles? (*.sh in unix; *.cmd in win32)

Moreover i really doesn't understand what dependencies are useful
for? Except when i need to compile different files with different
compile options, i doesn't need to declare explicitly dependecies.
Infact the compiler already find dependecies looking for header files
included into the sources.

Can you explain me circumstances in which dependecies are useful?

Thanks
Jul 22 '05 #1
5 1969
dj***@excite.it wrote:
Someone can explain me what are makefiles useful for? Couldn't i write
shell script instead of makefiles? (*.sh in unix; *.cmd in win32)
Makefiles are used to keep dependencies between different parts of the
project. You can do it all using shell script, of course.
Moreover i really doesn't understand what dependencies are useful
for?
They are useful if you don't want to keep track of what needs to be
rebuilt (recompiled/relinked/rearchived) when a file is updated. Also,
the importance of the dependencies is that they propagate.
Except when i need to compile different files with different
compile options, i doesn't need to declare explicitly dependecies.
Well, it's your right to think so.
Infact the compiler already find dependecies looking for header files
included into the sources.
Your compiler probably does. Many don't.
Can you explain me circumstances in which dependecies are useful?


See above.

One thing I have to mention, though. Your inquiry is OFF-TOPIC. Please
take the further discussion to comp.software-eng. Follow-ups set.

V
Jul 22 '05 #2
"dj***@excite.i t" wrote:

Someone can explain me what are makefiles useful for? Couldn't i write
shell script instead of makefiles? (*.sh in unix; *.cmd in win32)

Moreover i really doesn't understand what dependencies are useful
for? Except when i need to compile different files with different
compile options, i doesn't need to declare explicitly dependecies.
Infact the compiler already find dependecies looking for header files
included into the sources.

Can you explain me circumstances in which dependecies are useful?


In short:
Whenever your project consists of more then 1 source file. In practice
this means: always

Consider your project consists of 4 files:
a.cpp, b.cpp, c.cpp, inc.h

Now a.cpp includes inc.h, so does b.cpp
But c.cpp does not include inc.h

So whenever inc.h changes, what needs to be done?
a.cpp needs to be recompiled
b.cpp needs to be recompiled
but for c.cpp the linker can simply use the object
file generated in a previous compiler run for c.cpp. No
recompile is necessary, since nothing in inc.h can influence
anything in c.cpp

And that is the job of the makefile to describe this:
when inc.h changes, recompile a.cpp, b.cpp and link
the object files a.o, b.o, c.o to form the new, updated
final executable.

With shell scripts you don't get that flexibility to just recompile
what is needed to be compiled. You can only recompile everything.
And that can make a difference: Eg. I currently do a recompile of
everything in the program system I am involved in. The system consists
of roughly more then 1500 files with lots of dependencies. I started
the 'compile all' at 16:05. Current time is 18:16. The rebuild is
nearly through ......

--
Karl Heinz Buchegger
kb******@gascad .at
Jul 22 '05 #3
dj***@excite.it wrote:
Someone can explain me what are makefiles useful for? Couldn't i write
shell script instead of makefiles? (*.sh in unix; *.cmd in win32)
That's because . . .
Moreover i really doesn't understand what dependencies are useful
for?

Do a bit of elementary research and stop posting off-topic stuff to
newsgroups.


Brian
Jul 22 '05 #4
dj***@excite.it wrote:
Someone can explain me what are makefiles useful for? Couldn't i write
shell script instead of makefiles? (*.sh in unix; *.cmd in win32)

Moreover i really doesn't understand what dependencies are useful
for? Except when i need to compile different files with different
compile options, i doesn't need to declare explicitly dependecies.
Infact the compiler already find dependecies looking for header files
included into the sources.

Can you explain me circumstances in which dependecies are useful?


I used Google

http://www.google.com/

to search for

+"make tutorial"

and I found lots of stuff.
Jul 22 '05 #5
dj***@excite.it (dj***@excite.i t) wrote in
news:66******** *************** ***@posting.goo gle.com:
Someone can explain me what are makefiles useful for? Couldn't i write
shell script instead of makefiles? (*.sh in unix; *.cmd in win32)


Yes, but you'd end up writing the same script with different parameters
every time.

makefiles are just that script.
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1661
by: dharmesh Gupta | last post by:
Dear All, can anyone pls tell me how to make a makefile with a small example. i am very confused. Thanks to all
1
1550
by: Janne Naukkarinen | last post by:
Have someone commercial Digital Mars (DMC) IDDE? I need help making makefiles, it is easier with IDDE. However, IDDE is not freely distributed on net. There is current WinVN WIP:
15
1823
by: Jonathan Turkanis | last post by:
Hi All, I hope this is not too far off topic here, but I can't think off any place where it would be exactly on topic. I'd like to get some sense of how widely used certain IDEs are. I'm particularly interested to know how widely used are Borland C++BuilderX (on various operating systems) and Bloodshed Dev-CPP. I'd also like to know what C++ IDE people think is best for Linux.
121
10225
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
10
2520
by: JS | last post by:
I have two Makefiles in two different directories. How do I know which of these Makefiles make will use and is there some way to specify which Makefile that should be run.
19
2556
by: milkyway | last post by:
Hello, I am running under Suse Linux and am putting together some code written in C. I am not clear on how to create makefiles and was wondering if there were any "makefile tools" out there. If so, what are the best ones? TIA
2
2962
by: barcaroller | last post by:
Not sure whether this is the right newsgroup but... is there any way I can tell lint (or one of its derivates) to pick up DEFINE statements/macros and header file INCLUDE paths from Makefiles so that I do not have to pass them through the lint command-line?
22
1877
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
I already understand how program compilation works (i.e. the preprocessor produces individual translation units which get compiled separately, and then the linker links the object files together), but I don't know anything about makefiles. If I had the following program: /* main.c */ extern void Func(void);
3
4697
by: tvnaidu | last post by:
porting windows static libs and dll into linux static lib abd shared lib, any tool to convert vcproj files to Linux makefiles? porting windows static libs and dll into linux static lib abd shared lib, any tool to convert vcproj files to Linux makefiles? I have Visual studio 2005 vcproj files need to convert to Linux makefile, any clue how to do? Porting windows app to Linux, any tool to convert vcproj files to Linux Makefile?,...
0
9820
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9671
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10549
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6979
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5650
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5828
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.