I, for the of me, can't write my own Makefile.
What it is that I want to do is have three files:
main.c - which will #include "functions.h"
functions.c - which will have functions in it, lets call them: foo() and bar()
functions.h - which has the declaration of foo()
The thing is that I want main.c to be able to call foo(), but not bar().
***** main.c *****
#include <stdio.h>
#include <stdlib.h>
#include "functions.h"
main()
{
foo();
}//end main
***** functions.h *****
void foo(void);
***** functions.c *****
#include <stdio.h>
#include <stdlib.h>
#include "functions.h"
void foo(void)
{
bar();
}//end foo
void bar(void)
{
printf("\nMeow?\n\n");
}//end bar
This is what I have for a make file:
***** Makefile *****
TEST2.exe : main.o functions.o
cc main.o functions.o -o TEST2.exe
main.o : main.c
cc -c main.c
functions.o : functions.c functions.h
cc -c functions.c
The problem that I have is that with this setup, I can still call bar() from my main.c file...
I don't even know if I'm making my Makefile correctly. :unsure:
What do I do? :cry: