I'm unclear on what goes in a makefile, and what goes in a header file.
From what I understand a makefile has the format:
target: dependencies
instructions
But that didn't work for me. Here's exactly what I did:
library: login.o linked.o cipher.o
gcc -o library login.o linked.o cipher.o
login.o: login.c linked.h
gcc -c login.c
linked.o: linked.c cipher.h
gcc -c linked.c
cipher.o: cipher.c
gcc -c cipher.c
When I type "make makefile" into the command line the compiler says "make: Nothing to be done for `makefile'". I'm guessing I got the format wrong. Also, what is the library part for? I just copied it from somewhere. Does every makefile have one?
Also, is there an extension for makefiles (makefile.txt, makefile.c)?
And do makefiles have to be named makefile? Could I name it taliasmakefile or makefile69 or lykeim2freespirited4skool or iwanaBahippie?
As for header files I can't find any clear examples of what exactly goes in them. Do you include variables that you want other files to be able to access? Or function prototypes?
I'm really new to C. Could someone explain this to me like I'm 5?