Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Dec 1998 12:24:01 -0500
From:      "Steve Friedrich" <SteveFriedrich@Hot-Shot.com>
To:        "Schumacher Christoph" <chris_schumacher@t-online.de>
Cc:        "FreeBSD Questions" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: makefile
Message-ID:  <199812011726.MAA18384@laker.net>

next in thread | raw e-mail | index | archive | help
On Tue, 01 Dec 1998 15:48:08 +0100, Schumacher Christoph wrote:

>Im using BSD 2.2.6 and id like to write programs to learn programing (logicaly)
>Now i got a Makefile of my University, bur they say its a global makefile
>for all unix'
>I attached it. it neither works with gmake nor make....but i dont know why..??
>Could you help me ??

I don't understand why you got their Makefile...

If you're trying to learn programming, you don't HAVE to use Makefiles,
they just simplify a *build* process.

What computer language are you attempting to learn?

The FIRST program you should write in ANY language is one that simply
outputs a message to the screen.  Learning how to do this allows you to
display *debug* messages from your programs, showing what variables are
set to, output messages indicating how far the program has gotten, etc.

If you are familiar with the famous "Hello, world" program from
Kernighan and Ritchie's "The C Programming Language", here's a simple
Makefile:

Assumptions:
You have a C compiler/environment installed on your computer
You have the K&R "Hello, world" source in hello.c

Makefile:
hello:	hello.c Makefile
	cc hello.c -o hello

The first line in the Makefile, "hello:	hello.c Makefile"
contains the make target, i.e., "hello"
and it's dependancies, i.e., "hello.c Makefile"

So what make does, is it looks at the date/time stamp on hello,
hello.c, and Makefile.  If hello.c and/or Makefile has a *newer* time
stamp than hello, it will process the commands following the
target/dependancy line.

In this case, it invokes the C compiler.

You use the Makefile by invoking the following command at a shell
prompt:
make hello

You can read more in the man pages for cc and make:
man make
man cc

You could get a book on make from O'Reilly at http://www.ora.com/


Unix systems measure "uptime" in years, Winblows measures it in minutes.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812011726.MAA18384>