I have a subfolder1/Submain.c
{
//initialize statements
CallFunction1();
}
subfolder2/Submain.c
{
//initialize statements
CallFunction2();
}
and so on.
In the MainFolder
there is a make
file to include all the subfolders.Like subfolder1 subfolder2 etc. The mainfolder also has this mainfile.h
which has all the function definitions (like CallFunction1
and CallFunction2
). I know by practice it is not a good idea to have function definitions i n .h
file. So I want to create a new .h
file with all the function declarations (like an interface) and include this .h in the subfolders. But I don't know how to do this. Can someone please help. So the main thing is I dont know how to link the new .h and the .C
Here is the make file in (BIGDIR/tests/Mainfolder/Subfolder1)
include $(BIGDIR)/tests/make/Makefile.defs
TEST_NAME := test1
LCINCS += -I$(BIGDIR)/../tests/Mainfolder
C_FILES := SubMain.c
include $(BIGDIR)/tests/make/Makefile.rules
Here is the SubMain.c
#include "Main.h"
{
// do things
CallFunction1(); //this function is defined in Main.h which is in Mainfolder
}
I want to modify it in such a way that
in subfolder1/submain.c
I can have
#include "NewMain.h"
such that NewMain.h
has all the function declarations and
main.c
still has all the function definitions (so old Main.h
==> NewMain.c
).
Current contents of Makefile in Mainfolder is:
include $(BIGDIR)/tests/make/Makefile.defs
SUBDIRS += subfolder1
SUBDIRS += subfolder2
include $(BIGDIR)/tests/make/Makefile.rules
PS: I have no access to change the rules. But I can play with Main Makefile and Makefile in subfolders.