This might be better for a simple overview. A 7-page explanation of make and makefiles.

http://www.oreilly.com/openbook/make3/book/ch01.pdf

bp
<part15sbs{at}gmail{dot}com>

On 2/9/2018 8:44 AM, ch...@wbmfg.com wrote:
OK, but I need a file called “make”, right?
And it needs stuff inside it.
This is one example I found:

    all: output_file_name
    output_file_name: main.o
    gcc main.o -lbcm2835 -o output_file_name
    main.o: main.c
    gcc -c main.c
    clean: rm -rf *o output_file_name

I presume this is like a batch file.
I am guessing it is a text file with the name make.
I guess the output_file_name would be replaced with my “hello” or some such thing. Perhaps the “-lbcm2835” is the source code file?  -o is probably related to an object file. I know this is very elementary.  I can write C with ease.  Just getting over this initial hump.
Like, where do you put the key in this car.
(there used to be a car that you turned the key on, then floored the accelerator.  The starter button was part of the gas pedal and would not engage unless it was fully depressed.  )
From: Bill Prince
Sent: Friday, February 9, 2018 9:36 AM
To: af@afmug.com
Subject: Re: [AFMUG] OT Hello World
A make file is just a list of dependencies, and what to do if the dependency is met. Sort of:  "If hello.c is newer than hello, then compile it". It can be as simple as that, but can get a whole lot more complicated if there are libraries and such. However, in the simple case of your hello.c, I would put everything in the same directory. As the project grows, you would move your source (*.c) files into a "source" directory, and the binaries (*.bin) into a bin directory. Then linking all the binaries would be dependent on the dates of those file. So linking is dependent on the binaries, and the binaries are dependent on the sources.
Make should be installed already.
bp <part15sbs{at}gmail{dot}com>
On 2/9/2018 6:51 AM, ch...@wbmfg.com wrote:
I hate make files.  I love IDEs.
Bought a raspberry PI and am playing with it a bit.  So far I really like it. Started to write a program using a Geaney editor.  Nice editor.  Hit the make button and I discovered it is really just a shell, that you have to have a gcc make somewhere. So, not being a linux hack, what folder should may source and other project files be in?
Should the make file be there with it?
Can someone please be kind enough to send me two things:
1.  hello.c source
void main {
    printf(“hello world”);
}
(I probably don’t need that as It is right there in this email.  But I do need to put it in the proper folder name and associate it with GCC presumably with the make file.
2)    A make file that will allow that program to compile.
Did I say I hate make files?
I have downloaded example make files.  It appears I need to change some file names in them to match the file name of my source.  But I would like to make my Geany program be able to cause the make file to be correct if I change the name of the project.  Perhaps that is not possible.  One of my sons is trying to encourage me to put windows on it and use visual C++.  I don’t want to do that because this is a simple bit banging project.
I don’t care where the object files go or what they are named.
If I want to include a .h file it will be in my source.
My handicap comes from TurboC coming on the scene when I first started doing a bunch of c code writing.  Before that it was asm
(before that it was fortran, pascal, basic)

Reply via email to