Visit Our UNIX and Linux User Community


Make utility


 
Thread Tools Search this Thread
Operating Systems Solaris Make utility
# 1  
Old 10-07-2005
Make utility

Hi Guys,

I m very confused about the make/makefile utility in all unix.

1) My questions is why we need make.
2) Why some source code needs to complile.
3) I download the Bind 9 from Sunfreeware.com. I use pkgadd -d to install the bind. I 'm struck here becasue I can't find /etc/named.conf file. Why is it so.


Thanks in advance for all help.


Kelvin Smilie
# 2  
Old 10-10-2005
Quote:
1) My questions is why we need make.
2) Why some source code needs to complile.
3) I download the Bind 9 from Sunfreeware.com. I use pkgadd -d to install the bind. I 'm struck here becasue I can't find /etc/named.conf file. Why is it so.
Source code doesn't 'NEED' to be compiled - source code can sit out there doing nothing at all. You would need to compile it so that you can create the executable only if you need that software.

If you were not running Bind before (or running an old version 4), then you might need to create the /etc/named.conf. I would have thought there would be an example file but I didn't find one (probably less of a download if they get rid of the stuff you can easily build). Your /etc/named.conf will be specific to your server. There are examples in the named.conf man page which would get you started. Also look at the rndc.conf man page. And suggest you buy "DNS & Bind" from O'Reilly books.

Last edited by RTM; 10-10-2005 at 02:28 PM..
# 3  
Old 10-10-2005
Quote:
Originally Posted by bigmoon
I m very confused about the make/makefile utility in all unix.

1) My questions is why we need make.
2) Why some source code needs to complile.
Hmm ... the Make/Makefile concept is not unique to Unix. MS Visual C++ also uses Makefile to automate the build process of a source project. It just has an interface fancy enough to hide some of its dark corners.

You need to distinguish the roles played by "make" and compilation. Make is a build utility. It defines a language (in the way you write Makefiles) that allows developers to specify exactly the way they would like their source files to be transformed (by means of external commands that carry out the actual transformation), and, most importantly, the interdependencies of source files and their derivatives (such as compiled object code, executables etc.). Finding out the interdependencies is exactly the strength of Make, otherwise we can always put the transformation commands in a batch file (shell script), which will always work but you will miss one of the major offerings of a build system - selective transformation (compilation).

For instance, given this simple Makefile:

Code:
.PHONY: all clean

all: output.html

output.html: stylesheet.xsl model.xml
    xsltproc stylesheet.xsl model.xml > output.html

clean:
    -rm output.html

which generates the file "output.html" derived from two source files "stylesheet.xsl" and "model.xml" (the dependencies). We confirm we get the generated "output.html":

Code:
cbkihong@cbkihong:/dev/shm$ make
xsltproc stylesheet.xsl model.xml > output.html

cbkihong@cbkihong:/dev/shm$ ls -l
總計 16
-rw-r--r--  1 cbkihong cbkihong 118 2005-10-11 08:27 Makefile
-rw-r--r--  1 cbkihong cbkihong 157 2005-10-11 08:27 model.xml
drwxr-xr-x  2 root     root      60 2005-10-11 07:51 network
-rw-r--r--  1 cbkihong cbkihong 253 2005-10-11 08:28 output.html
-rw-r--r--  1 cbkihong cbkihong 415 2005-10-11 08:28 stylesheet.xsl

But if we run "make" again,

Code:
cbkihong@cbkihong:/dev/shm$ make
make: Nothing to be done for `all'.

It detects the timestamp of "output.html" is newer than stylesheet.xsl and model.xml, so it concludes the previously generated target is up to date, hence a transformation is not required this time. So this is selective transformation. If you have a complex project involving lots of transformations, this will save you a lot of time for compilation if you have the previously generated derivatives. This is what a simple batch file that can't give you (without extra coding). Make manages this for you.

Although Make is frequently used for compilation, it is separate from the actual compilation process (which is performed by the transformation command specified). That is why I used the term "transformation" instead of "compilation" above. In the example above I did not compile any C source files, but I have used Make to automate the process of building in a likewise fashion. Think about Make as a coordinator of the build process. It manages the compilation of a source project, but the actual compilation is done by a compiler, not Make.

Previous Thread | Next Thread
Test Your Knowledge in Computers #679
Difficulty: Medium
IEEE 802.3 CSMA/CD, CSMA/CD stands for Carrier Sense, Multiple Authorization with Collision Detection.
True or False?

10 More Discussions You Might Find Interesting

1. Programming

A make-like build utility based on Lua

xmake is a make-like build utility based on lua. (Link to project site: xmake) The project focuses on making development and building easier and provides many features (.e.g package, install, plugin, macro, action, option, task ...), so that any developer can quickly pick it up and enjoy the... (1 Reply)
Discussion started by: waruqi
1 Replies

2. UNIX for Dummies Questions & Answers

Make Utility Question

Hello, I'm a recent convert to UNIX and I'm attempting to understand exactly how the make utility is working under the hood. Now, I understand that each rule has a target, dependencies, and update command, but the thing I'm confused about is exactly how the utility is determining when to... (1 Reply)
Discussion started by: kramer_102
1 Replies

3. Programming

make utility

Hi, Could someone tell me why make utility is mostly preferred for compilation and generating executable in UNIX rather than any user created scripts which contains commands for compilation? (2 Replies)
Discussion started by: naan
2 Replies

4. Programming

Help with a C program that acts like the make utility

Hi, I'm trying to create a C program that functions like the make utility in UNIX for personal use. My program would read in from a generic makefile and execute whatever is in that makefile but I'm not sure as to where I should start coding. I would appreciate any help. Thanks. (1 Reply)
Discussion started by: kratos.
1 Replies

5. UNIX for Dummies Questions & Answers

How to print something in make utility

Hi want to know the syntax of printing something (value or variable) in GNU make utility. I give this in the Makefile: echo "Hi" OR @echo "Hi" But I only get error this when I run make (at the line where I have echo): Makefile:9: *** missing separator. Stop. Whats the problem? How can... (2 Replies)
Discussion started by: radiatejava
2 Replies

6. Solaris

Make utility - some Qs togurus..

(Sorry for previous not on enlish! I did not realized it is english forum. ) I am looking for help with Make utility. I could not get help from the 'man' pages. 1. About Macro (as a variable): It is clear about defining any macro in beginning or in command line, but isn't it no way to redefine... (0 Replies)
Discussion started by: alex_5161
0 Replies

7. UNIX for Dummies Questions & Answers

is there kind of good utility that convert make files to dsp?

Hello all im looking for some kind of utility that convert make files to dsp files is there any kind of tool/script that does this job? thanks (1 Reply)
Discussion started by: umen
1 Replies

8. Programming

MAKE utility

I wrote a makefile, every thing is working fine, But One of the C header files which is created by me is kept in a different folder other than the current directory, I have given this PATH to VPATH Variable Example :- VPATH = /home/user1/projects/victor.h It gives an error as : file... (4 Replies)
Discussion started by: victorvvk
4 Replies

9. Programming

Make utility

When we run the make utility , make compiles only those files which are undergone changes(other files which have not undergone any changes are not recompiled) The Following quotes says When you run the make utility, it examines the modification times of files and determines what needs to be... (4 Replies)
Discussion started by: victorvvk
4 Replies

10. Programming

Using make utility to create an mini-app

The following is my makefile. When I run "make", it gives me a bunch of error. I've compiled each file separately and there are no compilation errors. The target is "monprc". Have a look below: monprc: monprc.o monrep.o dsz.o cc -o monprc monprc.o monrep.o dsz.o monprc.o: monprc.c... (1 Reply)
Discussion started by: Yifan_Guo
1 Replies

Featured Tech Videos